Skip to content
Snippets Groups Projects
Commit 2569a170 authored by Nat Goodspeed's avatar Nat Goodspeed
Browse files

DRTVWR-418: Diagnostic prints to identify hangup

parent 0532e298
No related branches found
No related tags found
No related merge requests found
...@@ -177,8 +177,14 @@ def run(*args, **kwds): ...@@ -177,8 +177,14 @@ def run(*args, **kwds):
# We're not starting a thread, so shutdown() is a no-op. # We're not starting a thread, so shutdown() is a no-op.
shutdown = lambda: None shutdown = lambda: None
else: else:
# Make a function that reports when serve_forever() returns.
def serve_forever():
server_inst.serve_forever()
print "%s.serve_forever() returned" % server_inst.__class__.__name__
sys.stdout.flush()
# Make a Thread on which to call server_inst.serve_forever(). # Make a Thread on which to call server_inst.serve_forever().
thread = Thread(name="server", target=server_inst.serve_forever) thread = Thread(name="server", target=serve_forever)
# Make this a "daemon" thread. # Make this a "daemon" thread.
thread.setDaemon(True) thread.setDaemon(True)
...@@ -189,10 +195,16 @@ def run(*args, **kwds): ...@@ -189,10 +195,16 @@ def run(*args, **kwds):
# sys.exit(0), apparently killing the thread causes the Python runtime # sys.exit(0), apparently killing the thread causes the Python runtime
# to force the process termination code to 1. So try to play nice. # to force the process termination code to 1. So try to play nice.
def shutdown(): def shutdown():
print "Calling %s.shutdown()" % server_inst.__class__.__name__
sys.stdout.flush()
# evidently this call blocks until shutdown is complete # evidently this call blocks until shutdown is complete
server_inst.shutdown() server_inst.shutdown()
print "%s.shutdown() returned" % server_inst.__class__.__name__
sys.stdout.flush()
# which should make it straightforward to join() # which should make it straightforward to join()
thread.join() thread.join()
print "Thread.join() returned"
sys.stdout.flush()
try: try:
# choice of os.spawnv(): # choice of os.spawnv():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment