Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeWarning: coroutine 'Queue.put' was never awaited #154

Open
danielhollas opened this issue Sep 19, 2022 · 8 comments
Open

RuntimeWarning: coroutine 'Queue.put' was never awaited #154

danielhollas opened this issue Sep 19, 2022 · 8 comments
Labels
bug Something isn't working

Comments

@danielhollas
Copy link
Contributor

danielhollas commented Sep 19, 2022

Here's the output of the startup command:

$ aiidalab-launch -vv start --no-pull
Verbose logging is enabled. (LEVEL=20)
INFO:aiidalab_launch:Configuration file path: /home/bl22441/.config/org.aiidalab.aiidalab_launch/config.toml
INFO:aiidalab_launch:Using profile: atmospec
INFO:aiidalab_launch:Starting container 'aiidalab_atmospec'...
Starting container... |INFO:aiidalab_launch:Started container: aiidalab_atmospec (5b4a34d2f82ba99639b73d4f93c6087018118136b796896e6fb8bd4deed7b7d8).
done.
Waiting for AiiDAlab instance to get ready... /INFO:aiidalab_launch:Waiting for services to come up (5b4a34d2f82ba99639b73d4f93c6087018118136b796896e6fb8bd4deed7b7d8)...
INFO:aiidalab_launch:Waiting for init services to finish...
INFO:aiidalab_launch:Waiting for notebook service to become reachable...
|INFO:aiidalab_launch:Init services finished.
-INFO:aiidalab_launch:Trying to connect via HTTPS.
/INFO:aiidalab_launch:Notebook service reachable.
WARNING:aiidalab_launch:Could not authenticate HTTPS certificate.
INFO:aiidalab_launch:Services came up after 24.2 seconds (5b4a34d2f82ba99639b73d4f93c6087018118136b796896e6fb8bd4deed7b7d8).
done.
Open the following URL to access AiiDAlab:

  https://localhost:8889/?token=3166e76c01ea15db5f8523eeb3bc9e5b856e87beafaceb468a7071f2a54f0e5e

Home mounted: aiidalab_atmospec_home -> /home/aiida
Extra volume mounted: /opt/ispg/orca/5.0.3/arch/linux_x86-64_openmpi411_static -> /opt/orca (ro)
Do you want to open AiiDAlab in the browser now? [Y/n]: n
/usr/lib/python3.8/asyncio/base_events.py:641: RuntimeWarning: coroutine 'Queue.put' was never awaited
  self._ready.clear()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

n^CException ignored in: <module 'threading' from '/usr/lib/python3.8/threading.py'>
Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 1388, in _shutdown
    lock.acquire()
KeyboardInterrupt:

The warning /usr/lib/python3.8/asyncio/base_events.py:641: RuntimeWarning: coroutine 'Queue.put' was never awaited was emitted when I pressed n+enter on the prompt to open the browser. I then needed to send the Ctrl+C signal to get out of the process.

This is the first time that this happened to me so likely not very common issue that might be hard to debug. Assigning Low priority for now, will escalate if I keep hitting this.

@danielhollas danielhollas added the bug Something isn't working label Sep 19, 2022
@csadorf
Copy link
Member

csadorf commented Sep 20, 2022

Thank you for reporting. Indeed, let's leave it open for now in case it occurs again.

@csadorf
Copy link
Member

csadorf commented Sep 28, 2022

Its seems like the same bug also caused this test run to timeout.

@csadorf csadorf self-assigned this Sep 28, 2022
@csadorf
Copy link
Member

csadorf commented Sep 28, 2022

@danielhollas Do you know for which version this bug was triggered?

@danielhollas
Copy link
Contributor Author

@csadorf version v2022.1015, i.e. the latest one.

@csadorf
Copy link
Member

csadorf commented Sep 29, 2022

As it occurred again? I am having large trouble re-producing the problem. It seems to be somehow related to a premature termination of the process, but I have not been able to pin things down yet.

@danielhollas
Copy link
Contributor Author

I haven't seen it since, but I also haven't been using aiidalab-launch much lately.

@csadorf csadorf removed their assignment Oct 21, 2022
@danielhollas
Copy link
Contributor Author

Just noting that I am still randomly seeing this issue. Will probably be a pain to debug...

@danielhollas
Copy link
Contributor Author

I checked the code and it looks like the coroutine 'Queue.put' is only used in a single place - the _async_wrap_iter utility function

asyncio.run_coroutine_threadsafe(q.put(item), loop).result()

Which is in turn used by the instance.echo_logs function that is used to print debug logs if maximum verbosity is requested. This function is being called by creating a asyncio Task here

echo_logs = asyncio.create_task(instance.echo_logs())

Two lines below that the Task is cancelled but it seems that the cancellation will not happen if there is an exception when the container fails to start withing given timeout. I am trying to fix that in #164, but it might be hard to verify that this was indeed the problem (especially since the problem described in this issue appeared even when the container started succcessfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants