{"action":"created","issue":{"url":"https://api.github.com/repos/nodejs/node/issues/19422","repository_url":"https://api.github.com/repos/nodejs/node","labels_url":"https://api.github.com/repos/nodejs/node/issues/19422/labels{/name}","comments_url":"https://api.github.com/repos/nodejs/node/issues/19422/comments","events_url":"https://api.github.com/repos/nodejs/node/issues/19422/events","html_url":"https://github.com/nodejs/node/issues/19422","id":306210359,"number":19422,"title":"[tracking issue] src: clean up resources on Environment teardown","user":{"login":"gireeshpunathil","id":6447530,"avatar_url":"https://avatars2.githubusercontent.com/u/6447530?v=4","gravatar_id":"","url":"https://api.github.com/users/gireeshpunathil","html_url":"https://github.com/gireeshpunathil","followers_url":"https://api.github.com/users/gireeshpunathil/followers","following_url":"https://api.github.com/users/gireeshpunathil/following{/other_user}","gists_url":"https://api.github.com/users/gireeshpunathil/gists{/gist_id}","starred_url":"https://api.github.com/users/gireeshpunathil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gireeshpunathil/subscriptions","organizations_url":"https://api.github.com/users/gireeshpunathil/orgs","repos_url":"https://api.github.com/users/gireeshpunathil/repos","events_url":"https://api.github.com/users/gireeshpunathil/events{/privacy}","received_events_url":"https://api.github.com/users/gireeshpunathil/received_events","type":"User","site_admin":false},"labels":[{"id":155267502,"url":"https://api.github.com/repos/nodejs/node/labels/C++","name":"C++","color":"e11d21","default":false},{"id":670882744,"url":"https://api.github.com/repos/nodejs/node/labels/embedding","name":"embedding","color":"FF4500","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2018-03-18T03:34:59Z","updated_at":"2018-03-18T20:17:26Z","closed_at":null,"author_association":"MEMBER","body":"<!--\r\nThank you for reporting an issue.\r\n\r\nThis issue tracker is for bugs and issues found within Node.js core.\r\nIf you require more general support please file an issue on our help\r\nrepo. https://github.com/nodejs/help\r\n\r\n\r\nPlease fill in as much of the template below as you're able.\r\n\r\nVersion: output of `node -v`\r\nPlatform: output of `uname -a` (UNIX), or version and 32 or 64-bit (Windows)\r\nSubsystem: if known, please specify affected core module name\r\n\r\nIf possible, please provide code that demonstrates the problem, keeping it as\r\nsimple and free of external dependencies as you are able.\r\n-->\r\n\r\n* **Version**: NA\r\n* **Platform**: NA\r\n* **Subsystem**: NA\r\n\r\n<!-- Enter your issue details below this comment. -->\r\n\r\nThis is to track #19377 exclusively, gets resolved when that PR lands. I am expecting a few runtime errors to come up, and opening this to leave the PR discussions free from debugging discussions.\r\nI have developed a small test case that invokes `node::Environment::RunCleanup` at some arbitrary program control point. To start with, I have this code:\r\n\r\n#cat test.js\r\n```js\r\nsetTimeout(() => {\r\n  require('./term').t()\r\n}, 1000)\r\n```\r\nwhere `term` is small module that wraps a method `t` through `term::Terminate` with the sole purpose of calling `node::Environment::RunCleanup()` . I will come up with some scenarios to invoke this through a variety of means that mimics launch and re-lauch of node  in different possible ways - goal is to have good degree of resilience and stability for emedders.\r\n\r\n/cc @addaleax "},"comment":{"url":"https://api.github.com/repos/nodejs/node/issues/comments/374041140","html_url":"https://github.com/nodejs/node/issues/19422#issuecomment-374041140","issue_url":"https://api.github.com/repos/nodejs/node/issues/19422","id":374041140,"user":{"login":"addaleax","id":899444,"avatar_url":"https://avatars2.githubusercontent.com/u/899444?v=4","gravatar_id":"","url":"https://api.github.com/users/addaleax","html_url":"https://github.com/addaleax","followers_url":"https://api.github.com/users/addaleax/followers","following_url":"https://api.github.com/users/addaleax/following{/other_user}","gists_url":"https://api.github.com/users/addaleax/gists{/gist_id}","starred_url":"https://api.github.com/users/addaleax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/addaleax/subscriptions","organizations_url":"https://api.github.com/users/addaleax/orgs","repos_url":"https://api.github.com/users/addaleax/repos","events_url":"https://api.github.com/users/addaleax/events{/privacy}","received_events_url":"https://api.github.com/users/addaleax/received_events","type":"User","site_admin":false},"created_at":"2018-03-18T20:17:26Z","updated_at":"2018-03-18T20:17:26Z","author_association":"OWNER","body":"> If I understand correctly, effectively Environment teardown === node tear down, in the most common use case for node (single-env) right?\r\n\r\nWe should provide embedders with ways to achieve both, I think. But generally, Node maintains only a really small portion of its state in a global manner instead of per-Environment, so it might be good to know what kind of options you'd have in mind for this?\r\n\r\n> After monitoring the resource usage and the throughput, it would want to re-spin node with modified input (configuration and arguments.)\r\n\r\nIt's come up in other PRs that we should probably be separating between options that are per-Environment and options that are per-Isolate (or even global). All of these exist, and we don't really have a consistent story around those. (I've been sketching some ideas around that, but that's still very much an early work in progress.)\r\n\r\nSo, if you're concerned about options, it probably depends on which you think an embedder might tune for re-use...?"}}
{"actor":{"display_login":"addaleax"}}