Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Heap OOM in utils.quote regex test

Open
#237 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
javascript, node.js
Domain
backend

Research direction

Start at lib/utils.js:124, where quote invokes the regex test shown in the stack trace, and compare its behavior with the reported 198,024,197-character string. Done requires identifying and verifying a fix or documented workaround for the heap OOM, but the issue provides no reproduction procedure or test.

Written by the indexing model from the issue text.

Description

I have a meteor web app that uses sockjs under the hood. Occasionally, I see this OOM issue, and it always points to the same line of code.

Is there something I can do to workaround this.

<--- Last few GCs --->

[198:0x27e6e00]   786430 ms: Mark-sweep 1207.1 (1399.4) -> 1207.0 (1402.9) MB, 1438.7 / 0.0 ms  allocation failure GC in old space requested
[198:0x27e6e00]   787804 ms: Mark-sweep 1207.0 (1402.9) -> 1206.9 (1347.9) MB, 1374.4 / 0.0 ms  last resort GC in old space requested
[198:0x27e6e00]   789262 ms: Mark-sweep 1206.9 (1347.9) -> 1206.9 (1324.4) MB, 1457.5 / 0.0 ms  last resort GC in old space requested

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x2576aed25ee1 <JSObject>
    1: test(this=0x16002e479b91 <JSRegExp <String[76]: [\x00-\x1f\ud800-\udfff\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufff0-\uffff]>>,0x181100c0a539 <Very long string[198024197]>)
    3: quote [/opt/app/programs/server/npm/node_modules/meteor/ddp-server/node_modules/sockjs/lib/utils.js:124] [bytecode=0x14f91990c5d1 offset=38](this=0x2d252d7d299 <Object map = 0x39f53b37fb39>,string=0x34b16cc30311...

 1: node::Abort() [node]
 2: 0x121a7ac [node]
 3: v8::Utils::ReportOOMFailure(char const*, bool) [node]
 4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [node]
 5: v8::internal::Factory::NewRawTwoByteString(int, v8::internal::PretenureFlag) [node]
 6: v8::internal::String::SlowFlatten(v8::internal::Handle<v8::internal::ConsString>, v8::internal::PretenureFlag) [node]
 7: v8::internal::RegExpImpl::IrregexpExec(v8::internal::Handle<v8::internal::JSRegExp>, v8::internal::Handle<v8::internal::String>, int, v8::internal::Handle<v8::internal::RegExpMatchInfo>) [node]
 8: v8::internal::RegExpImpl::Exec(v8::internal::Handle<v8::internal::JSRegExp>, v8::internal::Handle<v8::internal::String>, int, v8::internal::Handle<v8::internal::RegExpMatchInfo>) [node]
 9: v8::internal::Runtime_RegExpExec(int, v8::internal::Object**, v8::internal::Isolate*) [node]
10: 0x356b0570463d
Dominant language
JavaScript
Stars
2.1k
Forks
306
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from sockjs/sockjs-node

All issues in sockjs/sockjs-node

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.