Skip to content

Websocket worker start Error #3019

@LaRiffle

Description

@LaRiffle

Describe the bug
Trying to play nicely with websocket but got nasty error

To Reproduce
Start the worker in some notbook

import torch
import syft as sy

hook = sy.TorchHook(torch)

from syft.workers.websocket_server import WebsocketServerWorker

local_worker = WebsocketServerWorker(
                            host="localhost",
                            hook=hook,
                            id=0,
                            port=8183)

local_worker.start()

Expected behavior
Should wait quietly to hear from the client

Stacktrace

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-1-0df61b862dcd> in <module>
     12                             port=8183)
     13 
---> 14 local_worker.start()

~/code/PySyft/syft/workers/websocket_server.py in start(self)
    171             )
    172 
--> 173         asyncio.get_event_loop().run_until_complete(start_server)
    174         print("Serving. Press CTRL-C to stop.")
    175         try:

/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py in run_until_complete(self, future)
    553         future.add_done_callback(_run_until_complete_cb)
    554         try:
--> 555             self.run_forever()
    556         except:
    557             if new_task and future.done() and not future.cancelled():

/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py in run_forever(self)
    508         self._check_closed()
    509         if self.is_running():
--> 510             raise RuntimeError('This event loop is already running')
    511         if events._get_running_loop() is not None:
    512             raise RuntimeError(

RuntimeError: This event loop is already running

Desktop (please complete the following information):

  • OS: macOS Catalina
  • Python 3.7.*
  • PyTorch 1.4
  • tornado 6.0.2

Additional info
I can make a hard fix using this stackoverflow solution

pip install tornado==4.5.3

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions