Skip to content

Occasional "coroutine xxx was never awaited" warnings #77

@rjwills28

Description

@rjwills28

Occasionally I see the following RuntimeWarnings printed to the terminal running Coniql:

/usr/local/lib/python3.8/asyncio/events.py:81: RuntimeWarning: coroutine 'ExecutionContext.execute_fields.<locals>.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.<locals>.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.<locals>._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.

Metadata

Metadata

Assignees

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