-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(runtime): use prlimit
to limit resource usage of command to avoid OOM Runtime Kill
#6338
Merged
Conversation
This file contains 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
@xingyaoww are you still diagnosing the issues? |
@mamoodi yes! |
- Add MemoryMonitor class to monitor and limit memory usage - Set soft limit at 3.5GB to warn about high memory usage - Set hard limit at 3.8GB to kill process before k8s OOM - Add psutil dependency for memory monitoring - Integrate memory monitoring into ActionExecutor
…ocker respect the resource requirement but failed
prlimit
to limit resource usage of command to avoid OOM Runtime Kill
neubig
reviewed
Feb 10, 2025
@neubig comment should be resolved now :) |
neubig
approved these changes
Feb 11, 2025
adityasoni9998
pushed a commit
to adityasoni9998/OpenHands
that referenced
this pull request
Mar 3, 2025
…oid OOM Runtime Kill (All-Hands-AI#6338) Co-authored-by: openhands <[email protected]> Co-authored-by: Engel Nyst <[email protected]> Co-authored-by: Graham Neubig <[email protected]>
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.
End-user friendly description of the problem this fixes or functionality that this introduces
Give a summary of what the PR does, explaining any non-trivial design decisions
This PR implements
limit
for all commands started within tmux so that we can avoid agents running commands that consume too much memory, which eventually can kill the whole runtime.This PR also add tests for this.
It can stop a stress test that tries to allocate 6G when we set a RUNTIME_MAX_MEMORY_GB of 3 GB

When increase RUNTIME_MAX_MEMORY_GB to 7GB, the same test will work:

Link of any specific issues this addresses
To run this PR locally, use the following command: