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
fix: use-after-free crash at process exit from per-instance cleanup hooks
Every VideoDecoderAsync/VideoEncoderAsync constructor registered an env
cleanup hook whose argument pointed at a member of the instance, and the
destructor never removed it. Any instance GC'd during the process's
lifetime left a dangling hook; at exit, RunCleanup() executed it,
writing through freed memory — which by then was often reused by node's
own CleanupQueue hash table, corrupting it so the next ThreadSafeFunction
destructor's RemoveEnvironmentCleanupHook crashed (confirmed via crash
report: SIGSEGV in CleanupHookCallback hash find during RunCleanup).
Replace the per-instance hooks with one addon-level flag registered once
in Init. Also pin the JS wrapper (Ref/Unref) while jobs are in flight so
queued job-done callbacks, which capture this, can never outlive the
instance; Close() balances the pin.
Repro (construct/encode/drop 120 encoders without close, GC, exit)
crashed ~5% of runs on main; 0/60 after the fix. This is the likely
root cause of the ubuntu CI flake since v1.2.0 and the FFmpeg-7.x
static-build exit aborts.
Claude-Session: https://claude.ai/code/session_01QCBuz9ekP3aosHS34QaAqK
Copy file name to clipboardExpand all lines: CHANGELOG.md
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,10 @@
1
1
# Changelog
2
2
3
+
## [1.3.1] - 2026-07-18
4
+
5
+
### Fixed
6
+
- Intermittent crash at process exit (SIGSEGV/SIGABRT during teardown). Each codec instance registered an env cleanup hook pointing into itself and never removed it; instances collected during the process's lifetime left dangling hooks that corrupted Node's cleanup queue when run at exit. One process-level flag now serves all instances, and codec objects are pinned while work is in flight so queued completion callbacks can never outlive them. Also the likely cause of the ubuntu CI flake since v1.2.0 and the FFmpeg-7.x static-build aborts.
0 commit comments