Fix profiling memory limit under a pre-existing hard rlimit#9126
Open
tautschnig wants to merge 1 commit into
Open
Fix profiling memory limit under a pre-existing hard rlimit#9126tautschnig wants to merge 1 commit into
tautschnig wants to merge 1 commit into
Conversation
The perf-record subprocess set its RLIMIT_AS with a hard limit of -1 (unlimited) in preexec_fn. Raising the hard limit requires privilege, so whenever the calling shell had already imposed a finite hard limit (e.g. an outer `ulimit -v`), setrlimit raised ValueError inside preexec_fn and the benchmark could not run at all. Set only the soft limit, clamped to the existing hard limit. Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes the profiling runner’s perf record subprocess setup so it no longer fails when invoked under an existing finite hard RLIMIT_AS (e.g., from an outer ulimit -v). Instead of attempting to raise the hard limit to “unlimited” (which can require privilege and can throw in preexec_fn), it now sets only the soft limit, clamped to the existing hard limit.
Changes:
- Add
_limit_address_space(memory_mb)helper to setRLIMIT_ASsoft limit while preserving the existing hard limit. - Replace the inline
setrlimit(..., (soft, -1))lambda with a call to the helper inrun_benchmark.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
kroening
approved these changes
Jul 22, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #9126 +/- ##
========================================
Coverage 80.83% 80.83%
========================================
Files 1715 1715
Lines 189948 189948
Branches 73 73
========================================
Hits 153540 153540
Misses 36408 36408 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The perf-record subprocess set its RLIMIT_AS with a hard limit of -1 (unlimited) in preexec_fn. Raising the hard limit requires privilege, so whenever the calling shell had already imposed a finite hard limit (e.g. an outer
ulimit -v), setrlimit raised ValueError inside preexec_fn and the benchmark could not run at all. Set only the soft limit, clamped to the existing hard limit.