Repository navigation
ci(e2e): surface native worker crashes and isolate migration test cleanup - #14120
Conversation
A native crash in a long-running appwrite process (heap corruption or a segfault in the combined worker) never failed a job by itself. Swoole respawned the child and the only symptom was a test timing out on a migration stuck in processing, with the cause buried in a container log that is only dumped on failure (inv-mig-1). Grep the logs of the services built from the appwrite image after every E2E run and fail with the matching lines, so these crashes surface even when the tests happen to pass. Third-party images (executor, browser, assistant, databases) are left out so their logs cannot fail the job. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The overwrite and skip migration tests deleted their source and destination databases and reset the shared table cache only as their last statements. When one failed (a migration left in processing by a crashed worker), the next tests reused the cached database and table and failed on leftovers, turning one failure into nine. Each test now registers its database and tearDown deletes it from both projects and resets the shared caches, whether the test passed or not. Tests that do not register a database keep sharing the cache as before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
🟢 Tier S · Ready to merge
Adds native-crash scanning after all E2E job types, restricted to services using the Appwrite image, and logs abnormal Swoole worker exits. Migration fixtures now use fresh databases registered during setup and cleaned up from both projects in teardown. Restart tests verify abnormal-exit diagnostics and that clean retirement and shutdown stay quiet. Latest changes: The latest commits explicitly report log-retrieval failures, add worker diagnostic assertions, and remove migration fixture caches while moving cleanup registration into database setup.
📂 Walkthrough · 6
✅ Fixed since the last review · 2
Reviewed the commits since |
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
The supervisor reaped a dead worker and respawned it without a word, so a worker killed by a signal or exiting non-zero left no trace in the container log. One of the three native crashes of the combined appwrite worker on #11649 printed nothing at all, and the only symptom was a migration stuck in processing. Log the worker id, signal and exit code when a worker dies while the supervisor is not stopping, so the CI crash scan and operators can see it. Exits during shutdown, including the SIGKILL after the drain deadline, stay quiet because they are expected. The wait result is narrowed before use since the package's Swoole stubs leave it untyped, which also retires two baseline entries. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The crash scan exited 0 when no service matched the appwrite image, and masked failures of docker compose config and logs, so a renamed image or a broken compose call would silently disable it. Move the step into one script shared by the three E2E jobs that runs under errexit and pipefail, prints the services it scans, errors when none match, and treats a grep failure as an error rather than a clean result. The pattern gains word boundaries so signal=110 or exit code 1390 cannot match, and it now matches the supervisor's abnormal worker exit line so crashes that print nothing else are caught. Co-Authored-By: Claude Opus 5.5 <[email protected]>
tearDown asserted on each delete as it went, so the first unexpected status aborted the loop before the tracked ids and the shared database and table caches were reset, and the next test reused a poisoned cache. It now snapshots and clears that state first, deletes in both projects collecting every failure, asserts once at the end, and always hands over to the parent tearDown so the client is released. The database, table and row migration tests still deleted their databases as their last statements and so leaked them, and the cache entries pointing at them, whenever an earlier assertion failed. They and the two source key tests now register their databases with trackDatabase and leave the cleanup to tearDown, which reuses the existing per-database delete helper. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The abnormal worker exit line is also logged for a worker that exits with a non-zero code and no signal, such as a PHP fatal error (code 255). Those are not native crashes, and matching them would fail E2E on main for ordinary worker errors. Match the line only when a signal killed the worker; the log line itself still records both cases for diagnosis. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The supervisor now logs a worker that dies outside shutdown, which is what lets the E2E crash scan see a native crash that prints nothing else. Pin that in the restart harness, which already captures the supervisor's stderr: a SIGKILLed worker and a worker killed by a fatal error must each add exactly one line with the worker id, signal and exit code, a worker that retires cleanly must add none, and a drain on SIGTERM or SIGINT must log no abnormal exit at all. The kill case fails against the supervisor before the logging change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Tests registered the database from setupMigrationTable only after it returned, so when table setup failed, for example on the column wait while the databases worker was down, the database it had just created and cached was never deleted and later unscoped migrations picked it up. setupMigrationDatabase now registers the database the moment it exists, and the per-test registrations it makes redundant are gone. With every database these helpers create deleted in tearDown, the static database and table caches could never outlive a test, so they are removed along with their resets: each call now creates fresh fixtures, and no test can see a database left by an earlier one. Co-Authored-By: Claude Opus 5.5 <[email protected]>
When docker compose logs failed, errexit ended the step with only a bare exit status, and the reason was lost in the captured output. Print what docker returned and an error annotation, so a failed scan says why it failed instead of looking like an unexplained step failure. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Brings in #14130 (route physical collection reads, schema checks, cache purges and transaction commits through the databases handle), #14120's merge commit, #14137 (VCS tag globs) and #14139 (project SMTP failures finish the mail job). Conflicts were resolved by keeping the database 8.0 forms the train already uses (ColumnType cases, Capability checks via supports(), Attribute::fromArray for checkAttribute, supportsSpatial/ supportsRelationships helpers) while taking main's databases-handle routing, so dedicated databases get their own adapter's capabilities and schema. The spatial capability check moves after the database lookup because it now needs that database's adapter. Documents Create/Update keep the train's RelationshipValues, which already reads stored related documents through the databases handle; main's inline permission walk is superseded by it. Transactions increment/decrement now build their Counter from the databases handle, since main renamed the handler parameter and the counted collection's schema lives on that handle. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Why
A native crash in a long-running appwrite process (for example
zend_mm_heap corruptedin the combined worker) never failed a CI job by itself. Swoole respawns the child, so the only symptom is a test timing out on a migration left inprocessing, and the cause sits in container logs that are only dumped on failure.On top of that, the overwrite/skip migration tests deleted their databases and reset the shared table cache only as their last statements. One stuck migration therefore left a database behind that the following tests reused, turning one failure into nine.
What
Check for native crashesstep after the tests. It greps the logs of the services built from the appwrite image forzend_mm_heap,Segmentation fault,core dumped,signal 6/7/11andexit code 139, prints only the matching lines and fails the job. Third-party containers (executor, browser, assistant, databases) are not scanned.tearDowndeletes it from the source and destination projects (204 or 404) and resets the shared database/table caches. Tests that register nothing keep sharing the cache as before.Test plan
🤖 Generated with Claude Code