Ensure signals are handled before Unix.kill returns#9802
Ensure signals are handled before Unix.kill returns#9802stedolan merged 1 commit intoocaml:trunkfrom
Conversation
b5d00c7 to
8e595b9
Compare
jhjourdan
left a comment
There was a problem hiding this comment.
The change is trivial, looks good to me.
|
Searching through the standard, I see that POSIX makes the same stipulation about the other kills that can cause a signal to become pending (sigprocmask, pthread_sigmask), so I'll fix those too. |
|
@jhjourdan it turns out that your test from #9027 (tests/callback/signals_alloc.ml) is explicitly testing that |
8e595b9 to
02c686d
Compare
|
I've updated the tests to avoid assuming this behaviour of kill, and added a test for sigprocmask. (This test passes with no code change due to a poll in caml_leave_blocking_section, but I want the test there before #9722 is merged) |
Yes, it is. The point of this test is to check that allocations do indeed poll, so polling should not occur in when raising the signal. Perhaps you could use the same strategy as in the other test? |
02c686d to
ee4f765
Compare
Done. |
a9691cb to
4c4629d
Compare
4c4629d to
ca34559
Compare
|
This PR has broken the INRIA CI:
The error (visible in the above logs) is
|
|
That is weird. I'm running a precheck build with a more verbose version of the test to see if I can see what's going on. |
|
Possible fix in #9814 |
POSIX does not make very many guarantees about when signals are handled, but one guarantee that it does make is that if a process sends itself a signal (using e.g.
kill(getpid(), ...)), then signals will be handled beforekillreturns.This is currently not true of OCaml's
Unix.kill, this patch makes it so.(This came up during testing of #9722, but is a separate issue)