|
14 | 14 | import copy
|
15 | 15 | import socket
|
16 | 16 | import multiprocessing
|
| 17 | +import pdb |
17 | 18 |
|
18 | 19 |
|
19 | 20 | import signal
|
@@ -51,7 +52,6 @@ def run(*args, **kwargs):
|
51 | 52 | def signal_handler(signal, frame):
|
52 | 53 | stop_server()
|
53 | 54 |
|
54 |
| - |
55 | 55 | signal.signal(signal.SIGINT, signal_handler)
|
56 | 56 |
|
57 | 57 | # Requests from client to http server can be the following:
|
@@ -211,7 +211,10 @@ async def onMessage(self, data, isBinary):
|
211 | 211 | # message format used by notebook
|
212 | 212 | msg = {'content': {'data': [m]}}
|
213 | 213 | loop = asyncio.get_event_loop()
|
214 |
| - await loop.run_in_executor(None, GW.handle_msg, msg) |
| 214 | + try: |
| 215 | + await loop.run_in_executor(None, GW.handle_msg, msg) |
| 216 | + except: |
| 217 | + pass |
215 | 218 |
|
216 | 219 | def onClose(self, wasClean, code, reason):
|
217 | 220 | """Called when browser tab is closed."""
|
@@ -355,17 +358,23 @@ def stop_server():
|
355 | 358 | if threading.main_thread().is_alive():
|
356 | 359 | sys.exit(0)
|
357 | 360 | else:
|
| 361 | + # |
| 362 | + # check to see if the event loop is still going, if so join it. |
| 363 | + # |
| 364 | + if __t.is_alive(): |
| 365 | + __t.join() |
| 366 | + |
358 | 367 | # If the main thread has already stopped, the python interpreter
|
359 | 368 | # is likely just running .join on the two remaining threads (in
|
360 | 369 | # python/threading.py:_shutdown). Since we just stopped those threads,
|
361 | 370 | # we'll now exit.
|
362 |
| - sys.exit(0) # but just in case.... |
363 |
| - |
364 |
| - |
| 371 | + |
365 | 372 | GW = GlowWidget()
|
366 | 373 |
|
367 | 374 | while not (httpserving and websocketserving): # try to make sure setup is complete
|
368 | 375 | rate(60)
|
369 | 376 |
|
| 377 | + |
370 | 378 | # Dummy variable to import
|
371 | 379 | _ = None
|
| 380 | + |
0 commit comments