Skip to content

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

Closed

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

Activity

  1. SgtSilvio commented on Sep 18, 2022

    @SgtSilvio
    ContributorAuthor

    Related: #643

  2. added 3 commits that reference this issue on Sep 18, 2022
    3c8eb12
    53fa80d
    e4842f8
  3. added 6 commits that reference this issue on Oct 4, 2022
    1b43161
    f52e799
    96df082
    74df6d1
    342d669
    fc4a7f5
  4. added a commit that references this issue on Nov 2, 2022
    164882a
  5. added 2 commits that reference this issue on Jan 16, 2023
    9d79384
    15dcf98
  6. added a commit that references this issue on Feb 16, 2023
    3ca5e67
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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