-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Avoid requiring EXIT_RUNTIME when running threaded programs under node #22445
Open
sbc100
wants to merge
1
commit into
emscripten-core:main
Choose a base branch
from
sbc100:pthread_exit_handling
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1509 | ||
1568 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
3148 | ||
3266 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
5017 | ||
5044 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
10831 | ||
10866 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
54763 | ||
54738 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
30597 | ||
30598 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
53628 | ||
53603 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -388,7 +388,6 @@ def test_hello_argc(self): | |
@node_pthreads | ||
def test_hello_argc_pthreads(self): | ||
self.set_setting('PROXY_TO_PTHREAD') | ||
self.set_setting('EXIT_RUNTIME') | ||
self.do_core_test('test_hello_argc.c', args=['hello', 'world']) | ||
|
||
@only_wasm2js('test shifts etc. on 64-bit integers') | ||
|
@@ -1300,7 +1299,8 @@ def test_exceptions_uncaught_2(self): | |
def test_exceptions_typed(self): | ||
# Depends on static destructors running | ||
self.set_setting('EXIT_RUNTIME') | ||
self.clear_setting('SAFE_HEAP') # Throwing null will cause an ignorable null pointer access. | ||
if self.get_setting('SAFE_HEAP'): | ||
self.skipTest('Throwing null will cause an ignorable null pointer access') | ||
self.do_core_test('test_exceptions_typed.cpp') | ||
|
||
@with_all_eh_sjlj | ||
|
@@ -1318,7 +1318,8 @@ def test_exceptions_multi(self): | |
|
||
@with_all_eh_sjlj | ||
def test_exceptions_std(self): | ||
self.clear_setting('SAFE_HEAP') | ||
if self.get_setting('SAFE_HEAP'): | ||
self.skipTest('Fails under SAFE_HEAP') | ||
self.do_core_test('test_exceptions_std.cpp') | ||
|
||
@with_all_eh_sjlj | ||
|
@@ -1871,7 +1872,7 @@ def test_em_asm_2(self): | |
# they will also get tested in MAIN_THREAD_EM_ASM form. | ||
@parameterized({ | ||
'': ([],), | ||
'pthread': (['-pthread', '-sPROXY_TO_PTHREAD', '-sEXIT_RUNTIME'],), | ||
'pthread': (['-pthread', '-sPROXY_TO_PTHREAD'],), | ||
}) | ||
def test_main_thread_em_asm(self, args): | ||
if args: | ||
|
@@ -1933,8 +1934,8 @@ def test_em_asm_side_module(self): | |
|
||
@parameterized({ | ||
'': ([], False), | ||
'pthreads': (['-pthread', '-sPROXY_TO_PTHREAD', '-sEXIT_RUNTIME'], False), | ||
'pthreads_dylink': (['-pthread', '-sPROXY_TO_PTHREAD', '-sEXIT_RUNTIME', '-sMAIN_MODULE=2', '-Wno-experimental'], False), | ||
'pthreads': (['-pthread', '-sPROXY_TO_PTHREAD'], False), | ||
'pthreads_dylink': (['-pthread', '-sPROXY_TO_PTHREAD', '-sMAIN_MODULE=2', '-Wno-experimental'], False), | ||
'c': ([], True), | ||
'dylink': (['-sMAIN_MODULE=2'], False), | ||
'dylink_c': (['-sMAIN_MODULE=2'], True), | ||
|
@@ -2500,7 +2501,6 @@ def test_pthread_proxying_canceled_work(self): | |
@node_pthreads | ||
@flaky('https://github.com/emscripten-core/emscripten/issues/19795') | ||
def test_pthread_proxying_refcount(self): | ||
self.set_setting('EXIT_RUNTIME') | ||
self.set_setting('PTHREAD_POOL_SIZE=1') | ||
self.set_setting('ASSERTIONS=0') | ||
self.do_run_in_out_file_test('pthread/test_pthread_proxying_refcount.c') | ||
|
@@ -2524,7 +2524,6 @@ def test_pthread_nested_work_queue(self): | |
@node_pthreads | ||
def test_pthread_thread_local_storage(self): | ||
self.set_setting('PROXY_TO_PTHREAD') | ||
self.set_setting('EXIT_RUNTIME') | ||
if not self.has_changed_setting('INITIAL_MEMORY'): | ||
self.set_setting('INITIAL_MEMORY', '300mb') | ||
self.do_run_in_out_file_test('pthread/test_pthread_thread_local_storage.cpp') | ||
|
@@ -2574,7 +2573,6 @@ def test_pthread_abort_interrupt(self): | |
def test_pthread_emmalloc(self): | ||
self.emcc_args += ['-fno-builtin'] | ||
self.set_setting('PROXY_TO_PTHREAD') | ||
self.set_setting('EXIT_RUNTIME') | ||
self.set_setting('ASSERTIONS', 2) | ||
self.set_setting('MALLOC', 'emmalloc') | ||
self.do_core_test('test_emmalloc.c') | ||
|
@@ -2589,7 +2587,6 @@ def test_pthread_stdout_after_main(self): | |
@node_pthreads | ||
def test_pthread_proxy_to_pthread(self): | ||
self.set_setting('PROXY_TO_PTHREAD') | ||
self.set_setting('EXIT_RUNTIME') | ||
self.do_run_in_out_file_test('pthread/test_pthread_proxy_to_pthread.c') | ||
|
||
@node_pthreads | ||
|
@@ -2606,7 +2603,6 @@ def test_pthread_run_script(self): | |
# Run the test again with PROXY_TO_PTHREAD | ||
self.setup_node_pthreads() | ||
self.set_setting('PROXY_TO_PTHREAD') | ||
self.set_setting('EXIT_RUNTIME') | ||
self.do_runf('pthread/test_pthread_run_script.c') | ||
|
||
@node_pthreads | ||
|
@@ -2903,7 +2899,7 @@ def test_dlfcn_missing(self): | |
@needs_dylink | ||
@parameterized({ | ||
'': ([],), | ||
'pthreads': (['-pthread', '-sEXIT_RUNTIME', '-sPROXY_TO_PTHREAD', '-Wno-experimental'],), | ||
'pthreads': (['-pthread', '-sPROXY_TO_PTHREAD', '-Wno-experimental'],), | ||
}) | ||
def test_dlfcn_basic(self, args): | ||
if args: | ||
|
@@ -6471,7 +6467,6 @@ def test_mmap_anon_pthreads(self): | |
# Same test with threading enabled so give is some basic sanity | ||
# checks of the locking on the internal data structures. | ||
self.set_setting('PROXY_TO_PTHREAD') | ||
self.set_setting('EXIT_RUNTIME') | ||
if not self.has_changed_setting('INITIAL_MEMORY'): | ||
self.set_setting('INITIAL_MEMORY', '64mb') | ||
self.do_core_test('test_mmap_anon.c') | ||
|
@@ -7364,7 +7359,7 @@ def test_embind_2(self): | |
self.emcc_args += [ | ||
'-lembind', '--post-js', 'post.js', | ||
# for extra coverage, test using pthreads | ||
'-pthread', '-sPROXY_TO_PTHREAD', '-sEXIT_RUNTIME' | ||
'-pthread', '-sPROXY_TO_PTHREAD' | ||
] | ||
create_file('post.js', ''' | ||
function printLerp() { | ||
|
@@ -8314,7 +8309,6 @@ def test_pthread_join_and_asyncify(self): | |
self.require_jspi() | ||
self.do_runf('core/test_pthread_join_and_asyncify.c', 'joining thread!\njoined thread!', | ||
emcc_args=['-sJSPI_EXPORTS=run_thread', | ||
'-sEXIT_RUNTIME=1', | ||
'-pthread', '-sPROXY_TO_PTHREAD']) | ||
|
||
@no_asan('asyncify stack operations confuse asan') | ||
|
@@ -9109,7 +9103,7 @@ def test_pthread_create(self): | |
@parameterized({ | ||
'': ([],), | ||
'pooled': (['-sPTHREAD_POOL_SIZE=1'],), | ||
'proxied': (['-sPROXY_TO_PTHREAD', '-sEXIT_RUNTIME'],), | ||
'proxied': (['-sPROXY_TO_PTHREAD'],), | ||
}) | ||
def test_pthread_c11_threads(self, args): | ||
self.emcc_args += args | ||
|
@@ -9155,7 +9149,6 @@ def test_pthread_create_pool(self): | |
def test_pthread_create_proxy(self): | ||
# with PROXY_TO_PTHREAD, we can synchronously depend on workers being available | ||
self.set_setting('PROXY_TO_PTHREAD') | ||
self.set_setting('EXIT_RUNTIME') | ||
self.emcc_args += ['-DALLOW_SYNC'] | ||
self.do_run_in_out_file_test('core/pthread/create.c') | ||
|
||
|
@@ -9206,7 +9199,6 @@ def test_pthread_unhandledrejection(self): | |
@no_wasm2js('wasm2js does not support PROXY_TO_PTHREAD (custom section support)') | ||
def test_pthread_offset_converter(self): | ||
self.set_setting('PROXY_TO_PTHREAD') | ||
self.set_setting('EXIT_RUNTIME') | ||
self.set_setting('USE_OFFSET_CONVERTER') | ||
if '-g' in self.emcc_args: | ||
self.emcc_args += ['-DDEBUG'] | ||
|
@@ -9216,7 +9208,6 @@ def test_pthread_offset_converter(self): | |
@no_wasm2js('wasm2js does not support PROXY_TO_PTHREAD (custom section support)') | ||
def test_pthread_offset_converter_modularize(self): | ||
self.set_setting('PROXY_TO_PTHREAD') | ||
self.set_setting('EXIT_RUNTIME') | ||
self.set_setting('USE_OFFSET_CONVERTER') | ||
self.set_setting('MODULARIZE') | ||
self.set_setting('EXPORT_NAME', 'foo') | ||
|
@@ -9250,7 +9241,6 @@ def test_stdio_locking(self): | |
def test_pthread_dylink_basics(self): | ||
self.emcc_args.append('-Wno-experimental') | ||
self.set_setting('PROXY_TO_PTHREAD') | ||
self.set_setting('EXIT_RUNTIME') | ||
self.do_basic_dylink_test() | ||
|
||
@needs_dylink | ||
|
@@ -9293,6 +9283,7 @@ def test_pthread_dlopen(self): | |
|
||
self.emcc_args += ['--embed-file', '[email protected]'] | ||
self.prep_dlfcn_main() | ||
# Test depends on atexit() | ||
self.set_setting('EXIT_RUNTIME') | ||
self.set_setting('PROXY_TO_PTHREAD') | ||
self.do_runf('core/pthread/test_pthread_dlopen.c', | ||
|
@@ -9312,6 +9303,7 @@ def test_pthread_dlopen_many(self): | |
shutil.copyfile('liblib.so', f'liblib{i}.so') | ||
|
||
self.prep_dlfcn_main() | ||
# Test depends on atexit() | ||
self.set_setting('EXIT_RUNTIME') | ||
self.set_setting('PROXY_TO_PTHREAD') | ||
self.set_setting('DEFAULT_LIBRARY_FUNCS_TO_INCLUDE', 'jslib_func') | ||
|
@@ -9334,7 +9326,6 @@ def test_pthread_dlsym(self): | |
self.build_dlfcn_lib(test_file('core/pthread/test_pthread_dlsym_side.c')) | ||
|
||
self.prep_dlfcn_main() | ||
self.set_setting('EXIT_RUNTIME') | ||
self.set_setting('PROXY_TO_PTHREAD') | ||
self.do_runf('core/pthread/test_pthread_dlsym.c') | ||
|
||
|
@@ -9361,7 +9352,7 @@ def test_pthread_dylink_main_module_1(self): | |
|
||
@parameterized({ | ||
'': ([],), | ||
'pthreads': (['-sPROXY_TO_PTHREAD', '-sEXIT_RUNTIME', '-pthread', '-Wno-experimental'],) | ||
'pthreads': (['-sPROXY_TO_PTHREAD', '-pthread', '-Wno-experimental'],) | ||
}) | ||
@with_dylink_reversed | ||
def test_Module_dynamicLibraries(self, args): | ||
|
@@ -9514,7 +9505,6 @@ def test_abort_on_exceptions_main(self): | |
def test_abort_on_exceptions_pthreads(self): | ||
self.set_setting('ABORT_ON_WASM_EXCEPTIONS') | ||
self.set_setting('PROXY_TO_PTHREAD') | ||
self.set_setting('EXIT_RUNTIME') | ||
self.do_core_test('test_hello_world.c') | ||
|
||
@needs_dylink | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this possible now? Maybe add a comment?