-
-
Notifications
You must be signed in to change notification settings - Fork 169
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
fix: Signal Handlers on Non-Windows Platforms in sslclient #1123
Conversation
✅ Deploy Preview for dpp-dev ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Thanks for your contribution! This PR doesn't seem like it's carried anything from master so it's okay to stay up but next time please make your changes on a branch based from dev, rather than using the master branch! |
Also, next time, please read the description of the PR and choose the template that accurately reflects your PR. I've added the template in for you this time, please fill it out (and correct your PR title to follow our conventions please!) |
0f261f3
to
b448d3a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changes requested
Since not seeing this on GitHub directly, I will reply here and hope it
works. IIRC SIGHUP is generated when the controlling TTY is lost without
prior detaching (earlier it was called daemonization iirc). Today,
frameworks like runit or launchd are used for daemonization of services, so
if SIGHUP is generated, the controlling terminal is closed (most likely)
and thus the process will die anyway. So IMHO it does not change anything
if SIGHUP is ignored or not.
Am Sa., 6. Apr. 2024 um 18:12 Uhr schrieb Craig Edwards (Brain) <
***@***.***>:
… ***@***.**** commented on this pull request.
------------------------------
In src/dpp/sslclient.cpp
<#1123 (comment)>:
> @@ -237,11 +249,11 @@ ssl_client::ssl_client(const std::string &_hostname, const std::string &_port, b
keepalive(reuse)
{
#ifndef WIN32
- signal(SIGALRM, SIG_IGN);
- signal(SIGHUP, SIG_IGN);
+ set_signal_handler(SIGALRM);
+ set_signal_handler(SIGHUP);
I think SIGHUP should be ignored regardless? if it is captured we don't
know if this will interrupt the library and break it? the signals will
execute inside the libraries internal threads.
—
Reply to this email directly
|
There are many bots that don't use launchd etc for launching and will directly fork. these still need to be supported
Kind regards
Craig Edwards
Brainbox.cc
Creating fun stuff since 1993
…On 6 Apr 2024, 22:27, at 22:27, Nidhoegger ***@***.***> wrote:
Since not seeing this on GitHub directly, I will reply here and hope it
works. IIRC SIGHUP is generated when the controlling TTY is lost
without
prior detaching (earlier it was called daemonization iirc). Today,
frameworks like runit or launchd are used for daemonization of
services, so
if SIGHUP is generated, the controlling terminal is closed (most
likely)
and thus the process will die anyway. So IMHO it does not change
anything
if SIGHUP is ignored or not.
Am Sa., 6. Apr. 2024 um 18:12 Uhr schrieb Craig Edwards (Brain) <
***@***.***>:
> ***@***.**** commented on this pull request.
> ------------------------------
>
> In src/dpp/sslclient.cpp
>
<#1123 (comment)>:
>
> > @@ -237,11 +249,11 @@ ssl_client::ssl_client(const std::string
&_hostname, const std::string &_port, b
> keepalive(reuse)
> {
> #ifndef WIN32
> - signal(SIGALRM, SIG_IGN);
> - signal(SIGHUP, SIG_IGN);
> + set_signal_handler(SIGALRM);
> + set_signal_handler(SIGHUP);
>
> I think SIGHUP should be ignored regardless? if it is captured we
don't
> know if this will interrupt the library and break it? the signals
will
> execute inside the libraries internal threads.
>
> —
> Reply to this email directly, view it on GitHub
>
<#1123 (review)>,
> or unsubscribe
>
<https://github.com/notifications/unsubscribe-auth/A4EIMOO6QUJWGC3O7BNE44DY4ANG5AVCNFSM6AAAAABF2OPLL6VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTSOBUGU4DAOBWGQ>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>
--
Reply to this email directly or view it on GitHub:
#1123 (comment)
You are receiving this because you commented.
Message ID: ***@***.***>
|
As said: If they have a controlling TTY and its closed, they will
terminate, no matter if they ignore SIGHUP or not. If they fork and use
setsid and detach from a terminal, then they wont get SIGHUP on closure.
Ignoring SIGHUP will only make them not get the signal and terminate
anyways.
|
Anyway, changed it. There is no harm done in ignoring it IMHO |
To set everything to a known state. Not everything is checked and other
fields might be set.Message ID:
***@***.***>
… |
surely the nicer c++ way is just: sa = {}; |
Feel free to change it. I dont see a reason to.
|
Is this latest change tested? |
…in place. Also set the SA_RESTART flag to avoid operations returning EINTR.
…ng-style and reduced the numbers of memset
Only set signals to Ignore on non-Linux of no signal-handler is in place. Also set the SA_RESTART flag to avoid operations returning EINTR.
Code change checklist