Title: `Promise.race` lead to memory leak · Issue #17469 · nodejs/node · GitHub
Open Graph Title: `Promise.race` lead to memory leak · Issue #17469 · nodejs/node
X Title: `Promise.race` lead to memory leak · Issue #17469 · nodejs/node
Description: Version: v9.2.0 and v8.9.1, probably other version also affected Platform: linux Subsystem: - I run this code inside docker with -m 100m --memory-swap 100m , and then the program crash after few second function doWork() { // ... do real ...
Open Graph Description: Version: v9.2.0 and v8.9.1, probably other version also affected Platform: linux Subsystem: - I run this code inside docker with -m 100m --memory-swap 100m , and then the program crash after few se...
X Description: Version: v9.2.0 and v8.9.1, probably other version also affected Platform: linux Subsystem: - I run this code inside docker with -m 100m --memory-swap 100m , and then the program crash after few se...
Opengraph URL: https://github.com/nodejs/node/issues/17469
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`Promise.race` lead to memory leak","articleBody":"* **Version**: v9.2.0 and v8.9.1, probably other version also affected\r\n* **Platform**: linux\r\n* **Subsystem**: -\r\n\r\nI run this code inside docker with `-m 100m --memory-swap 100m` , and then the program crash after few second\r\n```js\r\nfunction doWork() {\r\n // ... do real work with some sleep at the end, but for demo purpose i just return (async) resolved promise\r\n return new Promise(a =\u003e setImmediate(a));\r\n}\r\n\r\nvar exit = false;\r\nconst exitPromise = new Promise(a =\u003e {\r\n process.once('SIGINT', () =\u003e {\r\n exit = true;\r\n a();\r\n });\r\n});\r\n\r\n(async () =\u003e {\r\n console.log('start');\r\n while(!exit) {\r\n await Promise.race([exitPromise, doWork()]);\r\n }\r\n console.log('stop');\r\n})().catch(console.error.bind(console));\r\n```\r\n\r\nbut it perfectly fine when i change `await Promise.race([exitPromise, doWork()]);` with `await doWork();`","author":{"url":"https://github.com/win-t","@type":"Person","name":"win-t"},"datePublished":"2017-12-05T12:42:46.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":30},"url":"https://github.com/17469/node/issues/17469"}
| 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:a439c7a9-151e-71c6-f43d-4a7523e73eaf |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C39C:3BBB5A:2D6590:3D8463:6A4D8C41 |
| html-safe-nonce | 89135f851b086bdeec6060f3126c5063248fc3a10eae7756c319a9c9e716eb51 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMzlDOjNCQkI1QToyRDY1OTA6M0Q4NDYzOjZBNEQ4QzQxIiwidmlzaXRvcl9pZCI6IjU2MTU1NzM0MTM3NzY5NTIzODUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | ddf1d6d2eef0e9ef2976346e796e667434a610618d5766139810dda01a10edb2 |
| hovercard-subject-tag | issue:279361101 |
| 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/17469/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9383410066dc0031831b1be219479e63f7468a999346f2c94396d732597d315f/nodejs/node/issues/17469 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9383410066dc0031831b1be219479e63f7468a999346f2c94396d732597d315f/nodejs/node/issues/17469 |
| og:image:alt | Version: v9.2.0 and v8.9.1, probably other version also affected Platform: linux Subsystem: - I run this code inside docker with -m 100m --memory-swap 100m , and then the program crash after few se... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | win-t |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9f8758a3953dfe943439713a6fa4f90d542a3431f10e861ca03dd7f39009f320 |
| 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 | bffd5484f01713a661b03469b77678f72b6574ed |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width