[tor-bugs] #28866 [Core Tor/sbws]: ResultDump.queue.put() can hang if the queue is full
Tor Bug Tracker & Wiki
blackhole at torproject.org
Thu Feb 14 18:37:04 UTC 2019
#28866: ResultDump.queue.put() can hang if the queue is full
---------------------------+-----------------------------------
Reporter: teor | Owner: juga
Type: defect | Status: needs_revision
Priority: Medium | Milestone: sbws: 1.0.x-final
Component: Core Tor/sbws | Version: sbws: 1.0.2
Severity: Normal | Resolution:
Keywords: | Actual Points:
Parent ID: #28663 | Points: 1
Reviewer: mikeperry | Sponsor:
---------------------------+-----------------------------------
Changes (by mikeperry):
* status: needs_review => needs_revision
Comment:
Hrmm. I might need to look at a lot more of the sbws code, but I don't
think the patch is the best way to do this. If the queue can also be added
from another thread, then there still can be a race where it ends up full
after the loop check but before the next statement. I would instead make
it do something like:
{{{
while True:
try:
result_dump.queue.put(measurement_result, timeout=1)
except Full as e:
log.info('The results queue is full, after 1 second it should not be
full')
}}}
That way, if the timeout hits because the queue is full for a second, the
exception is thrown, and then you log, and then you try again for another
second (at which point it should succeed, but in case it does not, you
just log and try again rather than raise an uncaught Full exception).
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/28866#comment:7>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list