General Computing
google-chrome javascript debug wordpress
Updated Sat, 01 Oct 2022 10:54:20 GMT

Object reached heap limit - debugging a Javascript SIGILL error on Chrome?


When i run my js script for my plugin in Wordpress. The page freezes, times out and returns a SIGILL error. I can't see any errors in web dev tools, the page just freezes.

I installed minidump_stackwalk using cargo.

sudo apt install cargo
cargo install minidump-stackwalk

Then I ran Chrome in debug mode,

google-chrome --enable-logging --v=1

and I ran the Crash Report through minidump_stackwalk to interpret the dump files. It gives me the chrome library stack trace which is not useful.

minidump_stackwalk ~/.config/google-chrome/'Crash Reports'/07*.dmp

The chrome debug log that I get when i run this bash command (on linux) is a little more useful.

tail -n 100 ~/.config/google-chrome/chrome_debug.log

This is the output from my chrome debug log.

[140960:1:0721/122133.762869:ERROR:v8_initializer.cc(688)] V8 javascript OOM: (Reached heap limit).
[133755:134289:0721/122133.997566:VERBOSE1:bus.cc(708)] Requested to remove an unknown filter function: 1 with associated data: 0x34740a187720
[133755:134289:0721/122133.997588:VERBOSE1:bus.cc(708)] Requested to remove an unknown filter function: 1 with associated data: 0x34740a186ca0
[133755:134289:0721/122133.997593:VERBOSE1:bus.cc(708)] Requested to remove an unknown filter function: 1 with associated data: 0x3474091aff00
[133755:134289:0721/122133.997597:VERBOSE1:bus.cc(708)] Requested to remove an unknown filter function: 1 with associated data: 0x347409b3e760
[133755:134289:0721/122133.997601:VERBOSE1:bus.cc(708)] Requested to remove an unknown filter function: 1 with associated data: 0x34740a186f40
[133755:134289:0721/122133.997605:VERBOSE1:bus.cc(708)] Requested to remove an unknown filter function: 1 with associated data: 0x347409b3e4c0
[133755:134289:0721/122133.997609:VERBOSE1:bus.cc(708)] Requested to remove an unknown filter function: 1 with associated data: 0x34740a186e60
[133755:134289:0721/122133.997613:VERBOSE1:bus.cc(708)] Requested to remove an unknown filter function: 1 with associated data: 0x3474078d6a00
[133755:134289:0721/122133.997617:VERBOSE1:bus.cc(708)] Requested to remove an unknown filter function: 1 with associated data: 0x34740a1865a0
[133755:134289:0721/122133.997621:VERBOSE1:bus.cc(708)] Requested to remove an unknown filter function: 1 with associated data: 0x34740a185f80
[133755:134289:0721/122133.997840:VERBOSE1:bus.cc(708)] Requested to remove an unknown filter function: 1 with associated data: 0x347409b3ee60
[133755:134289:0721/122133.997850:VERBOSE1:bus.cc(708)] Requested to remove an unknown filter function: 1 with associated data: 0x347409b3ebc0
[133755:133755:0721/122133.999826:INFO:render_frame_host_impl.cc(11505)] RenderFrameHostImpl::MaybeGenerateCrashReport url = https://staging.rebelcitytour.com/test-maps/, status = 3, exit_code = 132

It looks like a JS object is seg-faulting or running out of memory. Possibly it's an infinite for loop.

Problem is though, i've no idea which JS object to look at. Like I stated, chrome web dev tools is crashing along with the web page. All i get is a SIGILL error and the crash report.

I've tried debugging the code block by block, but the behaviour seems kinda erratic. Sometime it'll work with code commented out, sometimes it won't. I've cleared the cache everytime.

Can anyone help?




Solution

Assuming it's not an infinite loop, try increasing JavaScript heap size to allow deeper debugging. See also this V8 article on heap size, and this, in StackOverflow.