eset/ipyida

open two IDA instance , ipyida got RuntimeError: Cannot run the event loop while another loop is running

QGB opened this issue · 3 comments

QGB commented
Task was destroyed but it is pending!
task: <Task pending name='Task-3' coro=<Kernel.dispatch_queue() running at C:\qgb\IDA_Pro_v7.5_Portable\python38\lib\site-packages\ipykernel\kernelbase.py:473> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x000001895F6AA970>()]> cb=[IOLoop.add_future.<locals>.<lambda>() at C:\qgb\IDA_Pro_v7.5_Portable\python38\lib\site-packages\tornado\ioloop.py:688]>
ERROR:tornado.general:Uncaught exception in ZMQStream callback
Traceback (most recent call last):
  File "C:\qgb\IDA_Pro_v7.5_Portable\python38\lib\site-packages\zmq\eventloop\zmqstream.py", line 431, in _run_callback
    callback(*args, **kwargs)
  File "C:\qgb\IDA_Pro_v7.5_Portable\python38\lib\site-packages\jupyter_client\threaded.py", line 121, in _handle_recv
    msg_list = self.ioloop._asyncio_event_loop.run_until_complete(get_msg(future_msg))
  File "asyncio\base_events.py", line 592, in run_until_complete
  File "asyncio\base_events.py", line 554, in _check_running
RuntimeError: Cannot run the event loop while another loop is running
ERROR:tornado.general:Uncaught exception in zmqstream callback
Traceback (most recent call last):
  File "C:\qgb\IDA_Pro_v7.5_Portable\python38\lib\site-packages\zmq\eventloop\zmqstream.py", line 452, in _handle_events
    self._handle_recv()
  File "C:\qgb\IDA_Pro_v7.5_Portable\python38\lib\site-packages\zmq\eventloop\zmqstream.py", line 481, in _handle_recv
    self._run_callback(callback, msg)
  File "C:\qgb\IDA_Pro_v7.5_Portable\python38\lib\site-packages\zmq\eventloop\zmqstream.py", line 431, in _run_callback
    callback(*args, **kwargs)
  File "C:\qgb\IDA_Pro_v7.5_Portable\python38\lib\site-packages\jupyter_client\threaded.py", line 121, in _handle_recv
    msg_list = self.ioloop._asyncio_event_loop.run_until_complete(get_msg(future_msg))
  File "asyncio\base_events.py", line 592, in run_until_complete
  File "asyncio\base_events.py", line 554, in _check_running
RuntimeError: Cannot run the event loop while another loop is running
Exception in callback BaseAsyncIOLoop._handle_events(2024, 1)
handle: <Handle BaseAsyncIOLoop._handle_events(2024, 1)>
Traceback (most recent call last):
  File "asyncio\events.py", line 81, in _run
  File "C:\qgb\IDA_Pro_v7.5_Portable\python38\lib\site-packages\tornado\platform\asyncio.py", line 189, in _handle_events
    handler_func(fileobj, events)
  File "C:\qgb\IDA_Pro_v7.5_Portable\python38\lib\site-packages\zmq\eventloop\zmqstream.py", line 452, in _handle_events
    self._handle_recv()
  File "C:\qgb\IDA_Pro_v7.5_Portable\python38\lib\site-packages\zmq\eventloop\zmqstream.py", line 481, in _handle_recv
    self._run_callback(callback, msg)
  File "C:\qgb\IDA_Pro_v7.5_Portable\python38\lib\site-packages\zmq\eventloop\zmqstream.py", line 431, in _run_callback
    callback(*args, **kwargs)
  File "C:\qgb\IDA_Pro_v7.5_Portable\python38\lib\site-packages\jupyter_client\threaded.py", line 121, in _handle_recv
    msg_list = self.ioloop._asyncio_event_loop.run_until_complete(get_msg(future_msg))
  File "asyncio\base_events.py", line 592, in run_until_complete
  File "asyncio\base_events.py", line 554, in _check_running
