Merged request to fix -f to stop following logs#6591
Conversation
Fix -f logs follow with stopped container. Close #6531 Signed-off-by: Qi Wang <qiwan@redhat.com>
|
Hi @jgallucci32. Thanks for your PR. I'm waiting for a containers member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
@jgallucci32 You need to sign your commits. git commit -a --amend -s |
Fixes an issue with the previous PR where a container would exit while following logs and the log tail continued to follow. This creates a subroutine which checks the state of the container and instructs the tailLog to stop when it reaches EOF. Tested the following conditions: * Tail and follow logs of running container * Tail and follow logs of stopped container * Tail and follow logs of running container which exits after some time Signed-off-by: jgallucci32 <john.gallucci.iv@gmail.com>
|
@rhatdan Thanks for the guidance. Git commit has been signed and it is reflected in the commit comments now for this PR. |
Signed-off-by: jgallucci32 <john.gallucci.iv@gmail.com>
This fixes a condition when a container is removed while following the logs and prints an error when the container is removed forcefully. Signed-off-by: jgallucci32 <john.gallucci.iv@gmail.com>
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jgallucci32, rhatdan The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
| options.WaitGroup.Done() | ||
| }() | ||
| // Check if container is still running or paused | ||
| go func() { |
There was a problem hiding this comment.
Will this also need to be added to WaitGroup?
There was a problem hiding this comment.
@QiWang19 When t.Stop() is called is should be unblocking the t.Lines() called in the other subroutine which would allow the other subroutine to end which calls options.WaitGroup.Done() before it returns.
QiWang19
left a comment
There was a problem hiding this comment.
@jgallucci32 Can you rebase them to one commit and git commit -a --amend -s sign-off the commit
|
@QiWang19 This seem to be failing on two Ubuntu integration tests and looking at how it failed it appears to be a race condition when following the logs of a container created with the Is there a way we could use Signaling, rather than a loop/sleep routine, which would execute Here is the exact point of failure from the integration test |
Remove redundant `break` call in for loop. Co-authored-by: Qi Wang <qiwan@redhat.com> Signed-off-by: jgallucci32 <john.gallucci.iv@gmail.com>
I attempted to do that but messed it up because I was going back and forth between GitHub.com and my Linux box. I've reset the head to the merge I did 30 min ago and have amended the commit to have a signature. Hopefully that fixed it. |
|
The tests seem green - did the rerun fix them? |
|
/lgtm |
|
@jgallucci32 The failure seems to be a test flake not a race condition. |
|
@QiWang19 I found a better way to implement this which uses Event Listeners rather than sleep statements. This is just in case there is a race condition untested. If it passes all the checks I would prefer we use this option rather than a sleep statement since it uses a safer approach. |
Revert #6591 to fix issue with failed tests
This incorporates code from PR containers#6591 and containers#6614 but does not use event channels to detect container state and rather uses timers with a defined wait duration before calling t.StopAtEOF() to ensure the last log entry is output before a container exits. The polling interval is set to 250 milliseconds based on polling interval defined in hpcloud/tail here: https://github.com/hpcloud/tail/blob/v1.0.0/watch/polling.go#L117 Co-authored-by: Qi Wang <qiwan@redhat.com> Signed-off-by: jgallucci32 <john.gallucci.iv@gmail.com>
This is a MERGED request from @QiWang19 and myself. It contains the test cases developed by her in addition to the modifications made to handle multiple cases. Close #6531
Fixes an issue with the first PR where a container would exit while following logs and the log tail continued to follow. This creates a subroutine which checks the state of the container and instructs the tailLog to stop when it reaches EOF.
Tested the following conditions: