New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 641839 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Aug 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

[Factory] goofy unittest fails after adding all_serial_numbers to device.info

Project Member Reported by kitching@chromium.org, Aug 29 2016

Issue description

After adding the CLs:

- https://chromium-review.googlesource.com/362730
- https://chromium-review.googlesource.com/368531

Goofy unittest fails, due to rogue threads not stopping correctly after unittest execution.

Originally, none of the code in Goofy's unittest would call into test/shopfloor.py's DeleteDeviceData or UpdateDeviceData.

The above CLs store and retrieve serial numbers from DeviceData, which added calls to the above shopfloor.py functions throughout Goofy unittest run.



Turns out that there is a bug in both of DeleteDeviceData and UpdateDeviceData:

EventClient().post_event(Event(Event.Type.UPDATE_SYSTEM_INFO))

When an EventClient is created, it adds a "subscription" to Goofy's Event Queue, which is actually a Queue.Queue object.  Until all of these subscriptions are removed, the Goofy Event Server will continue to run, waiting for events to send to its EventClients through their respective Queues.

If EventClient() is created and its object goes out of context, its Queue.Queue object remains in Goofy Event Server's "subscription" list indefinitely.

The correct usage of EventClient for posting a single event should be as follows:

with EventClient() as event_client:
  event_client.post_event(...)

This ensures EventClient.close() gets called and removes the "subscription" from Goofy's Event Queue.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Aug 29 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/factory/+/09d02d43eb426ac7b467238f90c3c755f4bb69c5

commit 09d02d43eb426ac7b467238f90c3c755f4bb69c5
Author: Joel Kitching <kitching@google.com>
Date: Mon Aug 29 03:04:03 2016

test/shopfloor: fix bug in eventclient calls

EventClient() should use a "with" context-block in order to
ensure that it is properly closed after use.

BUG= chromium:641839 
TEST=Manually on DUT

Change-Id: I3d5de86db8c5b8128af6c30c93f1ff8c34329f8b
Reviewed-on: https://chromium-review.googlesource.com/377100
Commit-Ready: Joel Kitching <kitching@chromium.org>
Tested-by: Joel Kitching <kitching@chromium.org>
Reviewed-by: Wei-Han Chen <stimim@chromium.org>

[modify] https://crrev.com/09d02d43eb426ac7b467238f90c3c755f4bb69c5/py/test/shopfloor.py

Status: Fixed (was: Started)

Sign in to add a comment