Title: Confusing Documentation on asyncResource.emitDestroy() · Issue #32409 · nodejs/node · GitHub
Open Graph Title: Confusing Documentation on asyncResource.emitDestroy() · Issue #32409 · nodejs/node
X Title: Confusing Documentation on asyncResource.emitDestroy() · Issue #32409 · nodejs/node
Description: 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 prop...
Open Graph Description: 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.requir...
X Description: 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.requir...
Opengraph URL: https://github.com/nodejs/node/issues/32409
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Confusing Documentation on asyncResource.emitDestroy()","articleBody":"* **Version**: 13.x\r\n* **Platform**: N/A\r\n* **Subsystem**: Documentation\r\n\r\n### Additional information\r\n\r\n[The behaviour of `asyncResource.emitDestroy()` under `async_hooks`](https://nodejs.org/dist/latest-v13.x/docs/api/async_hooks.html#async_hooks_new_asyncresource_type_options) is somewhat confusing. \r\n\r\nDocumentation of the `options.requireManualDestroy` constructor argument property of `AsyncResource` states that:\r\n\r\n> (`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.\r\n\r\nThis indicates that `asyncResource.emitDestroy()` is automatically called by default. However, the following section on [`emitDestroy()` documentation](https://nodejs.org/dist/latest-v13.x/docs/api/async_hooks.html#async_hooks_asyncresource_emitdestroy) states that:\r\n\r\n> This **must** be manually called. If the resource is left to be collected by the GC then the destroy hooks will never be called.\r\n\r\nI'm a bit confused about this. Shouldn't this be re-worded in order to convey behaviour of `emitDestroy` clearly? \r\n\r\nPS: 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.\r\n","author":{"url":"https://github.com/deepal","@type":"Person","name":"deepal"},"datePublished":"2020-03-21T13:14:48Z","url":"https://github.com/nodejs/node/issues/32409"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:307b8164-60a3-bf4a-9361-c94bf69d71e9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E320:68161:60829:82F00:6B048DCF |
| html-safe-nonce | 7ab86842ad53c24bd7f7685056616acf6527dc14a53e58c819433afcfabafece |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMzIwOjY4MTYxOjYwODI5OjgyRjAwOjZCMDQ4RENGIiwidmlzaXRvcl9pZCI6IjU3ODE0MDc0MjI1NTE5ODU2MTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 47ceccae921d06b6121c49748b59444a8f1d07aca718ef8b150bf17aeedba6f3 |
| hovercard-subject-tag | issue:585497245 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/32409/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8bc6aea592bc96ac0f5ed9c7a85367ddd930017760a8fdfd281514eef3f25a18/nodejs/node/issues/32409 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8bc6aea592bc96ac0f5ed9c7a85367ddd930017760a8fdfd281514eef3f25a18/nodejs/node/issues/32409 |
| og:image:alt | 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.requir... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | deepal |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9b297275a74a2c9a35898175c9477837c635d4f579277ebff3b2d6ebd012e247 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b51ce57ca6d4565a42856fc1c9897077c794597f |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width