Skip to content

Make emscripten_check_blocking_allowed() no-op in release builds #18871

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

Merged
merged 3 commits into from
Mar 7, 2023

Conversation

kleisauke
Copy link
Collaborator

This warning should only be raised when linking with -sASSERTIONS or -sALLOW_BLOCKING_ON_MAIN_THREAD=0, where the latter setting would treat this warning with a higher severity (i.e., causing the program to abort when the main thread is blocked).

Previously, this warning was always raised on web environments when not linking with -sMINIMAL_RUNTIME.

Resolves: #18855.

This warning should only be raised when linking with `-sASSERTIONS`
or `-sALLOW_BLOCKING_ON_MAIN_THREAD=0`, where the latter setting
would treat this warning with a higher severity (i.e., causing the
program to abort when the main thread is blocked).

Previously, this warning was always raised on web environments when
not linking with `-sMINIMAL_RUNTIME`.

Resolves: emscripten-core#18855.
@sbc100
Copy link
Collaborator

sbc100 commented Feb 28, 2023

We might want to dig a little into why this was deliberately done in #9579

@sbc100
Copy link
Collaborator

sbc100 commented Feb 28, 2023

We might want to dig a little into why this was deliberately done in #9579

Actually it looks like it the warn was originally only meant to show when ASSERTIONS were enabled, but this regressed in #10123

@@ -3809,14 +3809,23 @@ def test_pthread_main_thread_blocking(self, name):
print('Test that we error if not ALLOW_BLOCKING_ON_MAIN_THREAD')
self.btest(test_file('pthread/main_thread_%s.cpp' % name), expected='abort:Blocking on the main thread is not allowed by default.', args=['-O3', '-sUSE_PTHREADS', '-sPTHREAD_POOL_SIZE', '-sALLOW_BLOCKING_ON_MAIN_THREAD=0'])
if name == 'join':
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rest of this function seems like it should maybe be split into a separate test?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -3809,14 +3809,23 @@ def test_pthread_main_thread_blocking(self, name):
print('Test that we error if not ALLOW_BLOCKING_ON_MAIN_THREAD')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove this print statement, or turn it into docstring?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kripken
Copy link
Member

kripken commented Mar 6, 2023

This lgtm - @sbc100 did you have further comments? Looks like your previous ones were addressed.

@kripken
Copy link
Member

kripken commented Mar 6, 2023

(Merging in latest main may help with the tests.)

@kripken kripken merged commit 1291dac into emscripten-core:main Mar 7, 2023
@kleisauke kleisauke deleted the allow-block-release branch March 8, 2023 10:24
impact-maker pushed a commit to impact-maker/emscripten that referenced this pull request Mar 17, 2023
…mscripten-core#18871)

This warning should only be raised when linking with `-sASSERTIONS`
or `-sALLOW_BLOCKING_ON_MAIN_THREAD=0`, where the latter setting
would treat this warning with a higher severity (i.e., causing the
program to abort when the main thread is blocked).

Previously, this warning was always raised on web environments when
not linking with `-sMINIMAL_RUNTIME`.

Resolves: emscripten-core#18855.
impact-maker pushed a commit to impact-maker/emscripten that referenced this pull request Mar 17, 2023
…mscripten-core#18871)

This warning should only be raised when linking with `-sASSERTIONS`
or `-sALLOW_BLOCKING_ON_MAIN_THREAD=0`, where the latter setting
would treat this warning with a higher severity (i.e., causing the
program to abort when the main thread is blocked).

Previously, this warning was always raised on web environments when
not linking with `-sMINIMAL_RUNTIME`.

Resolves: emscripten-core#18855.
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

Successfully merging this pull request may close these issues.

"Blocking on the main thread is very dangerous...." show up despite of setting ALLOW_BLOCKING_ON_MAIN_THREAD=1
3 participants