-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Profile: @profile
hanging on MacOS 12
#43578
Comments
If you Ctrl-C out of it, is the stacktrace helpful? |
I forgot to add,
no stack trace. It seems like the signal handler has silently stopped. Also, this doesn't happen on ubuntu |
@profile using Foo
hangs for non-sysimaged package@profile using Foo
hangs for non-sysimaged package on MacOS
Maybe this is a clue.. The following also hangs
But one time it didn't immediately and I got:
then it hung. Seems the thread is unknown |
This doesn't happen on MacOS 10 on 1.6 or 1.7 MacOS internals have changed quite a lot between 10 and 12. With @staticfloat's help, the paused MacOS 12 x86 machine was probed with lldb
A theory is that perhaps when libunwind calls But it seems odd that two threads are calling @vtjnash does anything jump out to you here? Starting with one thread doesn't fix it |
@profile using Foo
hangs for non-sysimaged package on MacOS@profile
hanging on MacOS 12
Could it be that we need to wrap |
I tried to give that a go but couldn't see how to do that given |
So yeah, this is a mwe
|
This comment has been minimized.
This comment has been minimized.
Seems to work #43629 |
It is a macOS bug introduced into dyld3 (specifically dyld-732.8 on Jan 31 2020). This however appears to be dyld4 now, but Apple has failed so far to provide source code for it https://github.com/apple-oss-distributions/dyld/. It is sad that there was a warning comment here in dyld2, but that failed to get copied into dyld3. |
We can work-around this in the same way that we used to work-around the buggy keymgr stuff, which Apple eventually deleted because of this exact problem. The only challenge will be making this still link on older systems (so we cannot uses the symbols directly as I did here, but need to make them weak imports). diff --git a/src/signals-mach.c b/src/signals-mach.c
index 57dcc96906..be6a8b67c4 100644
--- a/src/signals-mach.c
+++ b/src/signals-mach.c
@@ -31,6 +31,11 @@ extern void *_keymgr_get_and_lock_processwide_ptr(unsigned int key);
extern int _keymgr_get_and_lock_processwide_ptr_2(unsigned int key, void **result);
extern int _keymgr_set_lockmode_processwide_ptr(unsigned int key, unsigned int mode);
+// private dyld3/dyld4 stuff
+extern void _dyld_atfork_prepare(void);
+extern void _dyld_atfork_parent(void);
+//extern void _dyld_fork_child(void);
+
static void attach_exception_port(thread_port_t thread, int segv_only);
// low 16 bits are the thread id, the next 8 bits are the original gc_state
@@ -540,6 +545,7 @@ void *mach_profile_listener(void *arg)
jl_lock_profile();
void *unused = NULL;
int keymgr_locked = _keymgr_get_and_lock_processwide_ptr_2(KEYMGR_GCC3_DW2_OBJ_LIST, &unused) == 0;
+ _dyld_atfork_prepare();
jl_shuffle_int_array_inplace(profile_round_robin_thread_order, jl_n_threads, &profile_cong_rng_seed);
for (int idx = jl_n_threads; idx-- > 0; ) {
// Stop the threads in the random round-robin order.
@@ -609,6 +615,7 @@ void *mach_profile_listener(void *arg)
// We're done! Resume the thread.
jl_thread_resume(i, 0);
}
+ _dyld_atfork_parent();
if (keymgr_locked)
_keymgr_unlock_processwide_ptr(KEYMGR_GCC3_DW2_OBJ_LIST);
jl_unlock_profile(); |
Thanks @vtjnash is this something apple is aware of? How did you identify it? |
I don't think they are aware of it. I identified it because it is not the first time they have had this bug. |
Apple reintroduced the old bug that we previously worked around in fad04d3 with a similar patch to this. This is needed anywhere that we may attempt to stop threads. Fixes JuliaLang#43578
Apple reintroduced the old bug that we previously worked around in fad04d3 with a similar patch to this. This is needed anywhere that we may attempt to stop threads. Fixes JuliaLang#43578
Apple reintroduced the old bug that we previously worked around in fad04d3 with a similar patch to this. This is needed anywhere that we may attempt to stop threads. Fixes JuliaLang#43578
Apple reintroduced the old bug that we previously worked around in fad04d3 with a similar patch to this. This is needed anywhere that we may attempt to stop threads. Fixes JuliaLang#43578
Extend the fix for JuliaLang#43578 (2939272) to cover the deadlock bug present internally in dyld4 inside the function we use to avoid the previous deadlock issue. Fix JuliaLang#49733
Extend the fix for JuliaLang#43578 (2939272) to cover the deadlock bug present internally in dyld4 inside the function we use to avoid the previous deadlock issue. Fix JuliaLang#49733
Extend the fix for JuliaLang#43578 (2939272) to cover the deadlock bug present internally in dyld4 inside the function we use to avoid the previous deadlock issue. Fix JuliaLang#49733
Extend the fix for JuliaLang#43578 (2939272) to cover the deadlock bug present internally in dyld4 inside the function we use to avoid the previous deadlock issue. Fix JuliaLang#49733
Extend the fix for JuliaLang#43578 (2939272) to cover the deadlock bug present internally in dyld4 inside the function we use to avoid the previous deadlock issue. Fix JuliaLang#49733
Extend the fix for JuliaLang#43578 (2939272) to cover the deadlock bug present internally in dyld4 inside the function we use to avoid the previous deadlock issue. Fix JuliaLang#49733
Extend the fix for JuliaLang#43578 (2939272) to cover the deadlock bug present internally in dyld4 inside the function we use to avoid the previous deadlock issue. Fix JuliaLang#49733
Extend the fix for JuliaLang#43578 (2939272) to cover the deadlock bug present internally in dyld4 inside the function we use to avoid the previous deadlock issue. Fix JuliaLang#49733
Extend the fix for JuliaLang#43578 (2939272) to cover the deadlock bug present internally in dyld4 inside the function we use to avoid the previous deadlock issue. Fix JuliaLang#49733
Extend the fix for JuliaLang#43578 (2939272) to cover the deadlock bug present internally in dyld4 inside the function we use to avoid the previous deadlock issue. Fix JuliaLang#49733
Extend the fix for JuliaLang#43578 (2939272) to cover the deadlock bug present internally in dyld4 inside the function we use to avoid the previous deadlock issue. Fix JuliaLang#49733
Extend the fix for JuliaLang#43578 (2939272) to cover the deadlock bug present internally in dyld4 inside the function we use to avoid the previous deadlock issue. Fix JuliaLang#49733
Extend the fix for JuliaLang#43578 (2939272) to cover the deadlock bug present internally in dyld4 inside the function we use to avoid the previous deadlock issue. Fix JuliaLang#49733
Extend the fix for JuliaLang#43578 (2939272) to cover the deadlock bug present internally in dyld4 inside the function we use to avoid the previous deadlock issue. Fix JuliaLang#49733
Extend the fix for JuliaLang#43578 (2939272) to cover the deadlock bug present internally in dyld4 inside the function we use to avoid the previous deadlock issue. Fix JuliaLang#49733
On master and 1.6.4, on MacOS (other platforms not tested yet)
The text was updated successfully, but these errors were encountered: