Skip to content

ci: speed up OOM tests with configurable memory limit#1623

Merged
jpnurmi merged 1 commit intomasterfrom
jpnurmi/test/oom-limit
Apr 2, 2026
Merged

ci: speed up OOM tests with configurable memory limit#1623
jpnurmi merged 1 commit intomasterfrom
jpnurmi/test/oom-limit

Conversation

@jpnurmi
Copy link
Copy Markdown
Collaborator

@jpnurmi jpnurmi commented Apr 2, 2026

Set SENTRY_TEST_OOM_LIMIT=4095 (MiB, just under 4GB to avoid 32-bit overflow) in CI to limit process memory via a Windows Job Object. Without this, the OOM loop exhausts all virtual memory including pagefile, which is slow due to disk I/O. With the limit, malloc fails fast without paging.

Before, test_native_oom and test_crashpad_oom were each taking 60-70s in the CI. With the limit, they take only a few seconds using cached builds from other tests. So, this saves about 2 minutes.

NOTE: The limit only constrains user-mode allocations. It does not exhaust kernel pool memory like a real system-wide OOM would. Omit the environment variable to test real OOM behavior and regressions such as the original OOM-related OpenProcess bug in the native backend.

@jpnurmi jpnurmi requested review from tustanivsky April 2, 2026 12:47
@jpnurmi jpnurmi marked this pull request as ready for review April 2, 2026 13:19
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Set `SENTRY_TEST_OOM_LIMIT=4095` (MiB, just under 4GB to avoid
32-bit overflow) in CI to limit process memory via a Windows Job
Object. Without this, the OOM loop exhausts all virtual memory
including pagefile, which is slow due to disk I/O. With the limit,
malloc fails fast without paging.

NOTE: The limit only constrains user-mode allocations. It does not
exhaust kernel pool memory like a real system-wide OOM would. Omit
the environment variable to test real OOM behavior and regressions
such as the original `OpenProcess` bug in the native backend.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jpnurmi jpnurmi force-pushed the jpnurmi/test/oom-limit branch from a7cc1d3 to 66654de Compare April 2, 2026 13:30
@jpnurmi jpnurmi requested a review from mujacica April 2, 2026 13:42
@jpnurmi
Copy link
Copy Markdown
Collaborator Author

jpnurmi commented Apr 2, 2026

I suspect the newly added OOM tests are also responsible for occasional proxy test failures lately:

FAILED tests/test_integration_proxy.py::test_proxy_from_env - AssertionError

This test runs after the native OOM tests. Maybe the system doesn't recover fast enough, and therefore fails to run mitmdump?

https://github.com/getsentry/sentry-native/actions/runs/23899882603/job/69693579172

@jpnurmi jpnurmi merged commit a451844 into master Apr 2, 2026
54 checks passed
@jpnurmi jpnurmi deleted the jpnurmi/test/oom-limit branch April 2, 2026 14:35
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