[tor-bugs] #28866 [Core Tor/sbws]: ResultDump.queue.put() can hang if the queue is full
Tor Bug Tracker & Wiki
blackhole at torproject.org
Fri Feb 22 23:43:50 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:
Ok I now understand a bit more of what's going on here. I am still not in
favor of this solution, for the following reasons:
1. The only way that the closure callback could block in the old code was
if the result getter thread died/stalled/deadlocked and did not manage to
actually pull a result to make the queue non-full.
2. The new code has a while loop which will still run forever if the queue
is full and nothing pulls from it. It will just log in that case.
It seems like #1 and #2 both block and fail to return in the exact same
way. What about:
{{{
try:
result_dump.queue.put(measurement_result, timeout=3)
except Full as e:
log.warn("The results queue is staying full. Is the getter thread
dead?")
}}}
This way, the closure will only block for at most 3 seconds, which should
only happen if the getter is dead/hung, since the getter should have
pulled in just 1 second. Hence the warn in that case.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/28866#comment:12>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list