Skip to content

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

Merged
kripken merged 3 commits into
emscripten-core:mainfrom
kleisauke:allow-block-release
Mar 7, 2023
Merged

Make emscripten_check_blocking_allowed() no-op in release builds#18871
kripken merged 3 commits into
emscripten-core:mainfrom
kleisauke:allow-block-release

Conversation

@kleisauke

Copy link
Copy Markdown
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

sbc100 commented Feb 28, 2023

Copy link
Copy Markdown
Collaborator

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

@sbc100

sbc100 commented Feb 28, 2023

Copy link
Copy Markdown
Collaborator

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

Comment thread test/test_browser.py Outdated
@@ -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
Copy Markdown
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
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Comment thread test/test_browser.py Outdated
@@ -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
Copy Markdown
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
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@kripken

kripken commented Mar 6, 2023

Copy link
Copy Markdown
Member

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

@kripken

kripken commented Mar 6, 2023

Copy link
Copy Markdown
Member

(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