Revert "n-api: detect deadlocks in thread-safe function"#33453
Revert "n-api: detect deadlocks in thread-safe function"#33453addaleax wants to merge 4 commits intonodejs:masterfrom
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
gabrielschulhof
left a comment
There was a problem hiding this comment.
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.
gabrielschulhof
left a comment
There was a problem hiding this comment.
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 <gabrielschulhof@gmail.com>
gabrielschulhof
left a comment
There was a problem hiding this comment.
@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 <daniel.bevenius@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
|
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 <daniel.bevenius@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
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 <daniel.bevenius@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
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 <daniel.bevenius@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
This reverts commit d26ca06 because
it breaks running the tests in debug mode, as
v8::Isolate::GetCurrent()is not allowed if noIsolateis activeon the current thread.
Refs: #33276
Refs: #32860
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes