Skip to content

Conversation

@mattsu2020
Copy link
Contributor

Adjust fd_soft_limit helper to expose the soft RLIMIT for reuse across the codebase.
Respect the soft limit when determining merge batch sizes so the external merge never exceeds the available file descriptors.
Fallback to a useful error message when retrieving the limit fails while parsing --batch-size.
Tests:

cargo build -p uu_sort
ulimit -n 7; ./target/debug/sort -n -m __test.* … (GNU sort-continue scenario)
ulimit -n 7; ./target/debug/sort -n -m __test.* - …

…mits

- Add `effective_merge_batch_size()` function to calculate batch size considering fd soft limit, with minimums and safety margins.
- Generalize fd limit handling from Linux-only to Unix systems using `fd_soft_limit()`.
- Update merge logic to use dynamic batch size instead of fixed `settings.merge_batch_size` to prevent fd exhaustion.
…dling

Replace direct call to get_rlimit()? with fd_soft_limit(), adding a check for None value to return a usage error if rlimit cannot be fetched. This improves robustness on Linux by ensuring proper error handling when retrieving the file descriptor soft limit.
@codspeed-hq
Copy link

codspeed-hq bot commented Nov 1, 2025

CodSpeed Performance Report

Merging #9107 will degrade performances by 2.13%

Comparing mattsu2020:sort_-compatibility (c4e8472) with main (975e18c)

Summary

❌ 1 regression
✅ 124 untouched

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
du_deep_tree[(100, 3)] 1.1 ms 1.2 ms -2.13%

@github-actions
Copy link

github-actions bot commented Nov 1, 2025

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/overlay-headers (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/sort/sort-continue is no longer failing!

@mattsu2020 mattsu2020 changed the title Fix: sort-continue.sh test Fix: GNU sort-continue.sh test Nov 3, 2025
@mattsu2020 mattsu2020 changed the title Fix: GNU sort-continue.sh test fix(sort): GNU sort-continue.sh test Nov 3, 2025
@anastygnome
Copy link
Contributor

@mattsu2020 hey, thanks for the PR. to fix the docs related issues, you'll need to escape the brackets as in the error log. The rest of the CI fails are unrelated.

@sylvestre sylvestre mentioned this pull request Nov 3, 2025
97 tasks
@github-actions
Copy link

github-actions bot commented Nov 3, 2025

GNU testsuite comparison:

Congrats! The gnu test tests/sort/sort-continue is no longer failing!

@mattsu2020
Copy link
Contributor Author

fix the docs related issues, you'll need to escape the brackets as in the error log.

This has been improved in another commit.

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