GC stack trace

53 views
Skip to first unread message

Vinayaka Kamath

unread,
Dec 15, 2020, 3:56:40 AM12/15/20
to v8-users
Hello All,

The project that I am working on embeds v8 in it. One of the users reported seeing the following trace in the log files.


2020-12-01T04:48:31.912-08:00 [INFO] "Starting Function for:" "config::sfdc::accounts"
2020-12-01T04:48:31.912-08:00 [INFO] "Fetching list of:" "SFDC::accounts"
2020-12-01T04:48:31.950-08:00 [INFO] "Fetching SFDC Objects: " "accounts"
2020-12-01T04:54:27.535-08:00 [INFO] "Fetch SFDC (curl) response status:" 200 "/ #Objects:" 22179
2020-12-01T04:54:43.716-08:00 [INFO]
2020-12-01T04:54:43.716-08:00 [INFO] <--- Last few GCs --->
2020-12-01T04:54:43.716-08:00 [INFO]
2020-12-01T04:54:43.716-08:00 [INFO] [5463:0x7f2af005c020] 774469 ms: Mark-sweep 1110.6 (1264.9) -> 1110.6 (1210.4) MB, 497.6 / 0.0 ms (average mu = 0.778, current mu = 0.000) last resort GC in old space requested
2020-12-01T04:54:43.716-08:00 [INFO] [5463:0x7f2af005c020] 775228 ms: Mark-sweep 1110.6 (1210.4) -> 1110.6 (1196.9) MB, 758.3 / 0.0 ms (average mu = 0.616, current mu = 0.000) last resort GC in old space requested
2020-12-01T04:54:43.716-08:00 [INFO]
2020-12-01T04:54:43.716-08:00 [INFO]
2020-12-01T04:54:43.716-08:00 [INFO] <--- JS stacktrace --->
2020-12-01T04:54:43.716-08:00 [INFO]
2020-12-01T04:54:43.716-08:00 [INFO] ==== JS stack trace =========================================
2020-12-01T04:54:43.716-08:00 [INFO]
2020-12-01T04:54:43.716-08:00 [INFO] 0: ExitFrame [pc: 0x7f2b037168ae]
2020-12-01T04:54:43.716-08:00 [INFO] Security context: 0x32a0fa3096b9 <JSObject>
2020-12-01T04:54:43.716-08:00 [INFO] 1: FetchObjects_SFDC(aka FetchObjects_SFDC) [0x32a0fa30ea89] [Data_Ingestion.js:324] [bytecode=0x4ef5172bd09 offset=348](this=0x125eac5825a1 <undefined>,0x19c460402291 <Object map = 0x12664db89e61>)
2020-12-01T04:54:43.716-08:00 [INFO] 2: OnUpdate [0x32a0fa30e951] [Data_Ingestion.js:64] [bytecode=0x4ef5172b1e9 offset=281](this=0x32a0fa30fd81 <JSGlobal Object>,0x19c460402291 <Object map ...
2020-12-01T04:54:43.716-08:00 [INFO]

I do not have much information on what the user was trying to do here. Can someone elaborate on when do we generally see GC traces like these?

Thanks  

Ben Noordhuis

unread,
Dec 15, 2020, 6:40:32 AM12/15/20
to v8-users
The what is that V8 ran out of JS heap memory, the why I can't tell -
maybe FetchObjects_SFDC() allocates a lot, maybe there's a memory leak
in the JS code somewhere.

The default heap limit is approx. 1.4 GB on 64 bits systems. You can
change it with the --max_heap_size=<n> flag, where n is in megabytes.

There's also --max_old_space_size=<n>, that's an older flag mentioned
in many blog posts. It works pretty much the same.

Vinayaka Kamath

unread,
Dec 15, 2020, 7:29:36 AM12/15/20
to v8-users
Thanks a lot Ben, that was really helpful.

The project is using v8 engine embedded in the C++ code, is a build config or can I pass that setting as a parameter in the C++ code? 

Alex Kodat

unread,
Dec 15, 2020, 7:56:09 AM12/15/20
to v8-users
You can use SetFlagsFromString:

V8::SetFlagsFromString("--max_heap_size=4096");  // Pick your value

I didn't look but I would assume you need to do this before you create the Isolate.

There's also the Isolate AddNearHeapLimitCallback method but that's a bit more work to use.
Reply all
Reply to author
Forward
0 new messages