-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8291569: Consider removing JNI checks for signals SIGPIPE and SIGXFSZ #12062
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
Conversation
👋 Welcome back dholmes! A progress list of the required criteria for merging this PR into |
@dholmes-ora The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
Hi David, I'm a bit confused here. Why do we bother with setting up a single handler for i.e. SIGPIPE at all then? If the user sets a no-op signal handler for SIGPIPE, without UseSignalChaining (and dependent on AllowUserSignalHandlers), before start of VM we seem to fatal out ? Isn't this a bit inconsistent? Shouldn't we just remove SIGPIPE/SIGXFSZ completely if we actually don't care? |
Thanks for looking at this @robehn . That's a good question. I don't know the answer - this is day one code from January 2000. I'll have to look further into it. |
The reason the VM handles (and ignores) SIGPIPE is because it can be raised by the OS when a socket connection is terminated. This would crash the VM unless we handle the signal - ref https://bugs.openjdk.org/browse/JDK-4630104 |
Correct me if I'm wrong, if we: If we need to either sig ignore or our ignore handler shouldn't we do periodic check? |
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.
Seems reasonable.
@dholmes-ora This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 31 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
Oops, I missed the discussion completely. My take on this: We need to ignore SIGPIPE and SIGXFSZ because the default action for them is to terminate the process, which we usually don't want (btw we don't do this for SIGLOST nor SIGXCPU, which seems inconsistent). By handling those signals, we cause the associated system functions to return errors instead (eg EPIPE). IIUC we normally expect user code to clearly communicate to us when they use their own signal handler. Via signal chaining (UseSignalChaining, AllowUserSignalHandlers etc). But setting a SIGPIPE handler - or temporarily disabling it - without signal chaining seems to be such a common pattern that we now remove the warning instead. We basically throw the hands in the air and give up. Have I read the intentions of this patch wrong? |
I'm wondering if the user have communicated this to the VM by using the proper option, but are starting without the signal handlers yet installed. I have not seen that you must install your handler before CreateVM, but maybe you must? |
To my understanding, this scenario should work if signal handling is set up correctly and completely (including pre-loading libjsig). There are two phases:
When we process a signal and signal chaining is on, we call the chained handler, with the one from the libjsig having precedence - jdk/src/hotspot/os/posix/signals_posix.cpp Lines 381 to 394 in 1a6ac60
And signal handler de-installation should just work accordingly. |
Now pieces fall into place. I totally forgot about libjsig. Thank you for your patience :) ! Seems reasonable to me also! |
Thanks for the discussion and reviews @robehn and @tstuefe
Given changing the handler is somewhat expected/normal then issuing an alarming warning only annoys people who expect to be able to run JNI-warning free. |
And just to be clear @robehn the scenario we are dealing with is the case where libjsig is not actually used - as we would not install the user's handler in that case we would chain to it. See: https://bugs.openjdk.org/browse/JDK-8292054 for the kind of scenario (though for different signals). So we do rely on the third-party code doing the right thing by taking over the handler temporarily and then restoring it - if they don't then yes we can crash. So that said I'm now second-guessing the approach here:
|
I'm fine with both approaches. |
Since Oracles troubleshooting guide guides howto get libjsig working and it's included in our builds, I would consider it a standard tool to be used in these situations. I'm fine with both also. |
Okay I will proceed as-is then. Thanks. /integrate |
Going to push as commit 64b25ea.
Your commit was automatically rebased without conflicts. |
@dholmes-ora Pushed as commit 64b25ea. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Simple enhancement to skip checking of the handlers for SIGPIPE and SIGXFSZ as we really don't care if they change, and we expect that they can.
The signal checking code might seem to have a redundancy as we skip these signals in two places, but the primary use of the
do_check_signal_periodically
array is to allow for only issuing one warning per signal. I could have skipped them in either place and get the same effect but it seemed inappropriate to set the array entry and not do the check; and vice-versa.Testing: just basic sanity test tiers 1-3. This doesn't affect any application behaviour.
There are no regression tests in this specific area and it did not seem worth the effort creating one just for this.
Thanks.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/12062/head:pull/12062
$ git checkout pull/12062
Update a local copy of the PR:
$ git checkout pull/12062
$ git pull https://git.openjdk.org/jdk pull/12062/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 12062
View PR using the GUI difftool:
$ git pr show -t 12062
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/12062.diff