Skip to content

child process : unexpected exit code when process is out of memory #12271

Closed
@abenhamdine

Description

[edit by @refack]
suggested fix #12271 (comment)
[end edit]

Version: 7.8.0
Platform: Windows 10 64
Subsystem: Child processes

I fork some child processes to do some intensive calculations.
Because I likely have some memory leaks, I pass the following arguments to the forked processes :

 execArgv: process.execArgv.concat(['--expose-gc', '--max-executable-size=192', '--max-old-space-size=256', '--max-semi-space-size=2'])

and as expected, the processes run out of memory after a given time, with the following error :

<--- Last few GCs --->

[13196:000001C7DD2B3520]   120623 ms: Mark-sweep 249.8 (275.1) -> 249.8 (275.1) MB, 367.6 / 0.2 ms  deserialize GC in old space requested
[13196:000001C7DD2B3520]   121001 ms: Mark-sweep 249.8 (275.1) -> 249.8 (275.1) MB, 376.2 / 0.4 ms  deserialize GC in old space requested
[13196:000001C7DD2B3520]   121428 ms: Mark-sweep 249.8 (275.1) -> 249.8 (275.1) MB, 426.4 / 0.4 ms  deserialize GC in old space requested


<--- JS stacktrace --->

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

Security context: 000001994CFA66A1 <JS Object>
    1: createContext [vm.js:~41] [pc=0000029DC91AFC50](this=00000344694A26E9 <an Object with map 0000015E4FEAACB9>,sandbox=00000164890109D1 <an Object with map 000002F68947DEB1>)
    2: createSandbox(aka createSandbox) [C:\node-projects\payroll-app\server\payrollEngine\PayrollEngine.js:~750] [pc=0000029DC91C93C4](this=000001C562102201 <null>,bul=000000F3E1CB4639 <an Object with map 000000BA66...

FATAL ERROR: deserialize context Allocation failed - process out of memory

DEBUG 17:02:28 : manageCalcProcess.onChildExit() : child process 13196 exited with code 3

What has surprised me is that the child process exits with a code 3.

Per docs, code 3 seems pretty vague, and not related to memory shortage.

I wonder if it's intentional, and if it would be more useful to have a specific exit code in that case.

Edit : Perhaps it's because of the vm.createContext() which mess the code ?

Metadata

Assignees

No one assigned

    Labels

    memoryIssues and PRs related to the memory management or memory footprint.processIssues and PRs related to the process subsystem.wipIssues and PRs that are still a work in progress.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions