Project: chromium Issues People Development process History Sign in
New issue
Advanced search Search tips
Starred by 2 users
Status: Fixed
Owner:
Closed: Mar 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 1
Type: Bug



Sign in to add a comment
tko_parser error: unbound variable "ignored_lines"
Project Member Reported by semenzato@chromium.org, Feb 17 2017 Back to list
00:50:58 INFO | autoserv| File "/build/sentry/usr/local/build/autotest/tko/parsers/version_1.py", line 311, in print_and_reset_ignored_lines
00:50:58 INFO | autoserv| for line in ignored_lines:
00:50:58 INFO | autoserv| UnboundLocalError: local variable 'ignored_lines' referenced before assignment

the problem is that the assignment

ignored_lines = []

changes the scope of the variable from non-local to local.
 
It kind of sucks though.  The python parser could see that it's used before it's assigned, and use the non-local instance in those cases.  But I suppose that could produce other weird situations.
#1: sorry, that doesn't work.  In general the parser CANNOT see that a variable is used before it's assigned because of control flow.

while foo():
  if bar():
    x = 0
  print x

So this is the price we pay to have both automatic declarations and uninitialized variable run-time check.

Status: Started
CL at https://chromium-review.googlesource.com/c/444100/

This isn't causing any more failures (I think) but it makes existing failures harder to debug.  Should we chump it?  Probably not.
Comment 4 by ihf@chromium.org, Feb 18 2017
Probably not. It is a Friday before a long weekend...
Well I hope it makes it through the CQ...
Comment 6 by sha...@chromium.org, Feb 21 2017
Is this another instance?

http://cautotest.corp.google.com/afe/#tab_id=view_job&object_id=102543236

https://pantheon.corp.google.com/storage/browser/chromeos-autotest-results/102543236-chromeos-test/chromeos4-row7-rack2-host1/debug

stderr:
[0222/005251:INFO:update_engine_client.cc(471)] Forcing an update by setting app_version to ForcedUpdate.
[0222/005251:INFO:update_engine_client.cc(473)] Initiating update check and install.
[0222/005251:INFO:update_engine_client.cc(502)] Waiting for update to complete.
[0222/010145:ERROR:update_engine_client.cc(217)] Update failed, current operation is UPDATE_STATUS_IDLE, last error code is ErrorCode::kFilesystemVerifierError(47)

