Closed Bug 2090907 Opened 19 days ago Closed 6 days ago

Mochitest run is reported as passing when the browser is killed mid-test without leaving a minidump (parent-process TSan aborts stay green)

Categories

(Testing :: Mochitest, defect)

defect

Tracking

(firefox163 fixed)

RESOLVED FIXED
163 Branch
Tracking Status
firefox163 --- fixed

People

(Reporter: benoit.goupilleau, Assigned: benoit.goupilleau, NeedInfo)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 external file)

Task XauHr1_HRhCSTehEwhcaPA (autoland, test-linux2404-64-tsan/opt-mochitest-browser-chrome-swr-10, rev 6438fbb6d4f6) is green on Treeherder although ThreadSanitizer aborted the parent process while browser/components/firefoxview/tests/browser/browser_syncedtabs_errors_firefoxview.js was running (the PK11_InitToken race of bug 2080357):

  • Firefox TSan builds run with halt_on_error=1:abort_on_error=1 (build/sanitizers/TsanOptions.cpp), so the parent died: TEST-INFO | Main app process: killed by SIGIOT.
  • TSan (and ASan) builds are configured with --disable-crashreporter, so there is no minidump and mozcrash.log_crashes finds nothing.
  • In testing/mochitest/runtests.py, runApp only reports a non-zero exit status of the main process through the minidump path. Bug 1631828 removed the TEST-UNEXPECTED-FAIL | <test> | application terminated with exit code N fallback, so a non-zero exit with no minidump, no zombie process and no --crash-as-pass emits nothing: the running test never gets a test_end and no error is logged. summary.jsonl has the test_start of the test and nothing else about it.
  • In runMochitests, the CI retry mode then continues with the tests that did not get to start, and result = self.doTests(...) overwrites the first run's non-zero status with the next run's 0, so the harness exits 0 and prints Failed: 0.

mozharness therefore sees no unexpected status, no crash action, no ERROR line and a zero return code, and the job is green. Only Treeherder's own log parser notices the SUMMARY: ThreadSanitizer line, which nobody looks at on a green job. ASan builds are only saved by ERROR: AddressSanitizer being in mozharness's harness error list, and content-process TSan aborts by the "A content process crashed" line; a parent-process abort in a TSan mochitest run (data race, MOZ_CRASH, any fatal signal) has been invisible since 2023.

The harness should treat a non-zero exit of the main process as a crash whether or not a minidump exists: a test_end with status CRASH for the running test, as the minidump path already does, an error line when no test was running, and the failing status must survive the continuation with the remaining tests.

Keeping the parsed tsan_error record in summary.jsonl is a separate Testing::Mozbase bug; the error summary group status is bug 2088064.

:jmaher, since you are the author of the regressor, bug 1631828, could you take a look? Also, could you set the severity field?

For more information, please visit BugBot documentation.

Flags: needinfo?(jmaher)

Since bug 1631828 a non-zero exit of the main process is only reported
through the minidump mozcrash finds. Sanitizer builds have no crash
reporter, so a ThreadSanitizer abort of the parent process left the
running test without a test_end and the run reported success; in CI the
continuation with the remaining tests then overwrote the failing status.

Report the exit as the minidump path does: a CRASH test_end for the
running test, an error line otherwise. The test_end is not marked
expected in retry mode, so the run fails like a crash with a minidump
instead of being retried.

Assignee: nobody → benoit.goupilleau
Status: NEW → ASSIGNED

Reproduced on try, before and after the fix, by running the firefoxview browser-chrome manifest on test-linux2404-64-tsan/opt-mochitest-browser-chrome with a try-only test added at the end of the manifest that calls nsIDebug2.abort() in the parent process. On a TSan build there is no crash reporter, so the abort goes through TSan's signal handler and kills the parent with SIGIOT, like the race does. The bug 2080357 race in PK11_InitToken also recurred during browser_syncedtabs_errors_firefoxview.js on both pushes, so each run exercised the exact scenario of the original job as well.

Original job (autoland, green):
https://treeherder.mozilla.org/jobs?repo=autoland&revision=6438fbb6d4f6dafdc86eca31b0ea7cd7f5881567&selectedTaskRun=XauHr1_HRhCSTehEwhcaPA.0
SUMMARY: ThreadSanitizer: data race ... in PK11_InitToken, then TEST-INFO | Main app process: killed by SIGIOT, no minidump, the harness restarted the browser on the remaining tests, Failed: 0, Return code: 0. summary.jsonl has the test_start of browser_syncedtabs_errors_firefoxview.js and no test_end.

