Skip to content
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

Bugfix: log-consumer go-routine should recover from closed-connection #369

Merged

Conversation

Chrisss93
Copy link
Contributor

As best I can tell, a direct commit to the master branch bc6fdab made an attempt at recovering the log-position of a container in the scenario of a closed connection. The logic is all sound, but I think the string used to detect a closed-connection is not (has never been) correct.

The source of the error is internal/poll's errNetClosing. It's error string has been set as: "use of closed network connection" since the beginning (5 years ago). Of course it would be much cleaner to detect a connection-closed error without string-matching but as stated in the mentioned commit, the error type for this was only exported by the net package in go 1.16

@codecov
Copy link

codecov bot commented Oct 27, 2021

Codecov Report

Merging #369 (5b7ab5b) into master (1b9fe0b) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #369   +/-   ##
=======================================
  Coverage   62.66%   62.66%           
=======================================
  Files          15       15           
  Lines        1015     1015           
=======================================
  Hits          636      636           
  Misses        280      280           
  Partials       99       99           
Impacted Files Coverage Δ
docker.go 66.25% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1b9fe0b...5b7ab5b. Read the comment docs.

nginx.FollowOutput(&consumer)

// Gather the initial container logs
time.Sleep(time.Second * 1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you foresee medium-term, potential issues with the sleep time not being enough?

Copy link
Member

@mdelapenya mdelapenya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this contribution @Chrisss93 ! I do not see anything weird with it, so LGTM

About bc6fdab, it was not a direct commit to master but a PR: #323 😉

Copy link
Member

@gianarb gianarb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!

@gianarb gianarb merged commit f4ad58c into testcontainers:master Dec 3, 2021
@Chrisss93 Chrisss93 deleted the fix-log-follow-net-err-closed branch May 12, 2022 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants