Skip to content

Use ImmediateExit for db_stress MANIFEST verification failures - #15575

Closed
pdillinger wants to merge 1 commit into
meta:mainfrom
pdillinger:export-D129421184
Closed

pdillinger wants to merge 1 commit into
meta:mainfrom
pdillinger:export-D129421184

Conversation

@pdillinger

Copy link
Copy Markdown
Contributor

Summary:
Why: when db_stress's MANIFEST-avoidance check fails on reopen, the crash test can report a misleading Assertion 'property_info != nullptr' failed in DBImpl::DumpStats() instead of the real failure. T287969622 collected four such hits (Sep 9 to Nov 1). Each started with a FATAL: MANIFEST file grew by N bytes ... or FATAL: MANIFEST file was recreated ... line from StressTest::VerifyManifestNotRewritten(). The task title, and the signature the automation groups by, came from the secondary assert. When the race does not happen, the same failure is filed under its own title instead (for example T288683405).

Previous behavior: StressTest::Reopen() calls VerifyManifestNotRewritten() right after Open(), so the DB is open with live background threads, including the stats-dump Timer. The three STRICT-mode failure paths in that function (MANIFEST recreated, MANIFEST grew, CURRENT updated) called exit(1). exit() runs static destructors. If the stats timer fires during that teardown, DBImpl::DumpStats() looks up a DB property in an already-destroyed static map and asserts, so the process aborts with signal 6. The Sep 9 analysis on T287969622 identified this race.

New behavior: those three paths call port::ImmediateExit(1), which wraps _exit(). The process prints the same FATAL message on stderr and exits with code 1 without running static destructors, so the stats timer can no longer turn it into a DumpStats assert. The crash test now reports the real failure.

Implementation: replace exit(1) with port::ImmediateExit(1) at the three STRICT-mode failure sites in VerifyManifestNotRewritten(). D108298839 added port::ImmediateExit() for this kind of failure: an exit after DB open with background threads running. Other post-open db_stress exits already use it (FinishInitDb(), TrackExpectedState() and the open-error paths in Open()).

Safety and limitations: db_stress only; no engine, API or format change. The remaining exit(1) calls in db_stress_test_base.cc are option-validation paths that run before the DB is opened, so they are left alone. _exit() skips flushing stdio buffers, so any buffered stdout from that run can be lost. The FATAL text goes to unbuffered stderr, as with the existing ImmediateExit sites. This does not fix the MANIFEST-avoidance failures themselves. T287969622 tracks those: one is fixed by D127204400, one (leftover async_wal_precreate WAL) still looks open, and the "MANIFEST recreated" variant is unexplained.

Requested by: Peter Dillinger (peterd)

Differential Revision: D129421184

Summary:
**Why:** when db_stress's MANIFEST-avoidance check fails on reopen, the crash test can report a misleading `Assertion 'property_info != nullptr' failed` in `DBImpl::DumpStats()` instead of the real failure. T287969622 collected four such hits (Sep 9 to Nov 1). Each started with a `FATAL: MANIFEST file grew by N bytes ...` or `FATAL: MANIFEST file was recreated ...` line from `StressTest::VerifyManifestNotRewritten()`. The task title, and the signature the automation groups by, came from the secondary assert. When the race does not happen, the same failure is filed under its own title instead (for example T288683405).

**Previous behavior:** `StressTest::Reopen()` calls `VerifyManifestNotRewritten()` right after `Open()`, so the DB is open with live background threads, including the stats-dump `Timer`. The three STRICT-mode failure paths in that function (MANIFEST recreated, MANIFEST grew, CURRENT updated) called `exit(1)`. `exit()` runs static destructors. If the stats timer fires during that teardown, `DBImpl::DumpStats()` looks up a DB property in an already-destroyed static map and asserts, so the process aborts with signal 6. The Sep 9 analysis on T287969622 identified this race.

**New behavior:** those three paths call `port::ImmediateExit(1)`, which wraps `_exit()`. The process prints the same FATAL message on stderr and exits with code 1 without running static destructors, so the stats timer can no longer turn it into a `DumpStats` assert. The crash test now reports the real failure.

**Implementation:** replace `exit(1)` with `port::ImmediateExit(1)` at the three STRICT-mode failure sites in `VerifyManifestNotRewritten()`. D108298839 added `port::ImmediateExit()` for this kind of failure: an exit after DB open with background threads running. Other post-open db_stress exits already use it (`FinishInitDb()`, `TrackExpectedState()` and the open-error paths in `Open()`).

**Safety and limitations:** db_stress only; no engine, API or format change. The remaining `exit(1)` calls in `db_stress_test_base.cc` are option-validation paths that run before the DB is opened, so they are left alone. `_exit()` skips flushing stdio buffers, so any buffered stdout from that run can be lost. The FATAL text goes to unbuffered stderr, as with the existing `ImmediateExit` sites. This does not fix the MANIFEST-avoidance failures themselves. T287969622 tracks those: one is fixed by D127204400, one (leftover `async_wal_precreate` WAL) still looks open, and the "MANIFEST recreated" variant is unexplained.

Requested by: Peter Dillinger (peterd)

Differential Revision: D129421184
@meta-cla meta-cla Bot added the CLA Signed label Nov 3, 2026
@meta-codesync

meta-codesync Bot commented Nov 3, 2026

Copy link
Copy Markdown

@pdillinger has exported this pull request. If you are a Meta employee, you can view the originating Diff in D129421184.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

✅ clang-tidy: No findings on changed lines

Completed in 113.9s.

@meta-codesync meta-codesync Bot closed this in e157424 Nov 3, 2026
@meta-codesync meta-codesync Bot added the Merged label Nov 3, 2026
@meta-codesync

meta-codesync Bot commented Nov 3, 2026

Copy link
Copy Markdown

This pull request has been merged in e157424.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant