-
Type: Bug
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: 2.3.0
-
Component/s: None
-
Environment:OS: Ubuntu 22.04.4 LTS
node.js / npm versions: v16.18.1
Additional info:
{code}
(python3-venv) ubuntu@ip-10-0-70-6:~/bugs$ npm version
{
npm: '8.19.2',
node: '16.18.1',
v8: '9.4.146.26-node.22',
uv: '1.43.0',
zlib: '1.2.11',
brotli: '1.0.9',
ares: '1.18.1',
modules: '93',
nghttp2: '1.47.0',
napi: '8',
llhttp: '6.0.10',
openssl: '1.1.1q+quic',
cldr: '41.0',
icu: '71.1',
tz: '2022b',
unicode: '14.0',
ngtcp2: '0.8.1',
nghttp3: '0.7.0'
}
{code}
OS: Ubuntu 22.04.4 LTS node.js / npm versions: v16.18.1 Additional info: {code} (python3-venv) ubuntu@ip-10-0-70-6 :~/bugs$ npm version { npm: '8.19.2', node: '16.18.1', v8: '9.4.146.26-node.22', uv: '1.43.0', zlib: '1.2.11', brotli: '1.0.9', ares: '1.18.1', modules: '93', nghttp2: '1.47.0', napi: '8', llhttp: '6.0.10', openssl: '1.1.1q+quic', cldr: '41.0', icu: '71.1', tz: '2022b', unicode: '14.0', ngtcp2: '0.8.1', nghttp3: '0.7.0' } {code}
-
Developer Tools
Problem Statement/Rationale
There is a memory leak if invalid javascript statements are executed using mongosh. Eventually, the JS interpreter complains that GC is ineffective and OOMs.
Please be sure to attach relevant logs with any sensitive data redacted.
How to retrieve logs for: Compass; Shell
Steps to Reproduce
Pipe the output of the following script to mongosh --nodb
for i in range(1,1000000): print("a={'a':'b'} {'c', 'd'};");
Expected Results
I expect memory usage to remain constant as mongosh is executing commands.
Actual Results
Memory usage increases in a very obvious way as observed using top, followed by a JavaScript VM OOM and process exit.
Additional Notes
This seems to affect only syntax errors. If the script is syntactically valid but has other errors, e.g. a=no_such_variable, the memory usage remains constant.
If mongosh and mongod are sharing a bunch of codebase, is it possible that a similar leak also affects mongod?
- depends on
-
MONGOSH-1861 Possible memory leak on the async rewriter when working with invalid javascript
- Ready for Work