Tunnel requested abort exception to semaphore wait caller#2601
Merged
xemul merged 7 commits intoscylladb:masterfrom Jan 10, 2025
Merged
Tunnel requested abort exception to semaphore wait caller#2601xemul merged 7 commits intoscylladb:masterfrom
xemul merged 7 commits intoscylladb:masterfrom
Conversation
Member
Author
|
@scylladb/seastar-maint please review and consider merging |
xemul
reviewed
Jan 9, 2025
tests/unit/semaphore_test.cc
Outdated
| }); | ||
| as.request_abort_ex(std::runtime_error("expected")); | ||
| sem.signal(); | ||
| BOOST_CHECK_THROW(fut1.get(), std::runtime_error); |
Contributor
There was a problem hiding this comment.
How confident are we, that this thrown-and-caught runtime_exception is the one from above as.request_abort_ex(), but not some "generic" runtime error that accidentally crept in along the way?
Member
Author
There was a problem hiding this comment.
I have no reason to suspect that, but I can change this to a unique exception type to increase the confidence.
So that users can distinguish between timer expiration to other abort sources. Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
For passing an exception_ptr from the abort_source to the callback, allow the OnAbort class to have a call operator accepting an optional exception_ptr. Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
If waiting with timeout or abort_source, check (under [[unlikely]]) if the timeout is already expired, or abort requested, before appending an entry to the wait_list, which is rather expensive. We do this so that we can easily distinguish between timeout error to aborted errors, as in `make_back_abortable` there isn't a good way to distingush the two if abort is already requested by the type-erased abort_source. Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
Move into tests/unit/expected_exception.hh Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
Accept an optional exception_ptr in the expiry_handler and pass it on to the entry promise, so that the original abort exception can be passed to the user. This way we can distinguish between, e.g. timed_out_error and abort_requested_error. Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
a0e5507 to
f8c36db
Compare
Member
Author
|
In v2 (f8c36db):
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Today, when calling
wait(abort_source&)the caller always getssemaphore_abortederror when abort is requested.However, with
abort_on_expiry, the actual reason could be timeout expiry, which should be distinguishable from the abort error.This series modifies
abort_on_expiryfirst to request abort with atimed_out_errorexception, and theninternal::abortable_fifoandsemaphoreare changed to tunnel that exception to the caller.Respective unit tests were added to test those cases.
The motivation for this change is scylladb/scylladb#22017
which will use scylladb utils::composite_abort_source to compose an
abort_on_expiryabort_source, used for point request timeout and a global abort_source used on shutdown.