Skip to content

[Bug]: LogMessageWaitStrategy erroneously assumes each log frame contains a complete log line #5843

@SgtSilvio

Description

@SgtSilvio

Module

Core

Testcontainers version

1.17.3

Using the latest Testcontainers version?

Yes

Host OS

Linux CentOS

Host Arch

x86_64

Docker version

Docker version 20.10.18, build b40c2f6

What happened?

LogMessageWaitStrategy uses a LogContainerCmd to follow logs.
The regex is applied to every OutputFrame that is processed by FrameConsumerResultCallback.
FrameConsumerResultCallback consumes STDOUT or STDERR stream types via processOtherFrame.

Problem:
processOtherFrame passes the content of the com.github.dockerjava.api.model.Frame 1-to-1 to the consumer without doing any processing of log lines (like processRawFrame > normalizeLogLines).
This would only work if the Frame contains a complete log message and not a partial log message.

We reproduced this multiple times. See the log output for one example.

When using a WaitAllStrategy with more LogMessageWaitStrategy, this is more likely to happen because the second log wait strategy only attaches to the log after the first finished, and then of course gets a lot more data at once.

Relevant log output

2022-09-13 00:34:58,297 DEBUG - STDOUT: 2022-09-12 22:34:56,408 INFO  - Extension "HiveMQ Enterprise Extension for Kafka" version 4.9.0-SNAPSHOT started succes
2022-09-13 00:34:58,313 DEBUG - STDOUT: sfully.

from this log statement:

LOGGER.debug("{}: {}", frame.getType(), trimmedFrameText);

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions