Skip to content
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

Remaining issues in the OCaml 5 systhread implementation #12399

Open
5 tasks
gadmm opened this issue Jul 20, 2023 · 2 comments
Open
5 tasks

Remaining issues in the OCaml 5 systhread implementation #12399

gadmm opened this issue Jul 20, 2023 · 2 comments

Comments

@gadmm
Copy link
Contributor

gadmm commented Jul 20, 2023

The new systhreads implementation now contains 4 FIXMEs/TODOs in systhreads/st_stubs.c.

  • /* Cleanup the thread machinery when the runtime is shut down. Joining the tick thread take 25ms on average / 50ms in the worst case, so we don't do it on program exit. (FIXME: not implemented in OCaml 5 yet) */ Note: the safe solution for multicore is likely more involved, one idea is to use condition variables with timedwait.
  • caml_thread_domain_initialize_hook: /* FIXME: this should return an encoded exception for use in domain_thread_func, but the latter is not ready to handle it yet. */ (related: possible memory-leak on failed domain backup thread installation #12269)
  • caml_thread_reinitialize (best-effort fork with multiple threads): /* FIXME: The same should be done (or not) for IO mutexes (as in the pre-multicore world). However there they might be locked by someone else, and we are probably in an inconsistent state. */
  • Unclear initialization of domain variables related to exception handling in bytecode inside caml_thread_new_info. Ideally, one should find a way to factor caml_thread_new_info and domain_create regarding the initialization of relevant domain variables. See the discussion starting here: Refactor caml_c_thread_(un)register to fix various bugs #12834 (comment)
  • C threads registered as systhread do not behave as expected in case of an uncaught exception. If an exception is uncaught, caml_fatal_uncaught_exception is called and the program stops. This is in contrast with regular systhreads: in case of an uncaught exception, the thread stops and an error is output on stderr, and Thread.set_uncaught_exception_handler is obeyed. (Reported here: Refactor caml_c_thread_(un)register to fix various bugs #12834 (comment))
@gadmm
Copy link
Contributor Author

gadmm commented Jul 22, 2023

The second one is now treated in a series of commits (#12409, #12410). I would prefer to let other people deal with the other issues and I am unsubscribing from this issue, notably to avoid being pinged by the stale bot in case nothing is done (just so you know in case you need to ping me).

@gadmm
Copy link
Contributor Author

gadmm commented Mar 15, 2024

Added the bug reported as a comment here: #12834 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant