containers / podman-compose

a script to run docker-compose.yml using podman
GNU General Public License v2.0
4.97k stars 474 forks source link

Terminal session unresponsive after closing the podman compose session with CTRL+C #676

Open john-ghatas opened 1 year ago

john-ghatas commented 1 year ago

Describe the bug The terminal session goes unresponsive after closing the podman compose session with CTRL+C. Running the latest devel version (1.0.7),

To Reproduce Steps to reproduce the behavior:

  1. Bring any compose file up (pick 1 from https://github.com/docker/awesome-compose)
  2. Close it with CTRL+C
  3. Terminal session goes unresponsive

Expected behavior Terminal keeps it's responsiveness and keeps working

Actual behavior The terminal session either has delayed reaction to input or stops accepting any input at all

Output

❯ podman-compose -f docker-compose.yml -f docker-compose.dev.yml up --build
[...]
TypeError: expected token to be a str, received NoneType instead
[client]   | [nodemon] app crashed - waiting for file changes before starting...
^CTraceback (most recent call last):
  File "/var/home/john/.local/bin/podman-compose", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/var/home/john/.local/pipx/venvs/podman-compose/lib/python3.11/site-packages/podman_compose.py", line 3072, in main
exit code: -2
exit code: -2
    podman_compose.run()
  File "/var/home/john/.local/pipx/venvs/podman-compose/lib/python3.11/site-packages/podman_compose.py", line 1490, in run
    retcode = cmd(self, args)
              ^^^^^^^^^^^^^^^
  File "/var/home/john/.local/pipx/venvs/podman-compose/lib/python3.11/site-packages/podman_compose.py", line 1866, in wrapped
exit code: -2
    return func(*args, **kw)
           ^^^^^^^^^^^^^^^^^
  File "/var/home/john/.local/pipx/venvs/podman-compose/lib/python3.11/site-packages/podman_compose.py", line 2246, in compose_up
    thread.join(timeout=1.0)
  File "/usr/lib/python3.11/threading.py", line 1116, in join
    self._wait_for_tstate_lock(timeout=max(timeout, 0))
  File "/usr/lib/python3.11/threading.py", line 1132, in _wait_for_tstate_lock
    if lock.acquire(block, timeout):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyboardInterrupt
❯ podman --version
podman version 4.4.4
❯ podman-compose --version
podman-compose version: 1.0.7
['podman', '--version', '']
using podman version: 4.4.4
podman-compose version 1.0.7
podman --version 
podman version 4.4.4
exit code: 0

Environment:

Additional context

It's currently semi workable by bringing the container up with the detached (-d) flag and tailing the logs after it's brought up.

john-ghatas commented 1 year ago

Maybe an idea to catch the SIGINT in Python like this https://stackoverflow.com/a/1112350 and kill the containers as well with the signal?

Falmarri commented 9 months ago

My terminal doesn't go unresponsive (using fish, maybe that makes a difference). But I do see this error when ctrl+C a podman compose up command

^CTraceback (most recent call last):
  File "/usr/bin/podman-compose", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/lib/python3.11/site-packages/podman_compose.py", line 2941, in main
    podman_compose.run()
  File "/usr/lib/python3.11/site-packages/podman_compose.py", line 1423, in run
    cmd(self, args)
  File "/usr/lib/python3.11/site-packages/podman_compose.py", line 1754, in wrapped
    return func(*args, **kw)
           ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/podman_compose.py", line 2117, in compose_up
    thread.join(timeout=1.0)
  File "/usr/lib/python3.11/threading.py", line 1123, in join
    self._wait_for_tstate_lock(timeout=max(timeout, 0))
  File "/usr/lib/python3.11/threading.py", line 1139, in _wait_for_tstate_lock
    if lock.acquire(block, timeout):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyboardInterrupt
2023-12-09 20:28:04.323 UTC [1] LOG:  received fast shutdown request
pfeileon commented 1 month ago

Actually (at least in my experience), any input while running podman-compose causes the shell to brick. I need to start another instance to call podman compose down.