Description
Version: 8.11.1
Platform: any
We have been experiencing 100% CPU in production, presumably caused by the use of Fibers in Node.js by Meteor and the way the data lookup for threads is implemented in V8.
While this issue probably should not be fixed in this repository it seemed worthwhile to track it here as well, in order to find out whether more users of Node.js are suffering from this issue.
As @kentonv describes the issue in the Meteor repository:
V8 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).
Issue on Meteor repository:
meteor/meteor#9796
Issue on Fibers repository:
laverdet/node-fibers#371
Commit which fixes the issue in Node.js:
0b88256
V8 issue:
https://bugs.chromium.org/p/v8/issues/detail?id=5338
Proposed contribution which fixes the issue in V8:
Not available yet.