question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wait with log does not exit even if successfully matched

See original GitHub issue

Description

When I set the <log> tag even if the condition is matched the execution does not exit as I expect. I set the <log> and the <time>, I run the command mvn integration-test, the image is built and container is started.

WebSphere Liberty Profile starts and application is then deployed:

[INFO] DOCKER> Pattern '(?s).*Application *******-war started in .*' matched for container 7816e2e8242d

but then Maven does not exist with Build Successful as I expect.

This is part of my Maven configuration

<!-- Once fulfilled the condition the startup will be complete -->
<wait>
    <log>(?s).*Application ${docker.run.context.root} started in .*</log>
   <time>600000</time>
</wait>
                                        
<!-- Log configuration -->
<log>
    <date>ISO8601</date>
    <color>blue</color>
</log>

Am I missing something?

My system:

  • Maven version: 3.6.1
  • Docker Engine: 19.03.5
  • Docker Desktop: 2.1.0.5
  • Windows 10

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:3
  • Comments:6

github_iconTop GitHub Comments

4reactions
d-huynhcommented, Apr 25, 2020

I also have this problem. I ran docker-maven-plugin (d-m-p) in debug mode and found out that after the log is matched, d-m-p tries to close the tasks, which is somehow locked because the log file is locked by the container (I think this is a Windows problem, because I doesn’t have it running on Linux). If anyone can point out a possible solution or give me more information on how to solve it, I will try to contribute a pull request.

LogRequestor tries to close the request HTTPGet request to the log file:

    @Override
    public void finish() {
        if (request != null) {
            request.abort();
            request = null;
        }
    }

Which in turn use Apache’s HTTPGet client and request this: GET npipe://127.0.0.1:1/v1.40/containers/ca923dc3d82a/logs?follow=1&stderr=1&stdout=1&timestamps=1 HTTP/1.1

This request failed because the log file is locked by the system, that’s my guess (of course only the docker container locks it).

The maven process will then be halted without any explanation and has to be force stopped.

System info:

d-m-p 0.33.0
Windows 10 Pro 1909
Apache Maven 3.6.1
Java version: 11.0.4, vendor: AdoptOpenJDK

Docker Desktop community version 2.2.0.5
Client: Docker Engine - Community
 Version:           19.03.8
 API version:       1.40
 Go version:        go1.12.17
 Git commit:        afacb8b
 Built:             Wed Mar 11 01:23:10 2020
 OS/Arch:           windows/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.8
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.17
  Git commit:       afacb8b
  Built:            Wed Mar 11 01:29:16 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
0reactions
blackatcommented, Apr 1, 2021

Hello, I have overcame the issue creating an heartbeat service to poll, when the application is up an running it exists with successful build, so I don’t inspect anymore the logs 😊

Tell me if I can close the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

bash wait exit on error code - Stack Overflow
I am not very interested in the error codes themselves, only that they're not success. Is there a less verbose way to make...
Read more >
Waiting for containers to start or be ready - Testcontainers
This strategy is intended for use with containers that only run briefly and exit of their own accord. As such, success is deemed...
Read more >
How do I wait for a file in the shell script? - Unix Stack Exchange
I included the open event to also register touch /tmp/sleep.txt when the file ... In case it gets created/opened, then the exit status...
Read more >
Error handling in Step Functions - AWS Documentation
Errors can happen for various reasons, such as the following examples: State machine definition issues (for example, no matching rule in a Choice...
Read more >
Cypress cy.intercept Problems - Gleb Bahmutov
It looks reasonable, it even shows the call in the Command Log - but does NOT pass. The intercept times out waiting.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found