Closed Bug 1511557 Opened 6 years ago Closed 6 years ago

Crash annotation pipes are leaked in error cases

Categories

(Toolkit :: Crash Reporting, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla66
Tracking Status
firefox66 --- fixed

People

(Reporter: jld, Assigned: gsvelto)

References

(Regression)

Details

(Keywords: regression)

Attachments

(2 files)

In GeckoChildProcessHost::PerformAsyncLaunch, the ends of the crash annotation pipe are held as PRFileDesc* variables, and they don't appear to be closed in the various early returns between there and when they're used. This could be fixed with some scope guards (MakeScopeExit), but a RAII type (maybe a UniquePtr instance) would be useful more generally. (Found accidentally by looking at the code while investigating bug 1511556 (which was found accidentally by looking at fd tables while investigating bug 1511548, sigh).)
Assignee: nobody → gsvelto
Status: NEW → ASSIGNED
Pushed by gsvelto@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/15f8b27f1305 Do not leak the pipe used for sending crash annotations when hitting errors during startup r=jld
Backed out for build bustages. Push with failure: https://treeherder.mozilla.org/#/jobs?repo=autoland&resultStatus=testfailed%2Cbusted%2Cexception&classifiedState=unclassified&selectedJob=216972426&revision=15f8b27f13054b6c1029d2b2c47968a63cbd9c93 Failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=216972426&repo=autoland&lineNumber=44356 [task 2018-12-14T09:44:20.033Z] 09:44:20 INFO - platform linux2 -- Python 2.7.9, pytest-3.6.2, py-1.5.4, pluggy-0.6.0 -- /builds/worker/workspace/build/src/obj-firefox/_virtualenvs/obj-firefox-8yIyzR8r-2.7/bin/python [task 2018-12-14T09:44:20.033Z] 09:44:20 INFO - rootdir: /builds/worker/workspace/build/src, inifile: /builds/worker/workspace/build/src/config/mozunit/mozunit/pytest.ini [task 2018-12-14T09:44:20.033Z] 09:44:20 INFO - collecting ... collected 1 item [task 2018-12-14T09:44:20.034Z] 09:44:20 INFO - ../config/tests/unit-mozunit.py::TestMozUnit::test_mocked_open PASSED [task 2018-12-14T09:44:20.034Z] 09:44:20 INFO - =========================== 1 passed in 0.01 seconds =========================== [task 2018-12-14T09:44:20.811Z] 09:44:20 INFO - /builds/worker/workspace/build/src/testing/xpcshell/selftest.py [task 2018-12-14T09:44:20.811Z] 09:44:20 INFO - ============================= test session starts ============================== [task 2018-12-14T09:44:20.811Z] 09:44:20 INFO - platform linux2 -- Python 2.7.9, pytest-3.6.2, py-1.5.4, pluggy-0.6.0 -- /builds/worker/workspace/build/src/obj-firefox/_virtualenvs/obj-firefox-8yIyzR8r-2.7/bin/python [task 2018-12-14T09:44:20.812Z] 09:44:20 INFO - rootdir: /builds/worker/workspace/build/src, inifile: /builds/worker/workspace/build/src/config/mozunit/mozunit/pytest.ini [task 2018-12-14T09:44:20.812Z] 09:44:20 INFO - collecting ... collected 55 items [task 2018-12-14T09:44:20.812Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testAddTaskRunNextTest PASSED [task 2018-12-14T09:44:20.812Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testAddTaskSkip PASSED [task 2018-12-14T09:44:20.812Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testAddTaskSkipAll PASSED [task 2018-12-14T09:44:20.812Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testAddTaskStackTrace PASSED [task 2018-12-14T09:44:20.812Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testAddTaskTestFailureInside PASSED [task 2018-12-14T09:44:20.812Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testAddTaskTestMultiple PASSED [task 2018-12-14T09:44:20.812Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testAddTaskTestRejected PASSED [task 2018-12-14T09:44:20.813Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testAddTaskTestSingle PASSED [task 2018-12-14T09:44:20.813Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testAddTestFailing PASSED [task 2018-12-14T09:44:20.813Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testAddTestSimple PASSED [task 2018-12-14T09:44:20.813Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testAddTestUncaughtRejection PASSED [task 2018-12-14T09:44:20.813Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testAddTestUncaughtRejectionJSM PASSED [task 2018-12-14T09:44:20.813Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testAssertStack PASSED [task 2018-12-14T09:44:20.813Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testAsyncCleanup PASSED [task 2018-12-14T09:44:20.813Z] 09:44:20 WARNING - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testChild TEST-UNEXPECTED-FAIL [task 2018-12-14T09:44:20.814Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testChildFail PASSED [task 2018-12-14T09:44:20.814Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testChildHang PASSED [task 2018-12-14T09:44:20.814Z] 09:44:20 WARNING - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testChildMozinfo TEST-UNEXPECTED-FAIL [task 2018-12-14T09:44:20.814Z] 09:44:20 WARNING - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testChildPass TEST-UNEXPECTED-FAIL [task 2018-12-14T09:44:20.814Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testDoPrintWhenVerboseExplicit PASSED [task 2018-12-14T09:44:20.814Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testDoPrintWhenVerboseInManifest PASSED [task 2018-12-14T09:44:20.814Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testDoPrintWhenVerboseNotExplicit PASSED [task 2018-12-14T09:44:20.814Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testDoReportForeignObject PASSED [task 2018-12-14T09:44:20.815Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testDoReportNonSyntaxError PASSED [task 2018-12-14T09:44:20.815Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testDoReportRefError PASSED [task 2018-12-14T09:44:20.815Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testDoReportSyntaxError PASSED [task 2018-12-14T09:44:20.815Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testDoThrowForeignObject PASSED [task 2018-12-14T09:44:20.815Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testDoThrowString PASSED [task 2018-12-14T09:44:20.815Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testFail PASSED [task 2018-12-14T09:44:20.815Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testHangingTimeout <- ../../../../../usr/lib/python2.7/unittest/case.py SKIPPED [task 2018-12-14T09:44:20.815Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testKnownFail PASSED [task 2018-12-14T09:44:20.815Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testLogCorrectFileName PASSED [task 2018-12-14T09:44:20.816Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testMissingHeadFile PASSED [task 2018-12-14T09:44:20.816Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testMozinfo PASSED [task 2018-12-14T09:44:20.816Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testNoRunTestAddTask PASSED [task 2018-12-14T09:44:20.816Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testNoRunTestAddTaskFail PASSED [task 2018-12-14T09:44:20.816Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testNoRunTestAddTaskMultiple PASSED [task 2018-12-14T09:44:20.816Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testNoRunTestAddTest PASSED [task 2018-12-14T09:44:20.816Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testNoRunTestAddTestAddTask PASSED [task 2018-12-14T09:44:20.816Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testNoRunTestAddTestFail PASSED [task 2018-12-14T09:44:20.817Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testNoRunTestEmptyTest PASSED [task 2018-12-14T09:44:20.817Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testNotSkipForAddTask PASSED [task 2018-12-14T09:44:20.817Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testNotSkipForAddTest PASSED [task 2018-12-14T09:44:20.817Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testPass PASSED [task 2018-12-14T09:44:20.817Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testPassFail PASSED [task 2018-12-14T09:44:20.817Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testRandomExecution PASSED [task 2018-12-14T09:44:20.817Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testReturnNonzero PASSED [task 2018-12-14T09:44:20.817Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testSkip PASSED [task 2018-12-14T09:44:20.817Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testSkipForAddTask PASSED [task 2018-12-14T09:44:20.818Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testSkipForAddTest PASSED [task 2018-12-14T09:44:20.818Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testSyntaxError PASSED [task 2018-12-14T09:44:20.818Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testUncaughtRejection PASSED [task 2018-12-14T09:44:20.818Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testUncaughtRejectionJSM PASSED [task 2018-12-14T09:44:20.818Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testUnexpectedPass PASSED [task 2018-12-14T09:44:20.818Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py::XPCShellTestsTests::testUnicodeInAssertMethods PASSED [task 2018-12-14T09:44:20.818Z] 09:44:20 INFO - =================================== FAILURES =================================== [task 2018-12-14T09:44:20.818Z] 09:44:20 INFO - _________________________ XPCShellTestsTests.testChild _________________________ [task 2018-12-14T09:44:20.818Z] 09:44:20 INFO - self = <selftest.XPCShellTestsTests testMethod=testChild> [task 2018-12-14T09:44:20.819Z] 09:44:20 INFO - def testChild(self): [task 2018-12-14T09:44:20.819Z] 09:44:20 INFO - """ [task 2018-12-14T09:44:20.819Z] 09:44:20 INFO - Checks that calling do_load_child_test_harness without run_test_in_child [task 2018-12-14T09:44:20.819Z] 09:44:20 INFO - results in a usable test state. This test has a spurious failure when [task 2018-12-14T09:44:20.819Z] 09:44:20 INFO - run using |mach python-test|. See bug 1103226. [task 2018-12-14T09:44:20.819Z] 09:44:20 INFO - """ [task 2018-12-14T09:44:20.819Z] 09:44:20 INFO - self.writeFile("test_child_assertions.js", CHILD_HARNESS_SIMPLE) [task 2018-12-14T09:44:20.819Z] 09:44:20 INFO - self.writeManifest(["test_child_assertions.js"]) [task 2018-12-14T09:44:20.819Z] 09:44:20 INFO - > self.assertTestResult(True) [task 2018-12-14T09:44:20.819Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py:672: [task 2018-12-14T09:44:20.820Z] 09:44:20 INFO - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ [task 2018-12-14T09:44:20.820Z] 09:44:20 INFO - ../testing/xpcshell/selftest.py:527: in assertTestResult [task 2018-12-14T09:44:20.820Z] 09:44:20 INFO - """ % ("passed" if expected else "failed", self.log.getvalue())) [task 2018-12-14T09:44:20.820Z] 09:44:20 INFO - E AssertionError: Tests should have passed, log: [task 2018-12-14T09:44:20.820Z] 09:44:20 INFO - E ======== [task 2018-12-14T09:44:20.820Z] 09:44:20 INFO - E MOZ_NODE_PATH environment variable not set. Tests requiring http/2 will fail. Backout: https://hg.mozilla.org/integration/autoland/rev/3679d55d36ff66a52a1fd34ed502b9640c971ff9
Weird stuff, I had tested this on my machine and thought it wouldn't have much of an impact but apparently it's not. I'll do more testing and fix the patch.
Flags: needinfo?(gsvelto)
OK, this was a really dumb mistake on my part. I thought MOZ_TYPE_SPECIFIC_SCOPED_POINTER_TEMPLATE() would call PR_Close() only when the variables went out of scope but it also does so if you set the contents to `nullptr` so I was effectively closing *both* ends of the pipe right after registering it. I should just have called .forget() instead. No wonder this didn't work, what's weird is that you can still launch Firefox with crash reporting enabled. That'll teach me to always run the tests locally too.
Pushed by gsvelto@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/71cbbfe1d55b Do not leak the pipe used for sending crash annotations when hitting errors during startup r=jld
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla66
No longer blocks: 1407693
Regressed by: 1407693
Keywords: regression
Has Regression Range: --- → yes
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: