aio-libs / aio-libs/aiorwlock

rwlock conflict with fastapi test client

Offen
#468 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
176
Forks
17
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

im using rwlock on [marzban](https://github.com/Gozargah/Marzban/tree/Separate-Backend) project.
we have some test case with fastapi test client to make sure everything is ok
when we need to access lock in multiple request we get this error
```shell
self =

def _get_loop(self) -> asyncio.AbstractEventLoop:
"""
From: https://github.com/python/cpython/blob/3.12/Lib/asyncio/mixins.py
"""

loop = asyncio.get_event_loop()

if self._loop is None:
with _global_lock:
if self._loop is None:
self._loop = loop
if loop is not self._loop:
> raise RuntimeError(f'{self!r} is bound to a different event loop')
E RuntimeError: is bound to a different event loop

.venv/lib/python3.12/site-packages/aiorwlock/__init__.py:54: RuntimeError
```

i replaced `aiorwlock` with `asyncio.lock` temporary and problem solved [commit](https://github.com/Gozargah/Marzban/commit/4e0d903cbd397abbe25b1e5eba2c29fa620d0c90)

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.