-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
utils::chunked_vector fill constructor is exception unsafe #18635
Labels
Comments
bhalevy
added a commit
to bhalevy/scylla
that referenced
this issue
May 13, 2024
Currently, if the fill ctor throws an exception, the destructor won't be called, as it object is not fully constructed yet. Call the default ctor first (which doesn't throw) to make sure the destructor will be called on exception. Fixes scylladb#18635 Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
1 task
bhalevy
added a commit
to bhalevy/scylla
that referenced
this issue
May 13, 2024
Reproduces scylladb#18635 Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
bhalevy
added a commit
to bhalevy/scylla
that referenced
this issue
May 13, 2024
For insertion, with and without reservation, and for fill and copy constructors. Reproduces scylladb#18635 Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
denesb
added a commit
that referenced
this issue
May 14, 2024
…nny Halevy Currently, if the fill ctor throws an exception, the destructor won't be called, as it object is not fully constructed yet. Call the default ctor first (which doesn't throw) to make sure the destructor will be called on exception. Fixes #18635 - [x] Although the fixes is for a rare bug, it has very low risk and so it's worth backporting to all live versions Closes #18636 * github.com:scylladb/scylladb: chunked_vector_test: add more exception safety tests chunked_vector_test: exception_safe_class: count also moved objects utils: chunked_vector: fill ctor: make exception safe
mergify bot
pushed a commit
that referenced
this issue
May 14, 2024
Currently, if the fill ctor throws an exception, the destructor won't be called, as it object is not fully constructed yet. Call the default ctor first (which doesn't throw) to make sure the destructor will be called on exception. Fixes #18635 Signed-off-by: Benny Halevy <bhalevy@scylladb.com> (cherry picked from commit 64c51cf)
mergify bot
pushed a commit
that referenced
this issue
May 14, 2024
Currently, if the fill ctor throws an exception, the destructor won't be called, as it object is not fully constructed yet. Call the default ctor first (which doesn't throw) to make sure the destructor will be called on exception. Fixes #18635 Signed-off-by: Benny Halevy <bhalevy@scylladb.com> (cherry picked from commit 64c51cf)
This was referenced May 14, 2024
bhalevy
added a commit
that referenced
this issue
May 21, 2024
Currently, if the fill ctor throws an exception, the destructor won't be called, as it object is not fully constructed yet. Call the default ctor first (which doesn't throw) to make sure the destructor will be called on exception. Fixes #18635 Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
bhalevy
added a commit
that referenced
this issue
May 21, 2024
For insertion, with and without reservation, and for fill and copy constructors. Reproduces #18635 Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
bhalevy
added a commit
that referenced
this issue
May 21, 2024
Currently, if the fill ctor throws an exception, the destructor won't be called, as it object is not fully constructed yet. Call the default ctor first (which doesn't throw) to make sure the destructor will be called on exception. Fixes #18635 Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
bhalevy
added a commit
that referenced
this issue
May 21, 2024
For insertion, with and without reservation, and for fill and copy constructors. Reproduces #18635 Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
denesb
added a commit
that referenced
this issue
May 21, 2024
…n safe' from ScyllaDB Currently, if the fill ctor throws an exception, the destructor won't be called, as it object is not fully constructed yet. Call the default ctor first (which doesn't throw) to make sure the destructor will be called on exception. Fixes #18635 - [x] Although the fixes is for a rare bug, it has very low risk and so it's worth backporting to all live versions (cherry picked from commit 64c51cf) (cherry picked from commit 88b3173) (cherry picked from commit 4bbb66f) Refs #18636 Closes #18679 * github.com:scylladb/scylladb: chunked_vector_test: add more exception safety tests chunked_vector_test: exception_safe_class: count also moved objects utils: chunked_vector: fill ctor: make exception safe
denesb
added a commit
that referenced
this issue
May 21, 2024
…n safe' from ScyllaDB Currently, if the fill ctor throws an exception, the destructor won't be called, as it object is not fully constructed yet. Call the default ctor first (which doesn't throw) to make sure the destructor will be called on exception. Fixes #18635 - [x] Although the fixes is for a rare bug, it has very low risk and so it's worth backporting to all live versions (cherry picked from commit 64c51cf) (cherry picked from commit 88b3173) (cherry picked from commit 4bbb66f) Refs #18636 Closes #18680 * github.com:scylladb/scylladb: chunked_vector_test: add more exception safety tests chunked_vector_test: exception_safe_class: count also moved objects utils: chunked_vector: fill ctor: make exception safe
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If
chunked_vector<T, max_contiguous_allocation>::chunked_vector(size_t n, const T& value)
throws an exception,the destructor won't be called, since the object is not fully constructed.
To make that happen, this constructor, like the other constructors, needs to first call the default constructor (that doesn't throw).
See
scylladb/utils/chunked_vector.hh
Line 354 in c8cc47d
The text was updated successfully, but these errors were encountered: