Closed Bug 1343549 Opened 8 years ago Closed 8 years ago

Intermittent TEST-UNEXPECTED-ERROR | tresize | local variable 'return_code' referenced before assignment

Categories

(Testing :: Talos, defect)

defect
Not set
normal

Tracking

(firefox52 unaffected, firefox53 fixed, firefox54 fixed)

RESOLVED FIXED
mozilla54
Tracking Status
firefox52 --- unaffected
firefox53 --- fixed
firefox54 --- fixed

People

(Reporter: gbrown, Assigned: gbrown)

References

Details

(Keywords: intermittent-failure)

Attachments

(1 file)

+++ This bug was initially created as a clone of Bug #1339594 +++ Following bug 1339594, I see some reports of this, reported in 1339594. https://treeherder.mozilla.org/logviewer.html#?repo=mozilla-inbound&job_id=80563029&lineNumber=1681 https://treeherder.mozilla.org/logviewer.html#?repo=autoland&job_id=80462838&lineNumber=1649 11:21:00 INFO - Browser shutdown timed out after 5 seconds, terminating process. 11:21:02 INFO - Terminating psutil.Process(pid=2788, name=u'firefox.exe') 11:21:03 INFO - Unable to kill process 11:21:03 ERROR - Traceback (most recent call last): 11:21:03 INFO - File "C:\slave\test\build\tests\talos\talos\talos_process.py", line 143, in run_browser 11:21:03 INFO - return_code = context.kill_process() 11:21:03 INFO - File "C:\slave\test\build\tests\talos\talos\talos_process.py", line 50, in kill_process 11:21:03 INFO - self.process.kill() 11:21:03 INFO - File "C:\slave\test\build\venv\lib\site-packages\psutil\__init__.py", line 300, in wrapper 11:21:03 INFO - return fun(self, *args, **kwargs) 11:21:03 INFO - File "C:\slave\test\build\venv\lib\site-packages\psutil\__init__.py", line 1086, in kill 11:21:03 INFO - self._proc.kill() 11:21:03 INFO - File "C:\slave\test\build\venv\lib\site-packages\psutil\_pswindows.py", line 258, in wrapper 11:21:03 INFO - raise AccessDenied(self.pid, self._name) 11:21:03 INFO - AccessDenied: psutil.AccessDenied (pid=2788, name=u'firefox.exe') 11:21:18 INFO - TEST-UNEXPECTED-ERROR | tresize | local variable 'return_code' referenced before assignment 11:21:18 ERROR - Traceback (most recent call last): 11:21:18 INFO - File "C:\slave\test\build\tests\talos\talos\run_tests.py", line 202, in run_tests 11:21:18 INFO - talos_results.add(mytest.runTest(browser_config, test)) 11:21:18 INFO - File "C:\slave\test\build\tests\talos\talos\ttest.py", line 70, in runTest 11:21:18 INFO - return self._runTest(browser_config, test_config, setup) 11:21:18 INFO - File "C:\slave\test\build\tests\talos\talos\ttest.py", line 174, in _runTest 11:21:18 INFO - if counter_management else None), 11:21:18 INFO - File "C:\slave\test\build\tests\talos\talos\talos_process.py", line 158, in run_browser 11:21:18 INFO - if return_code is not None: 11:21:18 INFO - UnboundLocalError: local variable 'return_code' referenced before assignment 11:21:18 INFO - TEST-INFO took 60094ms
I introduced this bug with my earlier change. If kill_process() in the finally / try handler raises, return_code will never be set, resulting in the UnboundLocalError later on. This change should avoid that.
Attachment #8842476 - Flags: review?(jmaher)
Comment on attachment 8842476 [details] [diff] [review] ensure return_code set before reference Review of attachment 8842476 [details] [diff] [review]: ----------------------------------------------------------------- I like simple fixes
Attachment #8842476 - Flags: review?(jmaher) → review+
Pushed by gbrown@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/9e8add7d25dd Avoid unbound return_code errors in talos; r=jmaher
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: