-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8253742: POSIX signal code cleanup #636
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 gziemski! A progress list of the required criteria for merging this PR into |
@gerard-ziemski 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. |
/label remove build |
@magicus |
|
Does anyone have a suggestion on how to merge with current JDK in the safest way? |
Webrevs
|
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.
Hi Gerard,
good job!
But we really should synchronize :)
I am currently working on: https://bugs.openjdk.java.net/browse/JDK-8255711
(see Draft PR: #982)
and https://bugs.openjdk.java.net/browse/JDK-8252533 is also still open (see #839) - still waiting Davids final OK.
So unfortunately there are a number of clashes with your change:
- "JVM_handle_xxx_signal()": See my mail to jdk-dev from this morning: https://mail.openjdk.java.net/pipermail/jdk-dev/2020-November/004887.html - we either can get completely rid of this function, which is what my current Draft for JDK-8255711 does. Or we need to retain it for backward compatibility, but if so, we need to retain it with the current interface.
Either way, could you please withhold changes to the hotspot signal handlers for the moment (so, both javaSignalHandler() and the various JVM_handle_xxx_signal() functions)?
- I removed some functions you changed - all that signal blocking mask stuff. See #839. Could you hold any changes to those functions until JDK-8252533 is out of the door? Hope to do this tomorrow, with your and Davids approval.
The unification of the signal handler printing stuff and the SR initialization make sense and are a good simplification.
Please fine further remarks remarks inline.
Cheers, Thomas
I hadn't realized that JVM_handle_XXX_signal defined a per-platform "public" entry point to allow external callers of the signal handling function in conjunction with -XX:+AllowUserSignalHandlers. We need to keep these but they can each call JVM_handle_posix_signal as their implementation. |
We should disentangle https://bugs.openjdk.java.net/browse/JDK-8255711 and this patch, https://bugs.openjdk.java.net/browse/JDK-8253742. I started by giving my patch a less generic name ("Fix and unify hotspot signal handlers"). I propose to do the same with this patch, or even split this patch into two smaller parts, since it does two things:
As I wrote, I'd prefer to keep changes to JVM_xxx and javaSignalHandler out of this patch completely. I have to change those functions since the point of my patch is signal handler unification. In turn, I will keep my hands off any other code in signals_posix.xxx to decrease chances of conflict with this patch. |
Oh, and yes, I preserve the JVM_handle_xxx_signal entries in my patch, but they are thin wrappers around an internal, posix-specific handler function. |
@gerard-ziemski this pull request can not be integrated into git checkout JDK-8253742
git fetch https://git.openjdk.java.net/jdk master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push |
so in the end |
Mailing list message from David Holmes on hotspot-dev: On 13/11/2020 6:16 am, Gerard Ziemski wrote:
Yes but we don't like to rely on extreme levels of indirection as they In all seriousness I would just leave the existing includes alone. If it Thanks, |
@gerard-ziemski 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 123 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 |
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.
Hi Gerard,
we are getting closer :)
Cheers, Thomas
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.
I'm seeing unexpected changes relating to os::fetch_compiled_frame_from_context seemingly due to the "Merge from master".
Otherwise the actual described changes since last commit seem fine.
Once Thomas's last couple of comments are addressed this is done.
Thanks,
David
The |
Thank you Thomas and David for your reviews. |
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.
Hi Gerard,
some final nits.
I'll run the change through our system tonight to see if this broke one of our platforms.
Cheers, Thomas
@@ -1721,7 +1718,7 @@ void os::SuspendedThreadTask::internal_do_task() { | |||
int PosixSignals::init() { | |||
// initialize suspend/resume support - must do this before signal_sets_init() | |||
if (SR_initialize() != 0) { | |||
perror("SR_initialize failed"); | |||
vm_exit_during_initialization("SR_initialize failed"); |
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.
You've lost the failure reason (errno) that perror would have provided. SR_initalize only returns non-zero if sigaction fails, which leaves errno set - hence perror() would report it. That said there are only two errors for sigaction (EFAULT or EINVAL) so we really haven't lost anything that useful.
Arguably the vm_exit... should be inside SR_initialize.
But I'm fine with this as-is so we can conclude this PR.
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.
Yes, but this relies on knowing the internal implementation of SR_initialize() (mainly that the last CRT call there was sigaction) and is different from all the other places where we do CRT calls. I'd rather add logging right there if the call fails like we do in other places.
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.
AIX build went through, tests are fine so far. Looks good now. Ship it!
/integrate |
@gerard-ziemski Since your change was applied there have been 136 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 50a2c22. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Thank you David and Thomas for your reviews! |
hi all,
Please review this followup to JDK-8252324 Signal related code should be shared among POSIX platforms, where several issues were identified for a cleanup. This change addresses them all:
#1 David's feedback - removed non POSIX SIGNIFICANT_SIGNAL_MASK code
#2 David's feedback - used unblock_program_error_signals() on all platforms (reverted for JDK-8252533)
#3 David's feedback - used single JVM_handle_posix_signal API for all POSIX platforms (reverted for JDK-8255711)
#4 Coleen's feedback - cleanup header files in src/hotspot/os/posix/signals_posix.hpp
#5 Coleen's feedback - hid SR_signum assignment in src/hotspot/os/posix/signals_posix.hpp to avoid having to include <signal.h>
#6 Coleen's feedback - factored out print_signal_handlers()
#7 Thomas' feedback - factored out common POSIX os::SuspendedThreadTask::internal_do_task()
#8 Thomas's feedback - factored out common POSIX signal initialization code
#9 YaSuenag's feedback - used JVM_handle_posix_signal for the common API
#10 YaSuenag's feedback - unified logging out of the scope for this fix
#11 YaSuenag's feedback - memset usage in PosixSignals::jdk_misc_signal_init() correct?
Progress
Testing
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/636/head:pull/636
$ git checkout pull/636