-
Notifications
You must be signed in to change notification settings - Fork 4.1k
fix(resource-monitoring): fix lsof file descriptor leak #9568
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
base: main
Are you sure you want to change the base?
Conversation
Learn moreAll Green is an AI agent that automatically: ✅ Addresses code review comments ✅ Fixes failing CI checks ✅ Resolves merge conflicts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 issues found across 2 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="extensions/cli/src/services/ResourceMonitoringService.test.ts">
<violation number="1" location="extensions/cli/src/services/ResourceMonitoringService.test.ts:124">
P2: Leak regression test is ineffective: it performs no assertion when lsof is unavailable and doesn’t verify lsof call frequency, so a leak can slip through undetected.</violation>
<violation number="2" location="extensions/cli/src/services/ResourceMonitoringService.test.ts:137">
P2: FD refresh interval test never exercises refresh and has no effective assertion; it always passes even if refresh doesn’t occur.</violation>
</file>
<file name="extensions/cli/src/services/ResourceMonitoringService.ts">
<violation number="1" location="extensions/cli/src/services/ResourceMonitoringService.ts:134">
P1: updateFileDescriptorCount() runs on every getCurrentResourceUsage call, spawning lsof every second despite intended 5s throttling</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
tests for this pr:
|

Description
Add caching mechanism for file descriptor count to avoid frequent lsof command execution. Implement periodic updates with configurable interval to maintain accuracy while preventing resource leaks. Add tests to verify caching behavior and update intervals.
Fixes: continue cli leaking
lsofexecs · Issue #9422 · continuedev/continueAI Code Review
@continue-reviewChecklist
Screen recording or screenshot
[ When applicable, please include a short screen recording or screenshot - this makes it much easier for us as contributors to review and understand your changes. See this PR as a good example. ]
Tests
Check which process is running the target script
Run the following command to find the process:
Observe the output and note the PID
→ The process ID (PID) is 13448.
Create a simple monitoring script to watch lsof behavior on that PID
Create a bash script (for example
monitor.sh) with the following content:Run the monitoring script
Execute it in the background or in another terminal:
(or
./monitor.shafterchmod +x monitor.sh)Observe the result
You will see frequent/tight timestamps whenever the command
lsof -p 13448is actively running: