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

1002 Add option to disable signal handlers in vt::finalize #1027

Merged
merged 4 commits into from
Sep 18, 2020

Conversation

JacobDomagala
Copy link
Contributor

@JacobDomagala JacobDomagala commented Sep 7, 2020

Fixes #1002

@JacobDomagala
Copy link
Contributor Author

JacobDomagala commented Sep 7, 2020

Worth Noting:
Signal handlers are setup in Runtime constructor, so calling vt::finalize(disable_sig = true) and then vt::initialize() will not re-enable signal handlers.

@codecov
Copy link

codecov bot commented Sep 7, 2020

Codecov Report

Merging #1027 into develop will decrease coverage by 0.00%.
The diff coverage is 78.57%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1027      +/-   ##
===========================================
- Coverage    77.61%   77.60%   -0.01%     
===========================================
  Files          672      672              
  Lines        25761    25770       +9     
===========================================
+ Hits         19994    20000       +6     
- Misses        5767     5770       +3     
Impacted Files Coverage Δ
src/vt/runtime/runtime.h 80.00% <ø> (ø)
src/vt/runtime/runtime.cc 61.00% <76.92%> (+0.11%) ⬆️
tests/unit/pipe/test_signal_cleanup.cc 100.00% <100.00%> (ø)

@pnstickne
Copy link
Contributor

pnstickne commented Sep 8, 2020

What if the option has to be controlled via the normal Args? (And perhaps defaults to true..)

What if the handlers always disabled on the finalize (and always re-added if specified) in initialize?

Is there a case that code might wish to only sometimes disable on finalize?

Is there a reason not to ensure the handlers are (re-setup) in initialize, if done?

@JacobDomagala
Copy link
Contributor Author

Adding an option to re-enable handlers in initalize() is a good idea i think

@JacobDomagala JacobDomagala force-pushed the #1002-disable-signal-handlers-on-finalize branch from 8ed61a6 to 65c3e96 Compare September 10, 2020 15:02
@JacobDomagala
Copy link
Contributor Author

JacobDomagala commented Sep 10, 2020

Ok so i added the flag which will indicate whether the signal handlers were disabled on last vt::finalize() call. This flag is now used inside vt::initialize() together with finalized_ field which indicates if Runtime component is being re-initialized.

Based on the comment on top of the runtime.cc file i assume that contents of arg_config_ variable will be valid during vt::initialize() call (setupSignalHandler() and setupSignalHandlerINT() use arg_config_ to determine which handlers to setup)

After Runtime::finalize() is called but before the pack is destroyed, we extract the ArgConfig from the component and put it back in arg_config_ for use after.
From then on, until the vt::Runtime is destroyed or VT is re-initialized arg_config_ will contain the configuration.

@JacobDomagala
Copy link
Contributor Author

@PhilMiller @lifflander Should we also disable termination handler?

@JacobDomagala JacobDomagala force-pushed the #1002-disable-signal-handlers-on-finalize branch from c1226dc to 3c5f417 Compare September 10, 2020 17:37
src/vt/runtime/runtime.h Outdated Show resolved Hide resolved
@JacobDomagala JacobDomagala force-pushed the #1002-disable-signal-handlers-on-finalize branch from 3c5f417 to 78669b9 Compare September 11, 2020 09:09
Copy link
Contributor

@cz4rs cz4rs left a comment

Choose a reason for hiding this comment

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

the code looks good (I don't know if there's anything missing from the functional point of view?)

@PhilMiller PhilMiller changed the title 1002 Add option do disable signal hanlders in vt::finalize 1002 Add option to disable signal handlers in vt::finalize Sep 11, 2020
@JacobDomagala JacobDomagala force-pushed the #1002-disable-signal-handlers-on-finalize branch from 78669b9 to 4f04338 Compare September 14, 2020 09:51
signal(SIGSEGV, SIG_DFL);
signal(SIGUSR1, SIG_DFL);
signal(SIGINT, SIG_DFL);
sig_handlers_disabled_ = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

Could also be in the positive case: sig_handlers_attached_ = false;.

@lifflander
Copy link
Collaborator

lifflander commented Sep 17, 2020

@JacobDomagala From now on, can you start your branch names with just the issue number, not a #? Thanks!

Copy link
Collaborator

@lifflander lifflander left a comment

Choose a reason for hiding this comment

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

Looks good to me

@JacobDomagala JacobDomagala force-pushed the #1002-disable-signal-handlers-on-finalize branch from 4f04338 to f7653cd Compare September 18, 2020 18:11
@PhilMiller PhilMiller merged commit 089a1c9 into develop Sep 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disable signal handlers when finalized
5 participants