node-api: execute tsfn finalizer after queue drains when aborted#61956
Open
KevinEady wants to merge 2 commits intonodejs:mainfrom
Open
node-api: execute tsfn finalizer after queue drains when aborted#61956KevinEady wants to merge 2 commits intonodejs:mainfrom
KevinEady wants to merge 2 commits intonodejs:mainfrom
Conversation
A threadsafe function may utilize its context in its `call_js` callback. The context should be valid during draining of the queue when the threadsafe function is aborted. Fixes: nodejs#60026
Collaborator
|
Review requested:
|
Contributor
Author
|
Without the fix commit, the new test fails: With the fix commit, the process completes as expected: |
Add a test where a threadsafe function's `call_js` callback uses its context which is freed in the threadsafe function's finalizer.
3ff5d15 to
d52e75c
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #61956 +/- ##
==========================================
+ Coverage 88.84% 89.77% +0.93%
==========================================
Files 674 674
Lines 204957 205608 +651
Branches 39309 39408 +99
==========================================
+ Hits 182087 184586 +2499
+ Misses 15088 13275 -1813
+ Partials 7782 7747 -35
🚀 New features to boost your workflow:
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Execute a threadsafe function's finalizer after the queue drains. It may be the case that the finalizer will free the context, which might be needed in order to properly clean up the data in the
call_jscallback during abort. If the finalizer runs before the queue drains, it may point to invalid memory.