Skip to content

Fix profiling memory limit under a pre-existing hard rlimit#9126

Open
tautschnig wants to merge 1 commit into
diffblue:developfrom
tautschnig:fix/profiling-memory-limit
Open

Fix profiling memory limit under a pre-existing hard rlimit#9126
tautschnig wants to merge 1 commit into
diffblue:developfrom
tautschnig:fix/profiling-memory-limit

Conversation

@tautschnig

Copy link
Copy Markdown
Collaborator

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.

  • Each commit message has a non-empty body, explaining why the change was made.
  • n/a Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • n/a The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.

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>
@tautschnig tautschnig self-assigned this Jul 22, 2026
Copilot AI review requested due to automatic review settings July 22, 2026 09:10
@tautschnig
tautschnig requested a review from a team as a code owner July 22, 2026 09:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 set RLIMIT_AS soft limit while preserving the existing hard limit.
  • Replace the inline setrlimit(..., (soft, -1)) lambda with a call to the helper in run_benchmark.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.83%. Comparing base (f71fdad) to head (83d6392).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

3 participants