Skip to content

tail: switch to polling when the directory is removed after the file event - #16898

Merged
sylvestre merged 4 commits into
uutils:mainfrom
sylvestre:tail-dir-removed-after-file-event
Nov 27, 2026
Merged

sylvestre merged 4 commits into
uutils:mainfrom
sylvestre:tail-dir-removed-after-file-event

Conversation

@sylvestre

Copy link
Copy Markdown
Contributor

With -F, if the followed file's removal was handled while its directory still existed, the later
removal of the directory was ignored, so tail never switched to polling. The directory's own
removal event is now handled too, which fixes the flaky tests/tail/inotify-dir-recreate (see
#4294).

Copilot AI balanced review requested due to automatic review settings November 27, 2026 08:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

Copilot AI balanced review requested due to automatic review settings November 27, 2026 08:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@github-actions

Copy link
Copy Markdown

GNU testsuite comparison:

Congrats! The gnu test tests/tail/inotify-dir-recreate is no longer failing!

Copilot AI balanced review requested due to automatic review settings November 27, 2026 10:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

With -F, the removal of the followed file can be handled while its
directory still exists. The later removal of the directory was then
ignored, so tail never reverted to polling and missed the file when it
was recreated. Whether this happens depends on timing: on CI,
tests/tail/inotify-dir-recreate failed in 33 of the last 45 GNU test
runs, while locally it rarely shows up unless the machine is loaded.
Move the 'directory containing watched file was removed' reporting out of
handle_event so the removal of the directory itself uses it directly,
instead of replaying a file removal event through handle_event.
tail checks --pid once per sleep interval, which was the same 1s as the
delay the test leaves after killing the process. On a slow runner, the
last append could then wake tail before it noticed the process was gone,
and get printed. Use -s.1 so the check happens well within that delay.

See uutils#16681
@sylvestre
sylvestre force-pushed the tail-dir-removed-after-file-event branch from 7d17aba to a93fce0 Compare November 27, 2026 14:13
Copilot AI balanced review requested due to automatic review settings November 27, 2026 14:13
@sylvestre
sylvestre enabled auto-merge (rebase) November 27, 2026 14:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@codspeed

codspeed Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will degrade performance by 4.53%

2 warnings, 2 notes

⚠️ 125 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

⚠️ 1 benchmark with a significant change ran on different hardware

Its base and head results were measured on machines with a different CPU, core count or memory, so the change might not come from the code. Run base and head on the same runner type.

Learn more about Macro Runners

See affected benchmarks

ℹ️ This run is excluded from the branch history

This commit was force-pushed, so this run no longer appears in the branch's performance history.

ℹ️ 1 benchmark has no flamegraph

The flamegraph wasn't generated: most of the time was spent in runtime internals, which would leave nothing useful to analyze.

See affected benchmarks

❌ 1 regressed benchmark
✅ 273 untouched benchmarks
⏩ 211 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ CPU Simulation df_deep_directory 894.8 µs 937.2 µs -4.53%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing sylvestre:tail-dir-removed-after-file-event (7d17aba) with main (932efe9)2

Open in CodSpeed

Footnotes

  1. 211 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

  2. No successful run was found on main (f5a7259) during the generation of this report, so 932efe9 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@sylvestre
sylvestre merged commit c4ef140 into uutils:main Nov 27, 2026
99 of 100 checks passed
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.

2 participants