-
-
Notifications
You must be signed in to change notification settings - Fork 517
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Attaching a LogConsumer
to a container makes the test hang if the container exits
#1669
Comments
After giving this a bit of a deeper look, I suspect the problem might be in this part of the code: Lines 665 to 667 in 51cde33
Where, if an error occurs while reading the logs (such as the container getting terminated), the goroutine returns and never consumes stop: Line 644 in 51cde33
There seems to be an ongoing PR (#1278) revamping this code. |
Thanks for digging into it @roobre, indeed, I'm focusing this week in bugs, and I'll tackle that PR ASAP. IIRC there is a missing thing regarding running the code multiple times with
But I need to go back to it this week |
Could be the same issue as #1407 |
Fixes an issue where stopping the log producer would block indefinitely if the log producer has exited before. Closes testcontainers#1407, testcontainers#1669
Fixes an issue where stopping the log producer would block indefinitely if the log producer has exited before. Closes testcontainers#1407, testcontainers#1669
Fixes an issue where stopping the log producer would block indefinitely if the log producer has exited before. Closes testcontainers#1407, testcontainers#1669
Fixes an issue where stopping the log producer would block indefinitely if the log producer has exited before. Closes testcontainers#1407, testcontainers#1669
@roobre I'm closing this one as a duplicate of #1407. Thanks for your support, and sorry for taking that long in responding. Many times, the backlog gets shadowed by day-to-day duties 😞 |
Testcontainers version
v0.24.1
Using the latest Testcontainers version?
Yes
Host OS
Linux
Host arch
x86
Go version
1.21
Docker version
Client: Version: 24.0.5 API version: 1.43 Go version: go1.20.6 Git commit: ced0996600 Built: Wed Jul 26 21:44:58 2023 OS/Arch: linux/amd64 Context: default Server: Engine: Version: 24.0.5 API version: 1.43 (minimum version 1.12) Go version: go1.20.6 Git commit: a61e2b4c9c Built: Wed Jul 26 21:44:58 2023 OS/Arch: linux/amd64 Experimental: false containerd: Version: v1.7.6 GitCommit: 091922f03c2762540fd057fba91260237ff86acb.m runc: Version: 1.1.9 GitCommit: docker-init: Version: 0.19.0 GitCommit: de40ad0
Docker info
What happened?
When running a
GenericContainer
c
that terminates unexpectedly, if aLogConsumer
has been attached to the container withc.FollowOutput
and started withc.StartLogProducer
, calls toc.StopLogProducer
will block forever. Asc.Terminate
callsc.StopLogProducer
, this will cause a test to hang indefinitely ifc.Terminate
is called int.Cleanup
.See the following example:
The test above produces the output below and never terminates unless I send and interrupt with C-c.
This happens regardless of the exit code of the container.
Relevant log output
Additional information
No response
The text was updated successfully, but these errors were encountered: