X Tutup
The Wayback Machine - https://web.archive.org/web/20220405130616/https://github.com/nodejs/node-addon-api/pull/729
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

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

@mhdawson mhdawson commented May 14, 2020

@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

@davedoesdev davedoesdev commented May 14, 2020

@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

@davedoesdev davedoesdev commented May 15, 2020

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

@mhdawson
Copy link
Member

@mhdawson mhdawson commented May 22, 2020

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

@mhdawson
Copy link
Member

@mhdawson 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

@davedoesdev davedoesdev commented Jun 10, 2020

@mhdawson done

@mhdawson
Copy link
Member

@mhdawson mhdawson commented Jun 11, 2020

@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

@davedoesdev davedoesdev commented Aug 5, 2020

@mhdawson no worries. Any rough ETA?

@mhdawson
Copy link
Member

@mhdawson mhdawson commented Aug 18, 2020

@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

@davedoesdev davedoesdev commented Aug 18, 2020

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

Copy link
Member

@mhdawson mhdawson left a comment

LGTM

@mhdawson
Copy link
Member

@mhdawson mhdawson commented Aug 21, 2020

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

@mhdawson
Copy link
Member

@mhdawson mhdawson commented Aug 21, 2020

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

@mhdawson mhdawson commented Aug 21, 2020

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

@davedoesdev davedoesdev commented Aug 22, 2020

@mhdawson rebased

Signed-off-by: Michael Dawson <michael_dawson@ca.ibm.com>
@mhdawson
Copy link
Member

@mhdawson mhdawson commented Aug 24, 2020

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

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

REFS: #722
PR-URL: #729
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
@mhdawson
Copy link
Member

@mhdawson mhdawson commented Aug 24, 2020

Landed as: 518cfdc

@mhdawson
Copy link
Member

@mhdawson mhdawson commented Aug 24, 2020

Thanks for all your work on this @davedoesdev

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

@davedoesdev davedoesdev commented Aug 24, 2020

@mhdawson thanks for merging

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.

None yet

2 participants
X Tutup