flask - Python hangs up on returning from a function -
so have 2 functions in complicated flask application. 1 function calls other function.
def dispatch_unlock(...): # ... stuff ... log('dis start') # routine sends data on zmq ipc socket # in scenario, socket send time out ret = acl.enqueue(unlock.id, endpoint_id, filter_entry['service_id']) log('dis end') return ret def something_else(...); # ... stuff ... log('routecall start') ret = dispatch_unlock(unlock, endpoint_id, endpoint, f) log('routecall end') return ret
when something_else
runs, following output produced:
routecall start dis start dis end
after that, hangs up. tried dumping python stack traces show nothing useful. 1 stack trace in werkzurg reloader , other 1 stack trace leading dumper invoked sigusr1
.
can suggest hell going on? python call stack somehow getting corrupted?
edit: here pdb
shows when singlestep execution before return. looks frame above call frame of dispatch_unlock
gets lost somehow.
> /sourcecache/florence/lib/plugin/route.py(27)dispatch_unlock() -> return ret (pdb) s --return-- > /sourcecache/florence/lib/plugin/route.py(27)dispatch_unlock()->none -> return ret (pdb) s
"it's not bug, it's feature"
python hanging when trying garbage collect objects , closing zmq ipc socket not opened due endpoint not being there (which normal, i'm doing testing). apparently, in scenario, zmq meant hang indefinitely (which took me long time figure out since not documented anywhere). can avoided setting linger
property of zmq socket, resolved issue.
Comments
Post a Comment