getnamo / TensorFlow-Unreal

TensorFlow plugin for the Unreal Engine.
Other
1.16k stars 211 forks source link

RuntimeError: got Future <Future pending> attached to a different loop #67

Open Digletto opened 2 years ago

Digletto commented 2 years ago

When running remote server using the latest release (default requirements installed only), I run into this error when sending inputs. Here's the full error message:

Task exception was never retrieved future: <Task finished coro=<AsyncServer._handle_event_internal() done, defined at C:\Python\Python37\lib\site-packages\socketio\asyncio_server.py:506> exception=RuntimeError('Task <Task pending coro=<AsyncServer._handle_event_internal() running at C:\Python\Python37\lib\site-packages\socketio\asyncio_server.py:508>> got Future attached to a different loop')> Traceback (most recent call last): File "C:\Python\Python37\lib\site-packages\socketio\asyncio_server.py", line 508, in _handle_event_internal r = await server._trigger_event(data[0], namespace, sid, data[1:]) File "C:\Python\Python37\lib\site-packages\socketio\asyncio_server.py", line 542, in _trigger_event ret = await handler(args) File "server.py", line 91, in send_input return await future RuntimeError: Task <Task pending coro=<AsyncServer._handle_event_internal() running at C:\Python\Python37\lib\site-packages\socketio\asyncio_server.py:508>> got Future attached to a different loop

I think the line should be 88, I've just added some logging for debugging. I can avoid the error if I update the stored loop after connecting with g.sio_loop = asyncio.get_running_loop(). But then the input result events never show up in unreal.

Digletto commented 2 years ago

Eventually got it to work by running g.sio_loop = asyncio.get_running_loop() whenever sendInput is called. Not sure if this slows everything down though.

getnamo commented 2 years ago

fixed in https://github.com/getnamo/ml-remote-server/commit/5941fe2e131bdee052109374f705bed60d9a6059