Memprof: fatal error if thread is stopped from a callback.#9458
Memprof: fatal error if thread is stopped from a callback.#9458stedolan merged 3 commits intoocaml:trunkfrom
Conversation
gadmm
left a comment
There was a problem hiding this comment.
Thanks for the new flag. Continuing the discussion about fatal_error below. Also, would it be better to move the doc about Thread.exit from gc.mli to the Thread module, and update it accordingly?
c966b58 to
fcc4172
Compare
|
CI is failing, but there does not seem to be n error message, and I cannot reproduce the issue on my machine. |
|
Ah, I found the issue: a new global variable was neither static nor prefixed by |
fcc4172 to
c2fb368
Compare
|
Could someone review this PR? It is simple, and I would like it to be cherry-picked to 4.11, since it fixes a potential segfault! |
|
Of course, the usual suspects are @gasche , @stedolan and @xavierleroy . Thanks to them! |
|
The code looks good to me, but if it's important enough to fix then it should have a testcase! Is there anything tricky about writing one? |
This is specified as undefined behavior in gc.mli. We now use dedicated functions for the interraction between Memprof and systhreads.
c2fb368 to
629fae6
Compare
|
I finally wrote a test. This was not completely trivial since ocamltest does not support checking for fatal errors. |
|
@stedolan : I (finally) wrote a test case. Do you think this is ready to merge? |
Yes! Thanks. |
|
Thanks, @stedolan! Could you please cherry-pick on 4.11? |
|
@stedolan : Up ! |
|
I will do the cherry picking. |
Memprof: fatal error if thread is stopped from a callback. (cherry picked from commit ff6ae43)
|
Done: 7eb55d6. |
|
Missed this! Thanks @gasche |
This is specified as undefined behavior in gc.mli.
These are the two first commits of #9449. They do not deserve a Changes entry.
I don't think we need a test for this either.
I addressed @gadmm's concern:
Two different flags are now used for that purpose.
I would like this to be merged in 4.11. But this can be considered as a bugfix, since it protects against potential segfaults if
Thread.exitis called from a callback.