DiamondLightSource / DiamondLightSource/coniql
Occasional "coroutine xxx was never awaited" warnings
- Dominant language
- Python
- Stars
- 5
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
Occasionally I see the following `RuntimeWarning`s printed to the terminal running Coniql:
```
/usr/local/lib/python3.8/asyncio/events.py:81: RuntimeWarning: coroutine 'ExecutionContext.execute_fields..get_results' was never awaited
self._context.run(self._callback, *self._args)
Object allocated at (most recent call last):
File "/xxx/lib/python3.8/site-packages/graphql/execution/execute.py", lineno 456
return get_results()
/usr/local/lib/python3.8/asyncio/events.py:81: RuntimeWarning: coroutine 'ExecutionContext.execute_field..await_result' was never awaited
self._context.run(self._callback, *self._args)
Object allocated at (most recent call last):
File "/xxx/lib/python3.8/site-packages/graphql/execution/execute.py", lineno 540
return await_result()
/usr/local/lib/python3.8/asyncio/events.py:81: RuntimeWarning: coroutine 'GraphQLCoreConverter.from_resolver.._async_resolver' was never awaited
self._context.run(self._callback, *self._args)
Object allocated at (most recent call last):
File "/xxx/lib/python3.8/site-packages/graphql/execution/execute.py", lineno 521
result = resolve_fn(source, info, **args)
```
This is reproducible by running a client (e.g. cs-web-proto) displaying ~20 PVs updating at 10Hz and then closing or refreshing that webpage. This means that warning are coming during the clean up of subscriptions when the websocket is closed by the client. It only happens occasionally but a few attempts of refreshing usually works to reproduce it
The warning is coming from the underlying graphql package (not a direct dependency of Coniql). It suggests that a some `asyncio` task is being scheduled but does not get run. I think it must be some sort of timing issue as we don't always see it and in most cases the clean up / cancelling of a task occurs without any warnings.
It doesn't seem to impact behaviour or performance but it would be nice to know why it sometimes occurs.
Contributor guide
Assessment
This issue has not been assessed yet.