RuntimeError: Cannot run the event loop while another loop is running
C:\qgb\IDA_Pro_v7.5_Portable\python38\lib\site-packages\IPython\core\history.py:369: RuntimeWarning: coroutine 'get_msg' was never awaited
  return reversed(list(cur))
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
ERROR:tornado.general:Uncaught exception in ZMQStream callback
Traceback (most recent call last):
  File "C:\qgb\IDA_Pro_v7.5_Portable\python38\lib\site-packages\zmq\eventloop\zmqstream.py", line 431, in _run_callback
    callback(*args, **kwargs)
  File "C:\qgb\IDA_Pro_v7.5_Portable\python38\lib\site-packages\jupyter_client\threaded.py", line 121, in _handle_recv
    msg_list = self.ioloop._asyncio_event_loop.run_until_complete(get_msg(future_msg))
  File "asyncio\base_events.py", line 592, in run_until_complete
  File "asyncio\base_events.py", line 554, in _check_running
RuntimeError: Cannot run the event loop while another loop is running
ERROR:tornado.general:Uncaught exception in zmqstream callback
Traceback (most recent call last):
  File "C:\qgb\IDA_Pro_v7.5_Portable\python38\lib\site-packages\zmq\eventloop\zmqstream.py", line 452, in _handle_events
    self._handle_recv()
  File "C:\qgb\IDA_Pro_v7.5_Portable\python38\lib\site-packages\zmq\eventloop\zmqstream.py", line 481, in _handle_recv
    self._run_callback(callback, msg)
  File "C:\qgb\IDA_Pro_v7.5_Portable\python38\lib\site-packages\zmq\eventloop\zmqstream.py", line 431, in _run_callback
    callback(*args, **kwargs)
  File "C:\qgb\IDA_Pro_v7.5_Portable\python38\lib\site-packages\jupyter_client\threaded.py", line 121, in _handle_recv
    msg_list = self.ioloop._asyncio_event_loop.run_until_complete(get_msg(future_msg))
  File "asyncio\base_events.py", line 592, in run_until_complete
  File "asyncio\base_events.py", line 554, in _check_running
RuntimeError: Cannot run the event loop while another loop is running
Exception in callback BaseAsyncIOLoop._handle_events(1996, 1)
handle: <Handle BaseAsyncIOLoop._handle_events(1996, 1)>
Traceback (most recent call last):
  File "asyncio\events.py", line 81, in _run
  File "C:\qgb\IDA_Pro_v7.5_Portable\python38\lib\site-packages\tornado\platform\asyncio.py", line 189, in _handle_events
    handler_func(fileobj, events)
  File "C:\qgb\IDA_Pro_v7.5_Portable\python38\lib\site-packages\zmq\eventloop\zmqstream.py", line 452, in _handle_events
    self._handle_recv()
  File "C:\qgb\IDA_Pro_v7.5_Portable\python38\lib\site-packages\zmq\eventloop\zmqstream.py", line 481, in _handle_recv
    self._run_callback(callback, msg)
  File "C:\qgb\IDA_Pro_v7.5_Portable\python38\lib\site-packages\zmq\eventloop\zmqstream.py", line 431, in _run_callback
    callback(*args, **kwargs)
  File "C:\qgb\IDA_Pro_v7.5_Portable\python38\lib\site-packages\jupyter_client\threaded.py", line 121, in _handle_recv
    msg_list = self.ioloop._asyncio_event_loop.run_until_complete(get_msg(future_msg))
  File "asyncio\base_events.py", line 592, in run_until_complete
  File "asyncio\base_events.py", line 554, in _check_running
RuntimeError: Cannot run the event loop while another loop is running

Hi,

Thanks for reporting. Most of the time I have more than one IDA instance opened I never experienced this issue (on macOS). Are you able to reproduce at all time or doesn't it work sometime and sometime not? I'm wondering if it has something to do with the event loop manager which is different on Windows.

Are you sure the qasync dependecy is correctly installed?

QGB commented

@marc-etienne I installed qasync before.
image
Can you find a Win10 environment to retest this problem?
image

This is caused by an upstream bug in jupyter_client (jupyter/jupyter_client#831). Using jupyter_client<6.1.13 fixes the issue. The issue should also be fixed in jupyter_client version 8.0, but it isn't released yet.