FD Leak Tracker
FD Leak Tracker
- [ ] Include this change in the Release Notes. If checked, you must provide an end-user friendly description for your change below
I used this locally to clear up the leaks in the remote runtime, such that as of writing it no longer seems to leak at all. (In my PR) I figured it may be useful to others in testing the docker runtime, which currently seems to leak like a sieve.
If the environment variable "DEBUG" is set to "1", This code monkey patches the socket and open methods such that when one of these is initialized a stack trace is recorded. If 5 minutes pass and the resource is not closed, we print the stack trace.
I dunno if this is something we want to permanently include in openhands, but it does make finding leaks easier.
To run this PR locally, use the following command:
docker run -it --rm -p 3000:3000 -v /var/run/docker.sock:/var/run/docker.sock --add-host host.docker.internal:host-gateway -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:95dc35d-nikolaik --name openhands-app-95dc35d docker.all-hands.dev/all-hands-ai/openhands:95dc35d
Thinking about this, I don't think it belongs in OpenHands - I'll create a separate open source utility for this over the weekend.
Thinking about this, I don't think it belongs in OpenHands - I'll create a separate open source utility for this over the weekend.
That makes sense. I was thinking another alternative could be evaluation/utils. The evaluation directory is already not only benchmarks, it also has integration tests for example, and some utility scripts that don't run during benchmarking.