Skip to content
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

Fix ObjectWrap destructor from env exit under node_g #729

Closed
wants to merge 2 commits into from
Closed

Fix ObjectWrap destructor from env exit under node_g #729

wants to merge 2 commits into from

Conversation

davedoesdev
Copy link
Contributor

@davedoesdev davedoesdev commented May 14, 2020

Only fails under debug buildtype (node_g)

Update: Also fails using release 12.16.3

#722

@mhdawson
Copy link
Member

@davedoesdev thanks for submitting a PR for this.

Does the stack trace suggest is occurring from a path triggered by the gc. I've not had time yet but wanted to think through if it was a concern or not if that was occurring (also away for next few days so will probably be mid next week before I find time).

@davedoesdev
Copy link
Contributor Author

@mhdawson it looks like it's when the environment is closing due to the worker thread exiting.
The handles are being cleaned up at that point.

@davedoesdev
Copy link
Contributor Author

@mhdawson the test also fails under Node 12.16.3 release build!

@mhdawson
Copy link
Member

Spent some time looking at this see nodejs/node#33508

@mhdawson
Copy link
Member

mhdawson commented Jun 9, 2020

@davedoesdev nodejs/node#33508 just landed which should fix the reported problem (it will need to land in 14.x and 12.x as well).

I still think adding the test on the node-addon-api side makes sense in addition to the one in core. Can you remove the non-test change and then we'll get it landed once the core backports are complete.

@davedoesdev
Copy link
Contributor Author

@mhdawson done

@mhdawson
Copy link
Member

@davedoesdev thanks, may be a while before we can land as we have to wait for Node.js backports but thanks for all of your working finding and helping to resolve. Much appreciated.

@davedoesdev
Copy link
Contributor Author

@mhdawson no worries. Any rough ETA?

@mhdawson
Copy link
Member

@davedoesdev sorry for the late update. Looks like its been backported as far back as 12.x. I can't remember if we thought it would apply to 10.x but if you update the PR to just add the test we can run the CI and confirm one way or the other, and if not land it.

@davedoesdev
Copy link
Contributor Author

@mhdawson PR should already have been updated to contain just the test

Copy link
Member

@mhdawson mhdawson left a comment

Choose a reason for hiding this comment

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

LGTM

@mhdawson
Copy link
Member

@mhdawson
Copy link
Member

@davedoesdev any chance you can rebase seems like it needs one now.

@mhdawson
Copy link
Member

Failure on windows for different test so unrelated to this PR. @gabrielschulhof would this be related to any of the recent finalizer/timing changes you had looked at?

assert.js:103
  throw new AssertionError(obj);
  ^

AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
+ actual - expected

+ {}
- {
-   finalizerCalled: true
- }
    at test (C:\workspace\node-test-node-addon-api-new\nodes\win-vs2019\node-addon-api\test\object\finalizer.js:16:10)
    at Object.<anonymous> (C:\workspace\node-test-node-addon-api-new\nodes\win-vs2019\node-addon-api\test\object\finalizer.js:6:1)
    at Module._compile (internal/modules/cjs/loader.js:1089:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1110:10)
    at Module.load (internal/modules/cjs/loader.js:954:32)
    at Function.Module._load (internal/modules/cjs/loader.js:795:14)
    at Module.require (internal/modules/cjs/loader.js:978:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at C:\workspace\node-test-node-addon-api-new\nodes\win-vs2019\node-addon-api\test\index.js:97:5
    at Array.forEach (<anonymous>) {
  generatedMessage: true,
  code: 'ERR_ASSERTION',
  actual: {},
  expected: { finalizerCalled: true },
  operator: 'deepStrictEqual'
}

@mhdawson
Copy link
Member

That same test seems to have failed on other platforms as well. Might be related to me running this on the PR branch which may be missing some of the latest changes.

I'll try again after a rebase.

@davedoesdev
Copy link
Contributor Author

@mhdawson rebased

@mhdawson
Copy link
Member

Added commit to only run on Node.js 12 and higher as it requires worker threads

mhdawson pushed a commit that referenced this pull request Aug 24, 2020
Add test for ObjectWrap destructor (no HandleScope exception)

REFS: #722
PR-URL: #729
Reviewed-By: Michael Dawson <[email protected]>
@mhdawson
Copy link
Member

Landed as: 518cfdc

@mhdawson
Copy link
Member

Thanks for all your work on this @davedoesdev

@mhdawson mhdawson closed this Aug 24, 2020
@davedoesdev
Copy link
Contributor Author

@mhdawson thanks for merging

kevindavies8 added a commit to kevindavies8/node-addon-api-Develop that referenced this pull request Aug 24, 2022
Add test for ObjectWrap destructor (no HandleScope exception)

REFS: nodejs/node-addon-api#722
PR-URL: nodejs/node-addon-api#729
Reviewed-By: Michael Dawson <[email protected]>
Marlyfleitas added a commit to Marlyfleitas/node-api-addon-Development that referenced this pull request Aug 26, 2022
Add test for ObjectWrap destructor (no HandleScope exception)

REFS: nodejs/node-addon-api#722
PR-URL: nodejs/node-addon-api#729
Reviewed-By: Michael Dawson <[email protected]>
wroy7860 added a commit to wroy7860/addon-api-benchmark-node that referenced this pull request Sep 19, 2022
Add test for ObjectWrap destructor (no HandleScope exception)

REFS: nodejs/node-addon-api#722
PR-URL: nodejs/node-addon-api#729
Reviewed-By: Michael Dawson <[email protected]>
johnfrench3 pushed a commit to johnfrench3/node-addon-api-git that referenced this pull request Aug 11, 2023
Add test for ObjectWrap destructor (no HandleScope exception)

REFS: nodejs/node-addon-api#722
PR-URL: nodejs/node-addon-api#729
Reviewed-By: Michael Dawson <[email protected]>
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.

2 participants