{"action":"created","issue":{"url":"https://api.github.com/repos/laverdet/node-fibers/issues/371","repository_url":"https://api.github.com/repos/laverdet/node-fibers","labels_url":"https://api.github.com/repos/laverdet/node-fibers/issues/371/labels{/name}","comments_url":"https://api.github.com/repos/laverdet/node-fibers/issues/371/comments","events_url":"https://api.github.com/repos/laverdet/node-fibers/issues/371/events","html_url":"https://github.com/laverdet/node-fibers/issues/371","id":314773022,"number":371,"title":"100% CPU caused by Fiber spike (in Meteor)","user":{"login":"KoenLav","id":12446296,"avatar_url":"https://avatars2.githubusercontent.com/u/12446296?v=4","gravatar_id":"","url":"https://api.github.com/users/KoenLav","html_url":"https://github.com/KoenLav","followers_url":"https://api.github.com/users/KoenLav/followers","following_url":"https://api.github.com/users/KoenLav/following{/other_user}","gists_url":"https://api.github.com/users/KoenLav/gists{/gist_id}","starred_url":"https://api.github.com/users/KoenLav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KoenLav/subscriptions","organizations_url":"https://api.github.com/users/KoenLav/orgs","repos_url":"https://api.github.com/users/KoenLav/repos","events_url":"https://api.github.com/users/KoenLav/events{/privacy}","received_events_url":"https://api.github.com/users/KoenLav/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-04-16T18:44:13Z","updated_at":"2018-04-17T04:26:50Z","closed_at":null,"author_association":"NONE","body":"We have been experiencing 100% CPU in production, presumably caused by the use of Fibers by Meteor and the way the data lookup for threads is implemented in V8.\r\n\r\nWhile this issue probably cannot be fixed in this repository it seemed worthwhile to track it here as well, in order to find out whether more users of Fibers are suffering from this issue.\r\n\r\nAs @kentonv describes the issue in the Meteor repository:\r\nV8 uses a linked list to map thread IDs to some thread-local data. Fibers aren't threads, but the fibers package fakes out V8 into thinking that fibers are threads, so this applies to fibers too. If a large number of fibers are created, the list becomes long, and so every lookup into the table becomes slow, because a lookup in a linked list is O(n). These lookups happen frequently, slowing down everything. Using a hash table makes the lookups O(1).\r\n\r\nIssue on Meteor repository:\r\nhttps://github.com/meteor/meteor/issues/9796\r\n\r\nProposed improvement to Meteor's use of Fibers:\r\nhttps://github.com/sandstorm-io/sandstorm/blob/0f1fec013fe7208ed0fd97eb88b31b77e3c61f42/shell/server/00-startup.js#L99-L129\r\n\r\nCommit which fixes the issue in Node.js (by applying a patch to V8):\r\nhttps://github.com/nodejs/node/commit/0b882566078cb14537f9f91220f1a58530fa7687\r\n\r\nV8 issue:\r\nhttps://bugs.chromium.org/p/v8/issues/detail?id=5338\r\n\r\nProposed contribution which fixes the issue in V8:\r\nNot available yet."},"comment":{"url":"https://api.github.com/repos/laverdet/node-fibers/issues/comments/381835549","html_url":"https://github.com/laverdet/node-fibers/issues/371#issuecomment-381835549","issue_url":"https://api.github.com/repos/laverdet/node-fibers/issues/371","id":381835549,"user":{"login":"kentonv","id":4001805,"avatar_url":"https://avatars0.githubusercontent.com/u/4001805?v=4","gravatar_id":"","url":"https://api.github.com/users/kentonv","html_url":"https://github.com/kentonv","followers_url":"https://api.github.com/users/kentonv/followers","following_url":"https://api.github.com/users/kentonv/following{/other_user}","gists_url":"https://api.github.com/users/kentonv/gists{/gist_id}","starred_url":"https://api.github.com/users/kentonv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kentonv/subscriptions","organizations_url":"https://api.github.com/users/kentonv/orgs","repos_url":"https://api.github.com/users/kentonv/repos","events_url":"https://api.github.com/users/kentonv/events{/privacy}","received_events_url":"https://api.github.com/users/kentonv/received_events","type":"User","site_admin":false},"created_at":"2018-04-17T04:26:50Z","updated_at":"2018-04-17T04:26:50Z","author_association":"NONE","body":"@laverdet Yeah, I took a look at isolated-vm when I noticed fly.io using it. Cool stuff, funny how we were writing such similar code at the same time. :) I do hope we can open source our version too at some point."}}
{"actor":{"display_login":"kentonv"}}