-
Notifications
You must be signed in to change notification settings - Fork 406
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
Enable GC_set_handle_fork(1) for Darwin with GC_incremental on #103
Comments
Issue #103 (bdwgc). Remove mutual exclusion between fork handling and GC incremental mode on Darwin in a multi-threaded configuration. Note: the incremental mode is turned off in the child process after fork, for now. * CMakeLists.txt [enable_threads && CMAKE_USE_PTHREADS_INIT && !WIN32 && enable_handle_fork && !disable_handle_fork] (HANDLE_FORK): Define C macro even if APPLE; remove comment. * configure.ac [$enable_handle_fork!=yes && $enable_handle_fork!=no && $enable_handle_fork!=manual && $THREADS==posix && $host==*-*-darwin*] (HANDLE_FORK): Define AC macro; remove comment. * tests/gctest.c [DARWIN && MPROTECT_VDB && !MAKE_BACK_GRAPH && !TEST_HANDLE_FORK && !NO_TEST_HANDLE_FORK] (NO_TEST_HANDLE_FORK): Do not define if THREADS. * include/private/gc_priv.h [CAN_HANDLE_FORK && MPROTECT_VDB && GC_DARWIN_THREADS] (GC_dirty_update_child): Declare as function (instead of a no-op macro). * pthread_support.c [CAN_HANDLE_FORK && !GC_DISABLE_INCREMENTAL] (fork_child_proc): Move GC_dirty_update_child() call upper to be right after GC_release_dirty_lock() one. * pthread_support.c [CAN_HANDLE_FORK && GC_DARWIN_THREADS && MPROTECT_VDB] (GC_atfork_prepare): Remove assertion (about GC_handle_fork) and abort. * os_dep.c [DARWIN && MPROTECT_VDB && CAN_HANDLE_FORK && THREADS] (GC_dirty_update_child): Implement (unprotect the entire heap, restore the old task exception ports and turn off the incremental mode). * os_dep.c [DARWIN && MPROTECT_VDB && THREADS] (GC_mprotect_thread): Reformat code. * os_dep.c [DARWIN && MPROTECT_VDB && CAN_HANDLE_FORK] (GC_dirty_init): Do not WARN and return FALSE if THREADS and GC_handle_fork; add assertion that me variable is non-zero. * os_dep.c [DARWIN && MPROTECT_VDB] (GC_forward_exception): Cast 1 to exception_mask_t before left-shift by exception; reformat code.
@ivmai this seems like significant improvement for macOS at ECL usage. Without it I can reproduce random failure like this:
Any plan to release the new version with this changes? I've used 98b5d38 as local root for my tests. |
Anyway, it doesn't fix #569 |
Yes, that's a different issue. |
and doesn't fix sharplispers/ironclad#63 which is expected |
Is there an issue here? |
By some unknown reason when ECL uses clang it leads to random result of hashing, and switching to GCC fixes it. |
I understand.
It's planned at the end of Feb. v8.4.0 |
Do you think I can backport only ba2861e into last relesead version to increase stability ECL at MacPorts? Is it enough? |
Initially I though of it as a feature (to enable automatic fork handling by default), but now I see it serves as a fix... Let me check the complexity of backporting to the stable branch. |
(a cherry-pick of commit ba2861e from 'master') Issue #103 (bdwgc). Remove mutual exclusion between fork handling and GC incremental mode on Darwin in a multi-threaded configuration. Note: the incremental mode is turned off in the child process after fork, for now. * CMakeLists.txt [CMAKE_USE_PTHREADS_INIT && !WIN32 && enable_handle_fork && !disable_handle_fork] (HANDLE_FORK): Define C macro even if APPLE; remove comment. * configure.ac [$enable_handle_fork!=yes && $enable_handle_fork!=no && $enable_handle_fork!=manual && $THREADS==posix && $host==*-*-darwin*] (HANDLE_FORK): Define AC macro; remove comment. * tests/test.c [DARWIN && MPROTECT_VDB && !MAKE_BACK_GRAPH && !TEST_HANDLE_FORK && !NO_TEST_HANDLE_FORK] (NO_TEST_HANDLE_FORK): Do not define if THREADS. * include/private/gc_priv.h [CAN_HANDLE_FORK && MPROTECT_VDB && GC_DARWIN_THREADS] (GC_dirty_update_child): Declare as function (instead of a no-op macro). * pthread_support.c [CAN_HANDLE_FORK && !GC_DISABLE_INCREMENTAL] (fork_child_proc): Move GC_dirty_update_child() call upper to be right after GC_release_dirty_lock() one. * pthread_support.c [CAN_HANDLE_FORK && GC_DARWIN_THREADS && MPROTECT_VDB] (GC_atfork_prepare): Remove assertion (about GC_handle_fork) and abort. * os_dep.c [DARWIN && MPROTECT_VDB && CAN_HANDLE_FORK && THREADS] (GC_dirty_update_child): Implement (unprotect the entire heap, restore the old task exception ports and turn off the incremental mode). * os_dep.c [DARWIN && MPROTECT_VDB && THREADS] (GC_mprotect_thread): Reformat code. * os_dep.c [DARWIN && MPROTECT_VDB && CAN_HANDLE_FORK] (GC_dirty_init): Do not WARN and return FALSE if THREADS and GC_handle_fork; add assertion that me variable is non-zero. * os_dep.c [DARWIN && MPROTECT_VDB] (GC_forward_exception): Cast 1 to exception_mask_t before left-shift by exception; reformat code.
Backported, please test branch release-8_2. |
Confirmed with GitHub CI. Fails with v8.2.4 and works with stable from da06919 |
Can you make 8.2.5 release with this huge improvement for macOS? |
v8.2.6. I will think of. |
why v8.2.6? I haven't see v8.2.5 here https://github.com/ivmai/bdwgc/tags |
All micro numbers are even ;) just a convention. |
I want to fix another ancient bug on macOS before the release - issue #178 |
Fair enough. |
Released: https://github.com/ivmai/bdwgc/releases/tag/v8.2.6 |
Both single- and multi-threaded modes should be handled.
The text was updated successfully, but these errors were encountered: