Details
-
Bug
-
Resolution: Done
-
Major - P3
-
2.4.6, 2.5.2
-
Fully Compatible
-
ALL
Description
The V8Scope constructor is not exception-safe, and will leak V8 isolates if an exception is thrown. Thus, if a user executes a Javascript operation that acquires a new scope, and then interrupts that operation while its initialization files are being executed (assert.js, types.js), the half-constructed V8Scope object will be leaked. The initialization files can take on the order of ~100 milliseconds to run.
Reproduce in master with:
for (;;) { db.runCommand({eval: function(){}, maxTimeMS: 1}); }
|
On my local machine, the above leaks 2GB in ~30 seconds. The same occurs in 2.4.6 using killOp instead of maxTimeMS. No V8Scope is ever successfully constructed, and the scope pool remains empty.