René's URL Explorer Experiment


Title: worker.exitedAfterDisconnect is set to `false` after worker.kill(), which doesn't comply with the documentation · Issue #51934 · nodejs/node · GitHub

Open Graph Title: worker.exitedAfterDisconnect is set to `false` after worker.kill(), which doesn't comply with the documentation · Issue #51934 · nodejs/node

X Title: worker.exitedAfterDisconnect is set to `false` after worker.kill(), which doesn't comply with the documentation · Issue #51934 · nodejs/node

Description: Version v18.16.0 (haven't check older version btw) Platform Linux 6.5.0-21-generic #21-Ubuntu SMP PREEMPT_DYNAMIC Wed Feb 7 14:17:40 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux Subsystem No response What steps will reproduce the bug? Run the...

Open Graph Description: Version v18.16.0 (haven't check older version btw) Platform Linux 6.5.0-21-generic #21-Ubuntu SMP PREEMPT_DYNAMIC Wed Feb 7 14:17:40 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux Subsystem No response Wh...

X Description: Version v18.16.0 (haven't check older version btw) Platform Linux 6.5.0-21-generic #21-Ubuntu SMP PREEMPT_DYNAMIC Wed Feb 7 14:17:40 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux Subsystem No respons...

Opengraph URL: https://github.com/nodejs/node/issues/51934

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"worker.exitedAfterDisconnect is set to `false` after worker.kill(), which doesn't comply with the documentation","articleBody":"### Version\r\n\r\nv18.16.0 (haven't check older version btw)\r\n\r\n### Platform\r\n\r\nLinux \u003cmy-machine-name> 6.5.0-21-generic #21-Ubuntu SMP PREEMPT_DYNAMIC Wed Feb  7 14:17:40 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux\r\n\r\n### Subsystem\r\n\r\n_No response_\r\n\r\n### What steps will reproduce the bug?\r\n\r\n- Run the below code block using `node index.js` e.g.\r\n\r\n```const cluster = require(\"node:cluster\");\r\nconst http = require(\"node:http\");\r\nconst process = require(\"node:process\");\r\n\r\nif (cluster.isPrimary) {\r\n  // Keep track of http requests\r\n  let numReqs = 0;\r\n  let inter = setInterval(() => {\r\n    console.log(`numReqs = ${numReqs}`);\r\n  }, 1000);\r\n\r\n  // Count requests\r\n  function messageHandler(msg) {\r\n    if (msg.cmd && msg.cmd === \"notifyRequest\") {\r\n      numReqs += 1;\r\n    }\r\n  }\r\n\r\n  // Start workers and listen for messages containing notifyRequest\r\n  const numCPUs = require(\"node:os\").availableParallelism();\r\n  for (let i = 0; i \u003c 2; i++) {\r\n    cluster.fork();\r\n  }\r\n\r\n  for (const id in cluster.workers) {\r\n    cluster.workers[id].on(\"message\", messageHandler);\r\n  }\r\n  cluster.on(\"exit\", (worker, code, signal) => {\r\n    console.log(\r\n      `--------------EAD---------------${worker.exitedAfterDisconnect}-----`,\r\n    );\r\n    if (worker.exitedAfterDisconnect === true) {\r\n      console.log(\"Oh, it was just voluntary – no need to worry\");\r\n    } else {\r\n      console.log(`-----------EXIT------------------${worker.process.pid}`);\r\n    }\r\n  });\r\n  process.on(\"SIGINT\", async (signal) => {\r\n    console.log(\"----------------SIGINT----------------------\");\r\n    await killChildProcesses(cluster);\r\n    console.log(\"-----------------DONE------------------\");\r\n    process.exit(0);\r\n  });\r\n} else {\r\n  // Worker processes have a http server.\r\n  const server = http\r\n    .Server((req, res) => {\r\n      res.writeHead(200);\r\n      res.end(\"hello world\\n\");\r\n\r\n      // Notify primary about the request\r\n      process.send({ cmd: \"notifyRequest\" });\r\n    })\r\n    .listen(4000);\r\n  process.on(\"SIGTERM\", (signal) => {\r\n    console.log(\"----------------SIGTERM----------------------\");\r\n    server.close(() => {\r\n      console.log(\"----------------------CLOSED---------------------\");\r\n      process.exit(0);\r\n    });\r\n  });\r\n}\r\n\r\nfunction killChildProcesses(cluster) {\r\n  return new Promise((resolve) => {\r\n    const aliveWorkers = Object.values(cluster.workers || {}).filter(\r\n      (worker) => {\r\n        return worker && !worker.isDead();\r\n      },\r\n    );\r\n\r\n    if (aliveWorkers.length === 0) {\r\n      resolve();\r\n      return;\r\n    }\r\n\r\n    let workersAlive = aliveWorkers.length;\r\n\r\n    const handleWorkerExit = () => {\r\n      workersAlive--;\r\n      if (workersAlive === 0) {\r\n        resolve();\r\n      }\r\n    };\r\n\r\n    aliveWorkers.forEach((worker) => {\r\n      console.log(\"-----------KILLING-----------\");\r\n      worker.on(\"exit\", handleWorkerExit);\r\n      worker.kill();\r\n    });\r\n  });\r\n}\r\n\r\n```\r\n- find out the primary process number for this e.g. `ps -ef | grep index.js`\r\n- kill the process with `SIGINT` signal, i.e. `kill -SIGINT \u003cpid>`\r\n- the resulting console output is as below\r\n```\r\n----------------SIGINT----------------------\r\n-----------KILLING-----------\r\n-----------KILLING-----------\r\n----------------SIGTERM----------------------\r\n----------------SIGTERM----------------------\r\n----------------------CLOSED---------------------\r\n----------------------CLOSED---------------------\r\n--------------EAD---------------false--0---\r\n-----------EXIT------------------\u003cworker-1-pid>\r\n--------------EAD---------------false--0---\r\n-----------EXIT------------------\u003cworker-2-pid>\r\n-----------------DONE------------------\r\n\r\n```\r\n### How often does it reproduce? Is there a required condition?\r\n\r\nalways\r\n\r\n### What is the expected behavior? Why is that the expected behavior?\r\n\r\nThe expected behavior should be\r\n```\r\n----------------SIGINT----------------------\r\n-----------KILLING-----------\r\n-----------KILLING-----------\r\n----------------SIGTERM----------------------\r\n----------------SIGTERM----------------------\r\n----------------------CLOSED---------------------\r\n----------------------CLOSED---------------------\r\n--------------EAD---------------false--0---\r\nOh, it was just voluntary – no need to worry\r\n--------------EAD---------------false--0---\r\nOh, it was just voluntary – no need to worry\r\n-----------------DONE------------------\r\n```\r\n\r\n\r\n\r\n### What do you see instead?\r\n\r\nAs you can see the `worker.exitedAfterDisconnect` is not `true`, but the documentation (https://nodejs.org/api/cluster.html#workerexitedafterdisconnect)  states that it should be true if you `kill()` or `disconnect()` the worker.\r\n\r\n![image](https://github.com/nodejs/node/assets/14083655/9cea71c5-c608-4260-b654-a60f852e5ec5)\r\n\r\nAs you can the worker process exited with code 0, I don't understand which other way it can be exited with code 0 other that what the code is doing...\r\n\r\n### Additional information\r\n\r\n_No response_","author":{"url":"https://github.com/khaled4vokalz","@type":"Person","name":"khaled4vokalz"},"datePublished":"2024-03-01T11:47:07Z","url":"https://github.com/nodejs/node/issues/51934"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:b4b1854f-8579-f6e9-b4d4-849d4b0195d3
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE082:2F339D:971395:C8F9EE:6AED2EA8
html-safe-nonce0dde45aeeac818d646dcd66f43505574bcedba05b7c511beac5ec2ea1ccc2556
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMDgyOjJGMzM5RDo5NzEzOTU6QzhGOUVFOjZBRUQyRUE4IiwidmlzaXRvcl9pZCI6Ijg3NDMxNDgyMDYyMjk4OTI3NzYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac40462b23ddbd53cdbb1655becaa65f5aa26c0e934b4091aefa9f9c8a2fe50d48
hovercard-subject-tagissue:2163230414
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/51934/issue_layout
twitter:imagehttps://opengraph.githubassets.com/ba8dbc6ecf92aae261f2b413d550c9ecd3b6e42b7f3360d14accf05fc8e39c33/nodejs/node/issues/51934
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/ba8dbc6ecf92aae261f2b413d550c9ecd3b6e42b7f3360d14accf05fc8e39c33/nodejs/node/issues/51934
og:image:altVersion v18.16.0 (haven't check older version btw) Platform Linux 6.5.0-21-generic #21-Ubuntu SMP PREEMPT_DYNAMIC Wed Feb 7 14:17:40 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux Subsystem No response Wh...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamekhaled4vokalz
hostnamegithub.com
expected-hostnamegithub.com
Nonee51d0b7b5ab34b1688c05b54c3ed17b8658b2fa9bca973a9c740683ccb12cf4a
turbo-cache-controlno-preview
go-importgithub.com/nodejs/node git https://github.com/nodejs/node.git
octolytics-dimension-user_id9950313
octolytics-dimension-user_loginnodejs
octolytics-dimension-repository_id27193779
octolytics-dimension-repository_nwonodejs/node
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id27193779
octolytics-dimension-repository_network_root_nwonodejs/node
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release59ebb7b901cc154ecc179a44f266fcf69f343b30
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/nodejs/node/issues/51934#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F51934
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F51934
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=nodejs%2Fnode
Reloadhttps://github.com/nodejs/node/issues/51934
Reloadhttps://github.com/nodejs/node/issues/51934
Reloadhttps://github.com/nodejs/node/issues/51934
nodejshttps://github.com/nodejs
nodehttps://github.com/nodejs/node
Codehttps://github.com/nodejs/node
Issues656 (656)https://github.com/nodejs/node/issues
Pull requests666 (666)https://github.com/nodejs/node/pulls
Actionshttps://github.com/nodejs/node/actions
Projectshttps://github.com/nodejs/node/projects
Security and qualityhttps://github.com/nodejs/node/security
Insightshttps://github.com/nodejs/node/pulse
https://github.com/nodejs/node
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/51934
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/51934
worker.exitedAfterDisconnect is set to false after worker.kill(), which doesn't comply with the documentationhttps://github.com/nodejs/node/issues/51934#top
https://github.com/khaled4vokalz
khaled4vokalzhttps://github.com/khaled4vokalz
on Mar 1, 2024https://github.com/nodejs/node/issues/51934#issue-2163230414
#21https://github.com/nodejs/node/pull/21
https://nodejs.org/api/cluster.html#workerexitedafterdisconnecthttps://nodejs.org/api/cluster.html#workerexitedafterdisconnect
https://private-user-images.githubusercontent.com/14083655/309248211-9cea71c5-c608-4260-b654-a60f852e5ec5.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3OTM5MjkxNzMsIm5iZiI6MTc5MzkyODg3MywicGF0aCI6Ii8xNDA4MzY1NS8zMDkyNDgyMTEtOWNlYTcxYzUtYzYwOC00MjYwLWI2NTQtYTYwZjg1MmU1ZWM1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjExMDYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYxMTA2VDAxMzQzM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWMzMjkxNmNkODlkNzQwMWIzNzk4N2E5OTAzNDI4NWYxNGUwYjM0MjI2ODEwZTdhNDg1ZTQwYmYzYzlhMmU1M2UmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.ZlzZT-T7CFjnnJPuLbva8ooiW7B3po3JoapGNltkW-M
https://github.com/aduh95
aduh95https://github.com/aduh95
on Mar 2, 2024https://github.com/nodejs/node/issues/51934#issuecomment-1974783128
node/doc/api/cluster.mdhttps://github.com/nodejs/node/blob/84716d88d34e5f50b8fa901cb7e0e7b197c9c269/doc/api/cluster.md#L447-L457
84716d8https://github.com/nodejs/node/commit/84716d88d34e5f50b8fa901cb7e0e7b197c9c269
https://github.com/khaled4vokalz
khaled4vokalzhttps://github.com/khaled4vokalz
on Mar 2, 2024https://github.com/nodejs/node/issues/51934#issuecomment-1974855836
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/v16/cluster.d.ts#L269https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/v16/cluster.d.ts#L269
https://private-user-images.githubusercontent.com/14083655/309490130-433dcca9-8c70-48be-96fd-364a53e701c2.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3OTM5MjkxNzMsIm5iZiI6MTc5MzkyODg3MywicGF0aCI6Ii8xNDA4MzY1NS8zMDk0OTAxMzAtNDMzZGNjYTktOGM3MC00OGJlLTk2ZmQtMzY0YTUzZTcwMWMyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjExMDYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYxMTA2VDAxMzQzM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWE0MTJlNWJkZjgwYmViYTFjYWQ3OTk4YjFkMWRkNjE2MWNiOGFhMjVmNzY0MGJjMzI3NzJhM2Y2YWY4MjE1MDcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.kf1OysCWj2hxF-QiR_XnnPFejDzUItycqfHzgMkHvrU
https://github.com/nodejs/node/blob/main/lib/internal/cluster/primary.js#L360https://github.com/nodejs/node/blob/main/lib/internal/cluster/primary.js#L360
https://github.com/khaled4vokalz
khaled4vokalzhttps://github.com/khaled4vokalz
on Mar 2, 2024https://github.com/nodejs/node/issues/51934#issuecomment-1974856265
khaled4vokalzhttps://github.com/khaled4vokalz
completedhttps://github.com/nodejs/node/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Mar 2, 2024https://github.com/nodejs/node/issues/51934#event-11987842022
https://github.com/aduh95
aduh95https://github.com/aduh95
on Mar 2, 2024https://github.com/nodejs/node/issues/51934#issuecomment-1974858641
Sign up for freehttps://github.com/signup?return_to=https://github.com/nodejs/node/issues/51934
Sign in to commenthttps://github.com/login?return_to=https://github.com/nodejs/node/issues/51934
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.