Skip to content
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

Support interrupt transaction #993

Merged
merged 11 commits into from
Nov 6, 2024
Merged

Support interrupt transaction #993

merged 11 commits into from
Nov 6, 2024

Conversation

heifner
Copy link
Member

@heifner heifner commented Oct 30, 2024

Add support for interrupting a transaction in apply_block via ctrl-c or SIGINT/SIGTERM/SIGPIPE.

Requires AntelopeIO/appbase#36

Resolves #985
Resolves #876

@heifner heifner added the OCI Work exclusive to OCI team label Oct 30, 2024
expired = 1;
call_expiration_callback();
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels like this may introduce a possibility of the expiration callback being called twice? I am not sure how much that matters. Do we need to test_and_set both here and in the normal expiry path to guard against that?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was under the impression that it didn't matter to be called twice. Not sure how to exactly verify that. Maybe safest to do the test_and_set.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@heifner heifner marked this pull request as ready for review November 1, 2024 13:31
libraries/chain/controller.cpp Show resolved Hide resolved
libraries/chain/platform_timer_asio_fallback.cpp Outdated Show resolved Hide resolved
libraries/chain/platform_timer_asio_fallback.cpp Outdated Show resolved Hide resolved
libraries/chain/platform_timer_kqueue.cpp Outdated Show resolved Hide resolved
libraries/chain/platform_timer_posix.cpp Outdated Show resolved Hide resolved
@ericpassmore
Copy link
Contributor

Note:start
category: System Stability
component: Internal
summary: Support Interrupt Transactions in apply_block via ctrl-c or SIGINT/SIGTERM/SIGPIPE.
Note:end


void platform_timer::expire_now() {
bool expected = false;
if (expired.compare_exchange_strong(expected, true)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you can save a line of code using atomic_flag, but it doesn't really matter

@heifner heifner merged commit cf7c6e8 into main Nov 6, 2024
36 checks passed
@heifner heifner deleted the GH-985-interrupt-trx branch November 6, 2024 13:56
@ericpassmore
Copy link
Contributor

Support interrupt transaction
Note:start
category: System Stability
component: Internal
summary: Support interrupt transaction, brings along app base submodule update.
Note:end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCI Work exclusive to OCI team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OC Whitelist: ctrl-c interrupt of executing trx Handle signals on separate thread
4 participants