Without the fix:
https://treeherder.mozilla.org/jobs?repo=try&revision=6306aa0973e4&selectedTaskRun=bjgwa9FaRoaFlRHDl0v2Ig.0
Same thing for the race: no test_end, no failure line, Failed: 0, group OK in errorsummary. This job still ended up orange, but only because the deliberate abort hit the last test of the manifest: the exit status of that last browser run was the harness return code (Return code: 1, setting return code to 2), with no test named anywhere. The retry loop in runMochitests overwrites the result of each run with the next one, so an abort anywhere else in the manifest is lost, as on autoland.

With D340925 (plus D340927 for the tsan_error records in summary.jsonl):
https://treeherder.mozilla.org/jobs?repo=try&revision=767599de0872&selectedTaskRun=HUI6Gmu5RpirPm4K1o2eDg.0
Both aborts are reported against their test: TEST-UNEXPECTED-CRASH | browser/components/firefoxview/tests/browser/browser_syncedtabs_errors_firefoxview.js | application terminated with exit code 1 and the same for the repro test, test_end with status: CRASH, expected: PASS, Got 2 unexpected statuses, group ERROR, 150/2/1. summary.jsonl now carries the tsan_error record (signature, pid, stacks) next to each CRASH test_end.

Pushed by fqueze@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/c5623b2d3ffb https://hg.mozilla.org/integration/autoland/rev/3cf7f912c04e Fail the running test when the browser exits abnormally without a minidump r=ahal
Pushed by asilaghi@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/419d642422f0 https://hg.mozilla.org/integration/autoland/rev/4d4fa0e7e09c Revert "Bug 2090907 - Fail the running test when the browser exits abnormally without a minidump r=ahal" for causing bc tests failures at browser_syncedtabs_errors_firefoxview.js

Backed out for causing bc tests failures at browser_syncedtabs_errors_firefoxview.js
Backout Link
Push with failures
Failure Log
Failure line TEST-UNEXPECTED-CRASH | browser/components/firefoxview/tests/browser/browser_syncedtabs_errors_firefoxview.js | application terminated with exit code -6

Flags: needinfo?(benoit.goupilleau)
Attachment #9677893 - Attachment description: Bug 2090907 - Fail the running test when the browser exits abnormally without a minidump r?ahal → Bug 2090907 - Fail the running test when the browser exits abnormally without a minidump r?ahal,#fxview-reviewers
Attachment #9677893 - Attachment description: Bug 2090907 - Fail the running test when the browser exits abnormally without a minidump r?ahal,#fxview-reviewers → Bug 2090907 - Fail the running test when the browser exits abnormally without a minidump r?ahal
Flags: needinfo?(benoit.goupilleau)
Pushed by fqueze@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/1163a43b3c3f https://hg.mozilla.org/integration/autoland/rev/3b7c5c9c0b7c Fail the running test when the browser exits abnormally without a minidump r=ahal
Status: ASSIGNED → RESOLVED
Closed: 7 days ago
Resolution: --- → FIXED
Target Milestone: --- → 163 Branch
Pushed by agoloman@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/2bd5dee92f0f https://hg.mozilla.org/integration/autoland/rev/904f63ad4a36 Revert "Bug 2090907 - Fail the running test when the browser exits abnormally without a minidump r=ahal" for causing bc failures.

Backed out for causing bc failures.

Status: RESOLVED → REOPENED
Flags: needinfo?(benoit.goupilleau)
Resolution: FIXED → ---
Target Milestone: 163 Branch → ---
Depends on: 2096020
Pushed by fqueze@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/4c91a951e8b8 https://hg.mozilla.org/integration/autoland/rev/2095199391aa Fail the running test when the browser exits abnormally without a minidump r=ahal

(In reply to Goloman Adrian[:agoloman] from comment #10)

Backed out for causing bc failures.

Firefox crashed on Windows in a "fast-fail" mode that didn't output a crash dump after opening (and closing) 500 browser windows with the tabs in the title bar. Fixing in bug 2096020 and relanding.

Flags: needinfo?(benoit.goupilleau)
Pushed by abutkovits@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/a3433e059534 https://hg.mozilla.org/integration/autoland/rev/01c9bd96fe07 Revert "Bug 2090907, Bug 2096020 - Fail the running test when the browser exits abnormally without a minidump r=ahal" for causing media related failures.
Pushed by fqueze@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/b4e85ecbb5ba https://hg.mozilla.org/integration/autoland/rev/5c5f93f5f861 Fail the running test when the browser exits abnormally without a minidump r=ahal
Status: REOPENED → RESOLVED
Closed: 7 days ago → 6 days ago
Resolution: --- → FIXED
Target Milestone: --- → 163 Branch
Flags: needinfo?(benoit.goupilleau)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: