-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Revert "n-api: detect deadlocks in thread-safe function" #33453
Conversation
This reverts commit d26ca06 because it breaks running the tests in debug mode, as `v8::Isolate::GetCurrent()` is not allowed if no `Isolate` is active on the current thread. Refs: nodejs#33276 Refs: nodejs#32860
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.
napi_would_deadlock
is part of at least 14.1.0, so IINM removing it would be semver-major. Shouldn't we instead think of a better way of detecting whether we are on a JS thread?
How can you detect whether you are on a JS thread or not without knowing a priori that you are on a JS thread? Is there a way of finding out whether an isolate is active on the current thread without calling |
@gabrielschulhof Hm right, we should probably leave the enum value in place. I’ll update the PR.
Yes. That hasn’t happened for 11 days since #33276 was opened, hence the revert PR now.
I wasn’t aware that |
@gabrielschulhof I’ve added the definition back to the header/the doc, PTAL (I’m assuming that your objection was about API/ABI compatibility and not the revert of the feature itself?) |
@addaleax I'm not too fond of the revert either, because I'm frustrated by the fact that we have no way of detecting that we are on a JS thread, but I understand the reason for it. I guess, with the enum value in place we have secured the option of eventually actually, possibly returning that value, once we've figured out how to properly detect that we are on a JS thread.
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.
If we replace the comments in the documentation instead of removing the entirely, we'll at least have some sort of fix for the original issue.
Co-authored-by: Gabriel Schulhof <[email protected]>
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.
@addaleax question before this lands: Can we use node::Environment::GetThreadLocalEnv()
to determine whether we are on a JS thread?
I mean, instead of |
@gabrielschulhof Currently yes, but we should get rid of that API, and it won’t work when an Ultimately, this is a programmer error and there are tools that help diagnose this kind of situation. If we can’t come up with a good solution that doesn’t yield false positives, we should let this be. |
@addaleax gotcha! Thanks for clarifying!
This reverts commit d26ca06 because it breaks running the tests in debug mode, as `v8::Isolate::GetCurrent()` is not allowed if no `Isolate` is active on the current thread. Refs: nodejs#33276 Refs: nodejs#32860 PR-URL: nodejs#33453 Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]>
Landed in b18d8dd |
This reverts commit d26ca06 because it breaks running the tests in debug mode, as `v8::Isolate::GetCurrent()` is not allowed if no `Isolate` is active on the current thread. Refs: #33276 Refs: #32860 PR-URL: #33453 Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]>
This reverts commit d26ca06 because it breaks running the tests in debug mode, as `v8::Isolate::GetCurrent()` is not allowed if no `Isolate` is active on the current thread. Refs: #33276 Refs: #32860 PR-URL: #33453 Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]>
This reverts commit d26ca06 because it breaks running the tests in debug mode, as `v8::Isolate::GetCurrent()` is not allowed if no `Isolate` is active on the current thread. Refs: #33276 Refs: #32860 PR-URL: #33453 Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]>
This reverts commit d26ca06 because
it breaks running the tests in debug mode, as
v8::Isolate::GetCurrent()
is not allowed if noIsolate
is activeon the current thread.
Refs: #33276
Refs: #32860
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes