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

fix deadlock collecting large logs #11496

Merged
merged 1 commit into from Feb 13, 2024
Merged

Conversation

ndeloof
Copy link
Contributor

@ndeloof ndeloof commented Feb 13, 2024

What I did
re-implement log consumer concurrency using a stop-signal channel to prevent more events write after printer stopped.

The original issue is that we receive the container die event while we still are processing a huge log, line by line. As a result the receiver already stopped processing events after ContainerEventExit, but the log writer still tries to write to channel, and has acquired the lock so is blocked on channel write

inspired by https://go101.org/article/channel-closing.html

Related issue
fixes #11493 (comment)

(not mandatory) A picture of a cute animal, if possible in relation to what you did

@ndeloof ndeloof force-pushed the large_logs_deadlock branch 2 times, most recently from 0d6efaa to f8c475e Compare February 13, 2024 15:55
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
@ndeloof ndeloof marked this pull request as ready for review February 13, 2024 17:05
Copy link
Member

@milas milas left a comment

Choose a reason for hiding this comment

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

👍🏻

Copy link

codecov bot commented Feb 13, 2024

Codecov Report

Attention: 9 lines in your changes are missing coverage. Please review.

Comparison is base (894ab41) 58.34% compared to head (65c9466) 58.32%.

Files Patch % Lines
pkg/compose/printer.go 85.48% 6 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11496      +/-   ##
==========================================
- Coverage   58.34%   58.32%   -0.02%     
==========================================
  Files         136      136              
  Lines       11587    11590       +3     
==========================================
  Hits         6760     6760              
- Misses       4166     4169       +3     
  Partials      661      661              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ndeloof ndeloof merged commit 07bda59 into docker:main Feb 13, 2024
28 checks passed
@ndeloof ndeloof deleted the large_logs_deadlock branch February 13, 2024 19:15
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.

[BUG] docker compose up --abort-on-container-exit not exiting when printing long log
2 participants