thread blocked after a curl error 56

Bug #890076 reported by Xu Zhen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Polly
Incomplete
Undecided
Unassigned

Bug Description

if polly got a curl error 56 in _streaming_loop(), self.buffer_thread.join() will cause the thread to be blocked, and I cant receive any data any more. it seems that that thread never terminates.
maybe we need set a timeout for join() ?

Revision history for this message
Conscious User (conscioususer) wrote :

I will investigate this, but it would be easier with some way to artificially simulate the error 56.

Either way, setting a timeout for join is not a fix. It's a workaround that causes more problems than solves.

If the buffer thread is not finishing in certain circumstances, it's a bug that needs to be fixed, not ignored and worked around.

Changed in polly:
status: New → Incomplete
Revision history for this message
Conscious User (conscioususer) wrote :

Xu, when this error happens, is anything else relevant printed?

Revision history for this message
Xu Zhen (xuzhen666) wrote :

only a "DEBUG: *** disconnected because of curl error 56" message, nothing more.
and can't terminate polly by sending interrupt signal (press ctrl+c in terminal)

using an unstable proxy, like Tor, can easily cause this problem

Revision history for this message
Conscious User (conscioususer) wrote :

Strange, I'd expect an exception traceback... the thread simply stopping with no visible consequences is weird.

Could you try throwing some prints in the buffer loop to try figuring out where exactly the lock up is occurring?

Revision history for this message
Xu Zhen (xuzhen666) wrote :

the modified realtime.py is at https://bugs.launchpad.net/polly/+bug/887861/comments/12

initializing... done
1st while loop
1st while loop
for subdata in data:
break
2nd while loop
self.buffer_condition.acquire()
buffer_finished = self.buffer_finished
deque([([***, ... ,***], 1321412071.306209)])
DEBUG: *** connected successfully
self.buffer_condition.release()
if buffer_finished:
2nd while loop
self.buffer_condition.acquire()
self.buffer_condition.wait()
for subdata in data:
break
2nd while loop
self.buffer_condition.acquire()
self.buffer_condition.wait()
buffer_finished = self.buffer_finished
deque([({u'favorited': False, u'in_reply_to_user_id': None, ... , u'default_profile': True, u'is_translator': False}}, 1321412117.143312)])
self.buffer_condition.release()
if buffer_finished:
2nd while loop
self.buffer_condition.acquire()
self.buffer_condition.wait()
DEBUG: *** disconnected because of curl error 56
before self.buffer_thread.join()
buffer_finished = self.buffer_finished
self.buffer_condition.release()
if buffer_finished:
break
after self.buffer_thread.join()
DEBUG: *** will reconnect in 0.25 seconds
1st while loop
1st while loop
buffer_finished = self.buffer_finished
deque([([***, ... ,***], 1321412242.143593)])
self.buffer_condition.release()
if buffer_finished:
2nd while loop
self.buffer_condition.acquire()
self.buffer_condition.wait()
for subdata in data:
break
2nd while loop
self.buffer_condition.acquire()
self.buffer_condition.wait()
for subdata in data:
break
2nd while loop
self.buffer_condition.acquire()
self.buffer_condition.wait()
DEBUG: *** disconnected because of curl error 56
buffer_finished = self.buffer_finished
self.buffer_condition.release()
if buffer_finished:
break
before self.buffer_thread.join()
^C^C^C^C^C^C^C^C

Revision history for this message
Conscious User (conscioususer) wrote :

Thanks for the printout, I'll look into this when I have time.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.