You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The probe module does not wait for everest to signal ready.
Details
The probe module used for testing is supposed to wait for everest to signal ready. The pattern is to call:
await proble_module.wait_to_ready()
The pattern seems to work, but results in a warning after the tests: probe_module.py:119: RuntimeWarning: coroutine 'Event.wait' was never awaited
Analysis
There is a problem on two levels.
The current implementation does not wait for the ready event, but moves the blocking operation to another thread to be non blocking.
Thread safety. Not moving to another thread results in wait_for always waiting until timeout. The reason for this is, that asyncio.Event is not thread safe (https://docs.python.org/3/library/asyncio-sync.html). Since _ready_event.set is called from a different thread than ready_event.wait, wait waits until timeout, since it only learns about being signaled after the timeout.
Proposed solution
Replace asyncio.Event with threading.Event and mimic asyncio.Event behavior by wrapping its wait in a Coroutine.
The text was updated successfully, but these errors were encountered:
Issue
The probe module does not wait for everest to signal ready.
Details
The probe module used for testing is supposed to wait for everest to signal ready. The pattern is to call:
The pattern seems to work, but results in a warning after the tests:
probe_module.py:119: RuntimeWarning: coroutine 'Event.wait' was never awaited
Analysis
There is a problem on two levels.
wait_for
always waiting until timeout. The reason for this is, that asyncio.Event is not thread safe (https://docs.python.org/3/library/asyncio-sync.html). Since_ready_event.set
is called from a different thread thanready_event.wait
,wait
waits until timeout, since it only learns about being signaled after the timeout.Proposed solution
Replace asyncio.Event with threading.Event and mimic asyncio.Event behavior by wrapping its
wait
in a Coroutine.The text was updated successfully, but these errors were encountered: