Skip to content

rwlock conflict with fastapi test client #468

@M03ED

Description

@M03ED

im using rwlock on marzban 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

self = <aiorwlock._RWLockCore object at 0x7f0d7471a570>

    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: <aiorwlock._RWLockCore object at 0x7f0d7471a570> 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

Metadata

Metadata

Assignees

No one assigned

    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