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

Confusing Documentation on asyncResource.emitDestroy() #32409

Closed
deepal opened this issue Mar 21, 2020 · 0 comments
Closed

Confusing Documentation on asyncResource.emitDestroy() #32409

deepal opened this issue Mar 21, 2020 · 0 comments

Comments

@deepal
Copy link

deepal commented Mar 21, 2020

  • Version: 13.x
  • Platform: N/A
  • Subsystem: Documentation

Additional information

The behaviour of asyncResource.emitDestroy() under async_hooks is somewhat confusing.

Documentation of the options.requireManualDestroy constructor argument property of AsyncResource states that:

(requireManualDestroy: true) Disables automatic emitDestroy when the object is garbage collected. This usually does not need to be set (even if emitDestroy is called manually), unless the resource's asyncId is retrieved and the sensitive API's emitDestroy is called with it. Default: false.

This indicates that asyncResource.emitDestroy() is automatically called by default. However, the following section on emitDestroy() documentation states that:

This must be manually called. If the resource is left to be collected by the GC then the destroy hooks will never be called.

I'm a bit confused about this. Shouldn't this be re-worded in order to convey behaviour of emitDestroy clearly?

PS: I was wondering whether I should create this issue on help repository, but have a feeling that the documentation might have to be amended. Therefore created the issue here.

HarshithaKP added a commit to HarshithaKP/node that referenced this issue Mar 27, 2020
BethGriggs pushed a commit that referenced this issue Apr 7, 2020
Fixes: #32409

PR-URL: #32514
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Vladimir de Turckheim <[email protected]>
targos pushed a commit that referenced this issue Apr 12, 2020
Fixes: #32409

PR-URL: #32514
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Vladimir de Turckheim <[email protected]>
targos pushed a commit that referenced this issue Apr 22, 2020
Fixes: #32409

PR-URL: #32514
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Vladimir de Turckheim <[email protected]>
deepal added a commit to deepal/node that referenced this issue May 3, 2021
This updates the documentation of asyncResource.emitDestroy() to match
the usage of `requireManualDestroy` option.

Refs: nodejs#32409
deepal added a commit to deepal/node that referenced this issue May 3, 2021
This updates the documentation of asyncResource.emitDestroy() to match
the usage of `requireManualDestroy` option.

Refs: nodejs#32409
deepal added a commit to deepal/node that referenced this issue May 4, 2021
This updates the documentation of asyncResource.emitDestroy() to match
the usage of `requireManualDestroy` option.

Refs: nodejs#32409
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 a pull request may close this issue.

1 participant