sidorares / sidorares/node-mysql2

FATAL ERROR JavaScript heap out of memory

Open
#646 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
4.4k
Forks
680
Avg merge
9h 7m
Merged PRs (30d)
59

Description

I have a query that returns more than 300 thousand records in a table. My code is Dump.ts.
After executing this query, the process memory collapses,
I tried to fix it with the flags:

--max_old_space_size=6000 --optimize_for_size --max_executable_size=6000 --stack_size=6000 --trace-gc

The full error is:

<--- Last few GCs --->

[7600:000000949173C4B0]   107414 ms: Mark-sweep 1415.4 (1500.7) -> 1415.4 (1500.7) MB, 2778.0 / 0.0 ms  allocation failure scavenge might not succeed
[7600:000000949173C4B0]   110134 ms: Mark-sweep 1415.4 (1500.7) -> 1415.4 (1484.7) MB, 2719.0 / 0.0 ms  last resort
[7600:000000949173C4B0]   112782 ms: Mark-sweep 1415.4 (1484.7) -> 1415.4 (1484.7) MB, 2646.0 / 0.0 ms  last resort


<--- JS stacktrace --->

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

Security context: 000001A98441CEA9 <JSObject>
    0: builtin exit frame: stringify(this=000001A98442E2F9 <JSON map = 000003E13070EC79>,000001A984402241 <undefined>,000001A984402241 <undefined>,000002E8C122AD49 <JSArr
ay[1269410]>)

    1: arguments adaptor frame: 1->3
    2: normalizeObject [C:\Users\jul.mora\Documents\GitHub\Dump\dist\dump.js:~324] [pc=0000034FD8D4050C](this=0000030E7F424F49 <Dump map = 0000004357D8E121>,objMysql=0000
02E8...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
error Command failed with exit code 3.

thanks

Contributor guide

Open the contributing guide

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.

Research direction

Start with the linked src/dump.ts line 176 and package.json line 9, then trace how the 300,000-record query is handled by the client. Reproduce the heap failure and determine whether it belongs to node-mysql2 or the linked application; done means a verified fix or a clearly documented limitation.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.