-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[openmp] Segfaults/assertion errors on certain omp statements after calling omp_pause_resource_all(omp_pause_hard)
#154204
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
base: main
Are you sure you want to change the base?
Changes from 6 commits
df4b0ec
a08175c
bf74a39
773ab2f
3e875f5
86aedd5
532ac49
258e329
4002bb7
2888a73
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3431,6 +3431,9 @@ void __kmp_cleanup_indirect_user_locks() { | |
ll)); | ||
__kmp_free(ll->lock); | ||
ll->lock = NULL; | ||
// reset the reverse critical section pointer to 0 | ||
if (ll->rev_ptr_critSec && LIKELY(!__kmp_in_atexit)) | ||
|
||
memset(ll->rev_ptr_critSec, 0, sizeof(kmp_critical_name)); | ||
} | ||
__kmp_indirect_lock_pool[k] = NULL; | ||
} | ||
|
@@ -3449,6 +3452,9 @@ void __kmp_cleanup_indirect_user_locks() { | |
"from table\n", | ||
l)); | ||
__kmp_free(l->lock); | ||
// reset the reverse critical section pointer to 0 | ||
if (l->rev_ptr_critSec && LIKELY(!__kmp_in_atexit)) | ||
memset(l->rev_ptr_critSec, 0, sizeof(kmp_critical_name)); | ||
} | ||
} | ||
__kmp_free(ptr->table[row]); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6139,6 +6139,7 @@ void __kmp_internal_end_atexit(void) { | |
Windows dynamic, there is DllMain(THREAD_DETACH). For Windows static, there | ||
is nothing. Thus, the workaround is applicable only for Windows static | ||
stat library. */ | ||
__kmp_in_atexit = TRUE; | ||
__kmp_internal_end_library(-1); | ||
#if KMP_OS_WINDOWS | ||
__kmp_close_console(); | ||
|
@@ -6952,9 +6953,9 @@ void __kmp_unregister_library(void) { | |
value = __kmp_env_get(name); | ||
#endif | ||
|
||
KMP_DEBUG_ASSERT(__kmp_registration_flag != 0); | ||
KMP_DEBUG_ASSERT(__kmp_registration_str != NULL); | ||
if (value != NULL && strcmp(value, __kmp_registration_str) == 0) { | ||
// if omp is not initialized and we exit, then we don't need to free anything | ||
if (__kmp_registration_flag != 0 && __kmp_registration_str != NULL) { | ||
if (value != NULL && strcmp(value, __kmp_registration_str) == 0) { | ||
// Ok, this is our variable. Delete it. | ||
#if defined(KMP_USE_SHM) | ||
if (__kmp_shm_available) { | ||
|
@@ -6967,16 +6968,17 @@ void __kmp_unregister_library(void) { | |
#else | ||
__kmp_env_unset(name); | ||
#endif | ||
} | ||
} | ||
|
||
#if defined(KMP_USE_SHM) | ||
if (shm_name) | ||
KMP_INTERNAL_FREE(shm_name); | ||
if (temp_reg_status_file_name) | ||
KMP_INTERNAL_FREE(temp_reg_status_file_name); | ||
#endif | ||
|
||
KMP_INTERNAL_FREE(__kmp_registration_str); | ||
} | ||
|
||
KMP_INTERNAL_FREE(value); | ||
KMP_INTERNAL_FREE(name); | ||
|
||
|
@@ -8343,6 +8345,10 @@ void __kmp_cleanup(void) { | |
|
||
__kmpc_destroy_allocator(KMP_GTID_SHUTDOWN, __kmp_def_allocator); | ||
__kmp_def_allocator = omp_default_mem_alloc; | ||
#ifdef KMP_TDATA_GTID | ||
/*reset __kmp_gtid to initial value*/ | ||
__kmp_gtid = KMP_GTID_DNE; | ||
#endif | ||
|
||
|
||
KA_TRACE(10, ("__kmp_cleanup: exit\n")); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1404,13 +1404,15 @@ static void __kmp_atfork_child(void) { | |
} | ||
|
||
void __kmp_register_atfork(void) { | ||
if (__kmp_need_register_atfork) { | ||
// NOTE: we will not double register our fork handlers! It will cause deadlock | ||
if (!__kmp_already_registered_atfork && __kmp_need_register_atfork) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this change related to the pause_resource_all issue? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Technically yes, because if you see the test function There might be a cleaner way to prevent double atfork registration than adding another flag (I thought I can re-use the variable |
||
#if !KMP_OS_WASI | ||
int status = pthread_atfork(__kmp_atfork_prepare, __kmp_atfork_parent, | ||
__kmp_atfork_child); | ||
KMP_CHECK_SYSFAIL("pthread_atfork", status); | ||
#endif | ||
__kmp_need_register_atfork = FALSE; | ||
__kmp_already_registered_atfork = TRUE; | ||
} | ||
} | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.