betanin icon indicating copy to clipboard operation
betanin copied to clipboard

"gevent.exceptions.LoopExit: This operation would block forever" when tried to launch dev server

Open knuurr opened this issue 1 year ago • 4 comments

I'm willing to do small development for betanin.

I cloned github repo and tried to launch server.

I created venv, installed requirements, plus some other missing dependencies when I tried to launch it.... But I can't fight this one.

(venv) qbus@DESKTOP-CA07ILV:~/betanin-dev/betanin$ python3 -m betanin.entry.betanin
2024-01-24 21:37:20.524 | INFO     | __main__:_print_meta_info:34 - platform - Linux-5.15.133.1-microsoft-standard-WSL2-x86_64-with-glibc2.35
2024-01-24 21:37:20.525 | INFO     | __main__:_print_meta_info:34 - python_version - 3.10.12
2024-01-24 21:37:20.525 | INFO     | __main__:_print_meta_info:34 - betanin_version - v0.5.6

2024-01-24 21:37:20.525 | INFO     | __main__:_ensure_config:61 - using config `/home/qbus/.config/betanin/config.toml`
2024-01-24 21:37:20.525 | INFO     | __main__:_ensure_secret_key:93 - using secret key `/home/qbus/.local/share/betanin/secret_key`
INFO  [alembic.runtime.migration] Context impl SQLiteImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
2024-01-24 21:37:20.587 | INFO     | __main__:_start_job:101 - starting job betanin.jobs.import_torrents ()
2024-01-24 21:37:20.587 | INFO     | __main__:_start_job:101 - starting job betanin.jobs.serve_web ('', 9393)
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/qbus/betanin-dev/betanin/betanin/entry/betanin.py", line 146, in <module>
    main(None, None)
  File "/home/qbus/betanin-dev/betanin/venv/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/home/qbus/betanin-dev/betanin/venv/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/home/qbus/betanin-dev/betanin/venv/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/qbus/betanin-dev/betanin/venv/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/home/qbus/betanin-dev/betanin/betanin/entry/betanin.py", line 137, in main
    gevent.joinall(
  File "src/gevent/greenlet.py", line 1065, in gevent._gevent_cgreenlet.joinall
  File "src/gevent/greenlet.py", line 1075, in gevent._gevent_cgreenlet.joinall
  File "src/gevent/_hub_primitives.py", line 250, in gevent._gevent_c_hub_primitives.wait_on_objects
  File "src/gevent/_hub_primitives.py", line 287, in gevent._gevent_c_hub_primitives.wait_on_objects
  File "src/gevent/_hub_primitives.py", line 185, in gevent._gevent_c_hub_primitives._WaitIterator.__next__
  File "src/gevent/_hub_primitives.py", line 176, in gevent._gevent_c_hub_primitives._WaitIterator.__next__
  File "src/gevent/_waiter.py", line 195, in gevent._gevent_c_waiter.MultipleWaiter.get
  File "src/gevent/_waiter.py", line 154, in gevent._gevent_c_waiter.Waiter.get
  File "src/gevent/_greenlet_primitives.py", line 61, in gevent._gevent_c_greenlet_primitives.SwitchOutGreenletWithLoop.switch
  File "src/gevent/_greenlet_primitives.py", line 61, in gevent._gevent_c_greenlet_primitives.SwitchOutGreenletWithLoop.switch
  File "src/gevent/_greenlet_primitives.py", line 65, in gevent._gevent_c_greenlet_primitives.SwitchOutGreenletWithLoop.switch
  File "src/gevent/_gevent_c_greenlet_primitives.pxd", line 35, in gevent._gevent_c_greenlet_primitives._greenlet_switch
gevent.exceptions.LoopExit: This operation would block forever
        Hub: <Hub '' at 0x7fa5c1319e90 epoll default pending=0 ref=0 fileno=4 thread_ident=0x7fa5c436f000>
        Handles:
[]
(venv) qbus@DESKTOP-CA07ILV:~/betanin-dev/betanin$ 

knuurr avatar Jan 24 '24 20:01 knuurr

ah yeah that gevent stuff is really annoying and i don't fully understand it. does the issue persist with python3.11?

sentriz avatar Jan 24 '24 21:01 sentriz

Yep,

  File "src/gevent/_greenlet_primitives.py", line 65, in gevent._gevent_c_greenlet_primitives.SwitchOutGreenletWithLoop.switch
  File "src/gevent/_gevent_c_greenlet_primitives.pxd", line 35, in gevent._gevent_c_greenlet_primitives._greenlet_switch
gevent.exceptions.LoopExit: This operation would block forever
        Hub: <Hub '' at 0x7fd4ba167100 epoll default pending=0 ref=0 fileno=4 thread_ident=0x7fd4bd49ab80>
        Handles:
[]
(venv) qbus@DESKTOP-CA07ILV:~/betanin-dev/betanin$ python --version
Python 3.11.7
(venv) qbus@DESKTOP-CA07ILV:~/betanin-dev/betanin$ 

Also, if this doesn't work then how do you build Docker image? Maybe I'm missing something or don't understand. I also had issues with dependencies that not all are in requirements file. Just curious 😋

knuurr avatar Jan 26 '24 04:01 knuurr

i just tried this on my local machine

$ cd betanin
$ git pull
$ python -m venv venv
$ source ./venv/bin/activate.fish 
$ pip install .
$ python -m betanin.entry.betanin

seems to work fine, how did your steps differ?

sentriz avatar Jan 26 '24 12:01 sentriz

pip install .

Lol, didn't know you can do pip install . .... I did it through pip install -r docker-requirements.txt

Still, doing pip proper way and uing 3.11 doesn't solve gevent issue.

I also assume or hope it's not related to using WSL2 for development.

I'd propose a pull request but I can't check whether it's 100% working without testing it on runing server, and without that I can't get it working.

knuurr avatar Jan 26 '24 18:01 knuurr