Skip to content

[ML] Fix flaky CIoManagerTest/testFileIoGood on linux-x86_64#3017

Open
edsavage wants to merge 1 commit intoelastic:mainfrom
edsavage:fix/flaky-iotest
Open

[ML] Fix flaky CIoManagerTest/testFileIoGood on linux-x86_64#3017
edsavage wants to merge 1 commit intoelastic:mainfrom
edsavage:fix/flaky-iotest

Conversation

@edsavage
Copy link
Copy Markdown
Contributor

@edsavage edsavage commented Apr 1, 2026

Fixes #2890

Summary

The CIoManagerTest/testFileIoGood test fails intermittently (~1% of the time) on linux-x86_64 CI with:

processedData.length() == threadReader.data().length() has failed [10000 != 8192]

The reader opens the output file while the writer is still flushing. It reads 8192 bytes (two filesystem pages), hits EOF, and gives up — but the remaining ~1.8KB hasn't been flushed from the kernel buffer yet on the loaded CI agent.

Fix: Retry up to 50 times, with a 400ms sleep (2 seconds total patience after the last successful read). This should be sufficient time for the kernel to flush the data, even under heavy CI load.

Test plan

Made with Cursor

The reader hits a premature EOF at 8192 bytes (two filesystem pages)
while the remaining ~1.8KB of data hasn't been flushed from the
kernel buffer yet. With MAX_EOF_RETRIES=10 and 40ms sleeps (400ms
total), the reader gives up before the flush completes on loaded CI
agents.

Increase MAX_EOF_RETRIES from 10 to 50 (2 seconds total patience)
which should be ample time for the kernel to flush a few KB of data.

Fixes elastic#2890

Made-with: Cursor
@prodsecmachine
Copy link
Copy Markdown

prodsecmachine commented Apr 1, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

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.

Test CIoManagerTest/testFileIoGood is flaky on linux-x86_64.

3 participants