Skip to content

timeout: Implemention for windows - #13363

Merged
sylvestre merged 7 commits into
uutils:mainfrom
nikolalukovic:fix/6200
Jul 27, 2026
Merged

timeout: Implemention for windows#13363
sylvestre merged 7 commits into
uutils:mainfrom
nikolalukovic:fix/6200

Conversation

@nikolalukovic

Copy link
Copy Markdown
Contributor

Attempts to fix #6200

@nikolalukovic nikolalukovic changed the title timeout: Implement timeout for windows timeout: Implemention for windows Jul 11, 2026
@github-actions

github-actions Bot commented Jul 11, 2026

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/pr/bounded-memory (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/cut/bounded-memory (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tail/follow-name (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tail/tail-n0f (passes in this run but fails in the 'main' branch)
Note: The gnu test tests/cut/cut-huge-range is now being skipped but was previously passing.
Congrats! The gnu test tests/seq/seq-epipe is now passing!

@Alonely0

Copy link
Copy Markdown
Contributor

how nicely does this play with #13237 ?

@nikolalukovic

nikolalukovic commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

how nicely does this play with #13237 ?

nothing in unix world was changed, just shuffled in diff files, when your PR gets merged I'll just rebase

@Alonely0

Copy link
Copy Markdown
Contributor

Nice then. Quite happy we're getting timeout on Windows land. Let me get this reviewed soon-ish.

@codspeed-hq

codspeed-hq Bot commented Jul 20, 2026

Copy link
Copy Markdown

Merging this PR will regress 1 benchmark

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 8 improved benchmarks
❌ 1 regressed benchmark
✅ 330 untouched benchmarks
🆕 6 new benchmarks
⏩ 46 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Memory seq_large_integers 52.8 KB 81 KB -34.74%
Memory timeout_quick_exit 79 KB 16.2 KB ×4.9
Simulation timeout_quick_exit 197.6 µs 87.7 µs ×2.3
Simulation seq_large_integers 2 ms 1.1 ms +92.83%
Memory sort_general_numeric[200000] 22.8 MB 16.7 MB +36.47%
Simulation seq_formatted 94.7 ms 77 ms +23%
Memory timeout_enforced 19.4 KB 16.5 KB +17.81%
Simulation sort_general_numeric[200000] 697.5 ms 625.9 ms +11.43%
Simulation timeout_enforced 92.8 µs 89.4 µs +3.77%
🆕 Memory timer_expiry_latency[0.001] N/A 79.9 KB N/A
🆕 Memory timer_expiry_latency[0.005] N/A 17 KB N/A
🆕 Memory timer_expiry_latency[0.02] N/A 17 KB N/A
🆕 Simulation timer_expiry_latency[0.001] N/A 200.9 µs N/A
🆕 Simulation timer_expiry_latency[0.005] N/A 93.1 µs N/A
🆕 Simulation timer_expiry_latency[0.02] N/A 92.2 µs N/A

Tip

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


Comparing nikolalukovic:fix/6200 (abe0c7d) with main (2adc40e)2

Open in CodSpeed

Footnotes

  1. 46 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 (bd73c58) during the generation of this report, so 2adc40e was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@Alonely0 Alonely0 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.

This looks super nice, so lots of thanks for the work! If my other PR lands first, we should be able to enable the benchmarks on *nix as well, and I would hope the rebase/merge isn't too bad; it mostly seems that src/uu/timeout/src/platform/unix.rs would get significantly shrunk (since the logic is moven to uucore), and we'd remove the SIGNALED logic from timeout.rs altogether.

This is a lot of code, so I'll read it with fresh eyes again tomorrow or this week. Also btw, thanks for the new benches!

Comment thread Cargo.toml
]
# "feat_os_windows" == set of utilities which can be built/run on modern windows platforms
feat_os_windows = ["feat_Tier1", "stdbuf"]
feat_os_windows = ["feat_Tier1", "stdbuf", "timeout"]

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.

Not sure if we should instead move timeout to tier 1 if we get Windows support.

cc @sylvestre

Comment thread src/uucore/src/lib/features/process/windows.rs
Comment thread src/uucore/src/lib/features/process/windows.rs
Comment thread src/uu/timeout/benches/timeout_bench.rs
Comment thread src/uu/timeout/src/platform/windows.rs Outdated
Comment thread src/uucore/src/lib/features/process/windows.rs
Comment thread src/uucore/src/lib/features/process/windows.rs
@nikolalukovic
nikolalukovic requested a review from Alonely0 July 21, 2026 18:33
@Alonely0

Copy link
Copy Markdown
Contributor

@nikolalukovic please merge/rebase when you have a moment. I have my review pretty much done, so I'll push the comments once the branch is up-to-date so GitHub doesn't have a stroke.

@nikolalukovic

Copy link
Copy Markdown
Contributor Author

@nikolalukovic please merge/rebase when you have a moment. I have my review pretty much done, so I'll push the comments once the branch is up-to-date so GitHub doesn't have a stroke.

done

@Alonely0 Alonely0 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.

Well this is awesome. I've spent the last couple of days testing it on my ARM64 Windows box and it's solid.

Other than my three small comments, this is A-OK from me. Thank you lots!

Comment on lines +251 to +252
// table in `uucore::signals`. Kept local so the `process` feature does not
// depend on the `signals` feature.

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.

Tbh it is perfectly acceptable for process to depend on signal. Last time I checked, it was only in use by timeout, anyway. Even so, given it leads to a cleaner codebase, it's okay; especially considering this way we don't hardcode them twice.

/// terminating a whole group requires a [`Job`].
pub fn send_signal_to_console_group(pid: u32, signal: usize) -> io::Result<()> {
match disposition(signal)? {
Disposition::Probe | Disposition::Ignore => Ok(()),

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.

What is the reason we ignore Probe? Is it not supported by Windows? Asking because we do not do the same in the functions below or above.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

not supported by windows so just noop-ed

Comment on lines +413 to +416
LAST_CTRL_SIGNAL.store(signal, Ordering::Release);
if let Some(event) = WAKE_EVENT.get() {
let _ = sys::set_event(event.as_handle());
}

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

nice

@sylvestre
sylvestre merged commit 9d0c43a into uutils:main Jul 27, 2026
165 of 166 checks passed
@Alonely0

Copy link
Copy Markdown
Contributor

Neat!

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.

timeout (uu_timeout) for Windows

3 participants