Skip to content

docker: fix log stream leak on long lines - #4826

Open
blotus wants to merge 2 commits into
masterfrom
blotus/docker-datasource-accumulates-hundreds-of-open-l
Open

blotus wants to merge 2 commits into
masterfrom
blotus/docker-datasource-accumulates-hundreds-of-open-l

Conversation

@blotus

@blotus blotus commented Nov 13, 2026

Copy link
Copy Markdown
Member

Fixes #4781:

  • add a max_buffer_size config option
  • Lines too long are dropped and ignored without killing the stream
  • close docker log stream on retry/stop/oneshot
  • Make sure reader are not blocked on shutdown
  • Properly log read errors instead of a generic warning

@blotus blotus added this to the 1.8.3 milestone Nov 13, 2026
@github-actions

Copy link
Copy Markdown

@blotus: There are no area labels on this PR. You can add as many areas as you see fit.

  • /area agent
  • /area local-api
  • /area cscli
  • /area appsec
  • /area security
  • /area configuration
Details

I am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository.

@blotus blotus changed the title docker: docker: fix log stream leak on long lines Nov 13, 2026
@codecov

codecov Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.28571% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.03%. Comparing base (e20782b) to head (9f3fad6).

Files with missing lines Patch % Lines
pkg/acquisition/modules/docker/config.go 86.66% 2 Missing ⚠️
pkg/acquisition/modules/docker/run.go 93.75% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4826      +/-   ##
==========================================
+ Coverage   71.91%   72.03%   +0.11%     
==========================================
  Files         546      547       +1     
  Lines       37267    37314      +47     
==========================================
+ Hits        26801    26878      +77     
+ Misses      10465    10435      -30     
  Partials        1        1              
Flag Coverage Δ
bats 45.27% <4.28%> (-0.07%) ⬇️
unit-linux 50.05% <94.28%> (+0.09%) ⬆️
unit-windows 38.27% <77.14%> (+0.37%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@brunnojob brunnojob left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Reviewed the reader lifecycle and scanner changes against #4781. The stream is now closed on retry and shutdown, and the reader goroutine is waited out after cancellation; the scanner drops an overlong record while allowing the next line through. The container and service tests exercise both reader paths, including blocked downstream delivery and retry cleanup. This directly addresses the stream and file-descriptor accumulation described in the issue. I did not run the suite locally; CI remains the test verification.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docker datasource accumulates hundreds of open log streams / file descriptors, leading to excessive dockerd memory usage and host OOM (v1.8.0)

2 participants