You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tracking issue: support of builtins and V8 issues in run-time user-land snapshots #44014
This issue is opened to track known bugs and limitations of the run-time user-land snapshot.
Currently known limitations/bugs in Node.js builtins:
Support modules that generate system requests e.g. net, http (without supporting the snapshotting of those requests, which we can't resurrect. But user should be able to snapshot the application after all pending requests are completed).
Certain global event listeners on the process object need to be removed during snapshot serialization, and re-installed during deserialization
Hey, big thanks for work. I've checkout #38905 and applied https://bugs.chromium.org/p/v8/issues/detail?id=12921 patch on top of it.
Generally it works good, but I found another segfault.
It seems like it's related to GC.
I've reproduced it two times.
50 mb bundle, snapshot created, restored, segfault on running function which fs.readFileSync(this50mbFile, 'utf8')
➜ snapshot git:(master) ✗ lldb -- /home/badim/github/node/out/Debug/node --snapshot-blob snapshot.blob script.js
(lldb) target create "/home/badim/github/node/out/Debug/node"
runCurrent executable set to '/home/badim/github/node/out/Debug/node' (x86_64).
(lldb) settings set -- target.run-args "--snapshot-blob" "snapshot.blob" "script.js"
(lldb) run
Process 59768 launched: '/home/badim/github/node/out/Debug/node' (x86_64)
Process 59768 stopped
* thread #6, name = 'node', stop reason = signal SIGSEGV: invalid address (fault address: 0x559b20665e50)
frame #0: 0x0000555556e59c40 node`v8::internal::JSArrayBuffer::MarkExtension() [inlined] std::__atomic_base<bool>::store(__m=memory_order_relaxed, __i=true, this=0x0000559b20665e50) at atomic_base.h:404:18
401 __glibcxx_assert(__b != memory_order_acq_rel);
402 __glibcxx_assert(__b != memory_order_consume);
403
-> 404 __atomic_store_n(&_M_i, __i, int(__m));
405 }
406
407 _GLIBCXX_ALWAYS_INLINE void
(lldb) bt
* thread #6, name = 'node', stop reason = signal SIGSEGV: invalid address (fault address: 0x559b20665e50)
* frame #0: 0x0000555556e59c40 node`v8::internal::JSArrayBuffer::MarkExtension() [inlined] std::__atomic_base<bool>::store(__m=memory_order_relaxed, __i=true, this=0x0000559b20665e50) at atomic_base.h:404:18
frame #1: 0x0000555556e59c40 node`v8::internal::JSArrayBuffer::MarkExtension() [inlined] std::atomic<bool>::store(__m=memory_order_relaxed, __i=true, this=0x0000559b20665e50) at atomic:104
frame #2: 0x0000555556e59c40 node`v8::internal::JSArrayBuffer::MarkExtension() [inlined] v8::internal::ArrayBufferExtension::Mark(this=0x0000559b20665e50) at js-array-buffer.h:182
frame #3: 0x0000555556e59c40 node`v8::internal::JSArrayBuffer::MarkExtension(this=0x00007ffff5a9d930) at js-array-buffer.cc:202
frame #4: 0x0000555556b22b17 node`v8::internal::HeapVisitor<int, v8::internal::ConcurrentMarkingVisitor>::Visit(v8::internal::Map, v8::internal::HeapObject) [inlined] v8::internal::MarkingVisitorBase<v8::internal::ConcurrentMarkingVisitor, v8::internal::ConcurrentMarkingState>::VisitJSArrayBuffer(object=JSArrayBuffer @ 0x00007ffff5a9d930, map=<unavailable>, this=0x00007ffff5a9dc40) at marking-visitor-inl.h:321:23
frame #5: 0x0000555556b22b08 node`v8::internal::HeapVisitor<int, v8::internal::ConcurrentMarkingVisitor>::Visit(this=0x00007ffff5a9dc40, map=Map @ rbp, object=<unavailable>) at objects-visiting-inl.h:64
frame #6: 0x0000555556b2519a node`v8::internal::ConcurrentMarking::Run(this=0x000055555b85e560, delegate=<unavailable>, code_flush_mode=<unavailable>, mark_compact_epoch=<unavailable>, should_keep_ages_unchanged=<unavailable>) at concurrent-marking.cc:536:46
frame #7: 0x0000555556b25cf1 node`v8::internal::ConcurrentMarking::JobTask::Run(this=0x000055555edad1c0, delegate=0x00007ffff5a9ed70) at concurrent-marking.cc:425:31
frame #8: 0x0000555557b974e8 node`v8::platform::DefaultJobWorker::Run(this=0x000055555edad250) at default-job.h:147:21
frame #9: 0x0000555556616f22 node`node::(anonymous namespace)::PlatformWorkerThread(data=0x000055555b4394f0) at node_platform.cc:43:14
frame #10: 0x00007ffff7c76ea7 libpthread.so.0`start_thread + 215
frame #11: 0x00007ffff7ba6def libc.so.6`__clone + 63
(lldb)
It looks like it starting GC snapshotted objects and there is a null pointer or smth. --max-old-space-size=12000 --max-semi-space-size=10000 didn't helped.
Maybe I need to compile node with GC disabled to check if it's 100% GC.
Ping me If I can help with debugging.
@goloveychuk Thanks for the report, this is just a guess but can you try it with https://chromium-review.googlesource.com/c/v8/v8/+/3793525 ? If it shows up again, can you try building Node.js with the --v8-non-optimized-debug configure option and see if you can have a more detailed stack trace?
No, that error is "bus error", which was 30% error rate. I'm not able to reproduce that in current node master. We can ignore that, I think.
This error I'm able to reproduce 100% of time
// Remove global event listeners on the process object during snapshot serialization
const listeners = process.listeners('uncaughtException');
process.removeAllListeners('uncaughtException');
// Take a snapshot of the application
const snapshot = process.binding('v8').createSnapshot();
// Reinstall global event listeners on the process object during deserialization
listeners.forEach(listener => {
process.on('uncaughtException', listener);
});
// Restore the application from the snapshot
process.binding('v8').setFlagsFromString('--no-wasm-tier-up');
process.binding('v8').setSnapshot(snapshot);
I just want to voice my enthusiasm for supporting user-land modules in snapshots, after today I found out postcss-preset-env takes 210 ms to require() 😅
Reacted by Mads Overgård Henningsen, Steffen Neubauer, Steven and Alejandro Fernández Haro
This issue has been marked as stale due to 210 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.
This issue has been automatically closed after 30 days of inactivity following its stale status (no activity for a total of 120 days).
If this is still relevant, feel free to reopen it or leave a comment with additional details so we can continue the discussion.
Activity
goloveychuk commentedon Jul 29, 2022
Hey, big thanks for work. I've checkout #38905 and applied https://bugs.chromium.org/p/v8/issues/detail?id=12921 patch on top of it.
Generally it works good, but I found another segfault.
It seems like it's related to GC.
I've reproduced it two times.
fs.readFileSync(this50mbFile, 'utf8')node --snapshot-blob).LLDB logs
It looks like it starting GC snapshotted objects and there is a null pointer or smth.
--max-old-space-size=12000 --max-semi-space-size=10000didn't helped.Maybe I need to compile node with GC disabled to check if it's 100% GC.
Ping me If I can help with debugging.
joyeecheung commentedon Jul 29, 2022
@goloveychuk Thanks for the report, this is just a guess but can you try it with https://chromium-review.googlesource.com/c/v8/v8/+/3793525 ? If it shows up again, can you try building Node.js with the
--v8-non-optimized-debugconfigure option and see if you can have a more detailed stack trace?goloveychuk commentedon Jul 29, 2022
applied patch, built, run, segfault.
Invalid
v8heapconstcould not cause this bug, right? Because I cannot generate it... :)goloveychuk commentedon Jul 30, 2022
@joyeecheung took 30 mins to generate snapshot :)
lldb for --v8-non-optimized-debug
joyeecheung commentedon Aug 2, 2022
@goloveychuk Thanks for the follow-up. Is the code causing this error related to #40832 (comment) by any chance?
goloveychuk commentedon Aug 2, 2022
No, that error is "bus error", which was 30% error rate. I'm not able to reproduce that in current node master. We can ignore that, I think.
This error I'm able to reproduce 100% of time
joyeecheung commentedon Aug 11, 2022
@goloveychuk This looks like a duplicate of https://bugs.chromium.org/p/v8/issues/detail?id=13149 - can you try building with https://chromium-review.googlesource.com/c/v8/v8/+/3813068 and see if the crash goes away?
src: support WeakReference in snapshot
src: support diagnostics channel in the snapshot
vm: make ContextifyContext template context-independent
vm: include vm context in the embedded snapshot
vm: avoid unnecessary property getter interceptor calls
src: support WeakReference in snapshot
src: support diagnostics channel in the snapshot
3 remaining items
src: support WeakReference in snapshot
src: support WeakReference in snapshot
src: support WeakReference in snapshot
src: support WeakReference in snapshot
ManojKumar-1204 commentedon Mar 8, 2023
// Remove global event listeners on the process object during snapshot serialization
const listeners = process.listeners('uncaughtException');
process.removeAllListeners('uncaughtException');
// Take a snapshot of the application
const snapshot = process.binding('v8').createSnapshot();
// Reinstall global event listeners on the process object during deserialization
listeners.forEach(listener => {
process.on('uncaughtException', listener);
});
// Restore the application from the snapshot
process.binding('v8').setFlagsFromString('--no-wasm-tier-up');
process.binding('v8').setSnapshot(snapshot);
JoshuaWise commentedon Apr 28, 2023
I just want to voice my enthusiasm for supporting user-land modules in snapshots, after today I found out
postcss-preset-envtakes 210 ms torequire()😅github-actions commentedon Jun 25, 2026
This issue has been marked as stale due to 210 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.
github-actions commentedon Jul 26, 2026
This issue has been automatically closed after 30 days of inactivity following its stale status (no activity for a total of 120 days).
If this is still relevant, feel free to reopen it or leave a comment with additional details so we can continue the discussion.