Skip to content

Logging gets stuck when a line is too long #1096

@whym

Description

@whym

Describe the bug
It seems that logging gets stuck when a line is too long.

If you print a very long string without a new line in it in a container (400k bytes, for example), podman-compose gets stuck and becomes unresponsive. It will need keyboard interrupt or a kill.

To Reproduce
Steps to reproduce the behavior:

  1. Prepare this compose.yaml in a new directory:
services:
  s1:
    image: docker.io/python:3.11-slim
    command: python -c'print("foo " * 100000)'
  1. Run podman-compose up.

Expected behavior
It prints a very long line of "foo foo foo ..." and exits.

Actual behavior
It gets stuck before printing anything. Ctrl-c will get you the output below.

Output

$ podman-compose version
podman-compose version 1.2.0
podman version 5.0.3

podman-compose up and Ctrl-c after 1 second:

^C^CERROR:asyncio:Task exception was never retrieved
future: <Task finished name='Task-37' coro=<Podman.run.<locals>.format_out() done, defined at /home/m.../pkgsrc/podman-compose/podman_compose.py:1461> exception=ValueError('Separator is not found, and chunk exceed the limit')>
Traceback (most recent call last):
  File "/usr/lib/python3.12/asyncio/streams.py", line 568, in readline
    line = await self.readuntil(sep)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/streams.py", line 646, in readuntil
    raise exceptions.LimitOverrunError(
asyncio.exceptions.LimitOverrunError: Separator is not found, and chunk exceed the limit

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/m.../pkgsrc/podman-compose/podman_compose.py", line 1463, in format_out
    line = await stdout.readline()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/streams.py", line 577, in readline
    raise ValueError(e.args[0])
ValueError: Separator is not found, and chunk exceed the limit
Exception ignored in: <function BaseSubprocessTransport.__del__ at 0x716253d54ae0>
Traceback (most recent call last):
  File "/usr/lib/python3.12/asyncio/base_subprocess.py", line 126, in __del__
    self.close()
  File "/usr/lib/python3.12/asyncio/base_subprocess.py", line 104, in close
    proto.pipe.close()
  File "/usr/lib/python3.12/asyncio/unix_events.py", line 568, in close
    self._close(None)
  File "/usr/lib/python3.12/asyncio/unix_events.py", line 592, in _close
    self._loop.call_soon(self._call_connection_lost, exc)
  File "/usr/lib/python3.12/asyncio/base_events.py", line 795, in call_soon
    self._check_closed()
  File "/usr/lib/python3.12/asyncio/base_events.py", line 541, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed

Environment:

  • OS: Ubuntu Linux 24.10
  • podman version: 5.0.3
  • podman compose version: 62789a2

Additional context

ipython/ipython#14019 seems to deal with a similar issue with readline and length limit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions