当我在 Wordpress 中为我的插件运行我的 js 脚本时。页面冻结、超时并返回 SIGILL 错误。我在 web 开发工具中看不到任何错误,页面只是冻结。
我使用货物安装了 minidump_stackwalk。
sudo apt install cargo
cargo install minidump-stackwalk
然后我在调试模式下运行 Chrome,
google-chrome --enable-logging --v=1
我通过 minidump_stackwalk 运行崩溃报告来解释转储文件。它给了我没有用的 chrome 库堆栈跟踪。
minidump_stackwalk ~/.config/google-chrome/'Crash Reports'/07*.dmp
当我运行这个 bash 命令(在 linux 上)时,我得到的 chrome 调试日志更有用一些。
tail -n 100 ~/.config/google-chrome/chrome_debug.log
这是我的 chrome 调试日志的输出。
[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
看起来 JS 对象出现段错误或内存不足。可能是无限循环。
问题是,我不知道要看哪个 JS 对象。就像我说的,chrome web 开发工具与网页一起崩溃。我得到的只是一个 SIGILL 错误和崩溃报告。
我试过逐块调试代码,但行为似乎有点不稳定。有时它会与注释掉的代码一起工作,有时则不会。我每次都清除缓存。
任何人都可以帮忙吗?
假设它不是无限循环,请尝试增加 JavaScript 堆大小以进行更深入的调试。另请参阅有关堆大小的 V8 文章,以及StackOverflow 中的这篇文章。