Release builds abort the process when an internal native assert fails
Maintainers usually reply within 1 day
Assessment
This issue has not been assessed yet.
Description
Problem
The native binding has seven bare assert() calls, and binding.gyp's Release configuration never defines NDEBUG, so all of them are compiled into the release builds we publish. Their message strings are present in the published @harperfast/[email protected] binary.
If one fires, assert() calls abort(): the host process (Node, Harper) dies with SIGABRT. There is no JS error, no log line from our code, and no chance to recover. Each condition is an internal invariant, not something a caller can provoke, and none has been observed firing, but a broken invariant in any of them takes down the whole process rather than the one operation.
Site (as of 043141a1) |
Condition | What a violation actually means |
|---|---|---|
napi/async.h:45 |
asyncWork == nullptr in ~BaseAsyncState |
the async work leaks |
transaction/transaction.cpp:778 |
Committing → Committed transition succeeded |
close() aborted the handle concurrently; the RocksDB commit itself succeeded |
transaction/transaction_handle.cpp:347, :449 |
iterator registered once | benign |
transaction/transaction_handle.cpp:363, :530 |
activeIteratorCount did not underflow |
the uint32_t wraps and the orphan close never runs |
transaction/transaction_handle.h:65 |
InlineVector::back() on a non-empty vector |
an out-of-bounds read |
Only the last one cannot safely continue; the rest are better reported and survived than turned into a process abort.
Proposed fix
- A Node-free
ROCKSDB_JS_ASSERT(condition, message)insrc/binding/core/. It is fatal (report, thenstd::abort()) inDEBUGbuilds and when a newROCKSDB_JS_FATAL_ASSERTSdefine is set. Otherwise it writes one warning line to stderr per call site and continues. It isnoexcept, takes no locks, and makes no N-API orgetenvcalls, because it runs on RocksDB, commit and libuv threads and in destructors. - Replace every bare
assert(). MakeInlineVector's empty read impossible rather than asserted. - Set
ROCKSDB_JS_FATAL_ASSERTSin the PR test workflow so CI still fails loudly, and keep it out of the publish workflow that builds the shipped prebuilds. - Document the rule in AGENTS.md and add a check that rejects a new bare
assert(insrc/binding.
🤖 Generated by Claude Code (Claude Opus 5.5); posted via @cb1kenobi.
- Dominant language
- C++
- Stars
- 24
- Forks
- 3
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 94
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from HarperFast/rocksdb-js
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
HarperFast/rocksdb-js#1118 ·
Maintainers usually reply within 1 day
-
CLI crashes with ENOTCONN instead of exiting 0 when stdout closes on macOSPossibly taken @cb1kenobi claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
HarperFast/rocksdb-js#1112 ·
Maintainers usually reply within 1 day
-
A durable commit is reported as failed when aftercommit hits a database closed after the commitOpen
Difficulty 4/5 3-5 days Newbie friendliness 48/100
HarperFast/rocksdb-js#1117 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 4/5 1-2 days Newbie friendliness 38/100
HarperFast/rocksdb-js#1114 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 30/100
HarperFast/rocksdb-js#1111 ·
Maintainers usually reply within 1 day
All issues in HarperFast/rocksdb-js
Similar issues
-
bug triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
26.04 bug dark-mode Easy Hack impress symptom: visual
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
CollaboraOnline/online#16421 · 1 comment ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
telegramdesktop/tdesktop#31653 ·
Maintainers usually reply within 1 day
-
area/cs bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
ydb-platform/ydb#59881 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day