02/21 06:02:42.149 ERROR|   logging_manager:0626| tko parser: {'builds': "{'cros-version': 'glimmer-release/R58-9304.0.0'}", 'job_started': 1487685019, 'hostname': 'chromeos4-row7-rack2-host1', 'status_version': 1, 'label': 'glimmer-release/R58-9304.0.0/au/autoupdate_Rollback', 'parent_job_id': 102543064, 'build': 'glimmer-release/R58-9304.0.0', 'drone': 'chromeos-server67.hot.corp.google.com', 'user': 'chromeos-test', 'suite': 'au', 'experimental': 'False', 'job_queued': 1487684280}
02/21 06:02:42.151 ERROR|         traceback:0013| Traceback (most recent call last):
02/21 06:02:42.151 ERROR|         traceback:0013|   File "/usr/local/autotest/server/autoserv", line 575, in run_autoserv
02/21 06:02:42.151 ERROR|   logging_manager:0626| tko parser: MACHINE NAME: chromeos4-row7-rack2-host1
02/21 06:02:42.151 ERROR|         traceback:0013|     use_packaging=(not no_use_packaging))
02/21 06:02:42.151 ERROR|   logging_manager:0626| tko parser: MACHINE GROUP: glimmer
02/21 06:02:42.151 ERROR|         traceback:0013|   File "/usr/local/autotest/server/site_server_job.py", line 65, in run
02/21 06:02:42.151 ERROR|         traceback:0013|     super(site_server_job, self).run(*args, **dargs)
02/21 06:02:42.151 ERROR|   logging_manager:0626| tko parser: parsing partial test ---- SERVER_JOB
02/21 06:02:42.152 ERROR|         traceback:0013|   File "/usr/local/autotest/server/server_job.py", line 835, in run
02/21 06:02:42.152 ERROR|         traceback:0013|     namespace['has_failed_tests'] = self._has_failed_tests()
02/21 06:02:42.152 ERROR|   logging_manager:0626| tko parser: parsing partial test autoupdate_Rollback autoupdate_Rollback
02/21 06:02:42.152 ERROR|         traceback:0013|   File "/usr/local/autotest/server/server_job.py", line 674, in _has_failed_tests
02/21 06:02:42.152 ERROR|   logging_manager:0626| tko parser: RUNNING: RUNNING
02/21 06:02:42.152 ERROR|         traceback:0013|     tests = parser.end(status_lines)
02/21 06:02:42.152 ERROR|         traceback:0013|   File "/usr/local/autotest/tko/parsers/base.py", line 49, in end
02/21 06:02:42.152 ERROR|   logging_manager:0626| Subdir: autoupdate_Rollback
02/21 06:02:42.153 ERROR|         traceback:0013|     return self.state.next()
02/21 06:02:42.153 ERROR|   logging_manager:0626| Testname: autoupdate_Rollback
02/21 06:02:42.153 ERROR|         traceback:0013|   File "/usr/local/autotest/tko/parsers/version_1.py", line 367, in state_iterator
02/21 06:02:42.153 ERROR|   logging_manager:0626| 
02/21 06:02:42.153 ERROR|         traceback:0013|     print_and_reset_ignored_lines()
02/21 06:02:42.153 ERROR|         traceback:0013|   File "/usr/local/autotest/tko/parsers/version_1.py", line 311, in print_and_reset_ignored_lines
02/21 06:02:42.153 ERROR|   logging_manager:0626| tko parser: update RUNNING reason: Failed to install device image using payload at http://100.115.219.135:8082/update/glimmer-release/R58-9304.0.0 on chromeos4-row7-rack2-host1. : command execution error
02/21 06:02:42.154 ERROR|         traceback:0013|     for line in ignored_lines:
02/21 06:02:42.153 ERROR|   logging_manager:0626| tko parser: The following lines were ignored:
02/21 06:02:42.154 ERROR|         traceback:0013| UnboundLocalError: local variable 'ignored_lines' referenced before assignment
02/21 06:02:42.167 ERROR|           metrics:0429| Caught exception while flushing: No module named pyasn1_modules.rfc5208
02/21 06:02:42.167 ERROR|          autoserv:0784| 1
Traceback (most recent call last):
Comment 7 by sha...@chromium.org, Feb 21 2017
Ok, still waiting on https://chromium-review.googlesource.com/#/c/444100/ to get through the CQ...
Yes. :P
Project Member Comment 9 by bugdroid1@chromium.org, Feb 21 2017
The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/autotest/+/9aa4a037bfc8c7679221a1b2e4074668ac68a27d

commit 9aa4a037bfc8c7679221a1b2e4074668ac68a27d
Author: Luigi Semenzato <semenzato@chromium.org>
Date: Tue Feb 21 22:07:51 2017

tko parser: fix variable scoping

The variable ignored_lines was set to the empty list
in print_and_reset_ignored_lines().  This made the python
parser treat it as local to the function instead of using
the variable defined in the outer scope.  Removing the
assignment is probably the best solution in this case.

BUG= chromium:693610 
TEST=none

Change-Id: I5a388855b2d808075e7e265fd1dababa4f082aec
Reviewed-on: https://chromium-review.googlesource.com/444100
Commit-Ready: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Dan Shi <dshi@google.com>

[modify] https://crrev.com/9aa4a037bfc8c7679221a1b2e4074668ac68a27d/tko/parsers/version_1.py

Fixed?
Status: Fixed
Yes!!!
Labels: VerifyIn-60
Labels: VerifyIn-61
Sign in to add a comment