PromptBase
PromptBase SelectGet Select
Close icon
General
Home
Marketplace
Create
Hire
Login
Chat
Sell
Explore

Skill Details

Runtime
Any model
Example user message
[userMessage]: Our Node/TypeScript service processes uploaded ZIPs. It opens an input stream, unzip parser, output streams, and sometimes a helper subprocess. If one entry fails validation, the function returns early. After hundreds of failed generated uploads, local tests reproduce EMFILE and open handles keep rising. Repair using temporary ZIPs and disposable subprocesses. Do not access customer files, change ulimit, or inspect production descriptors.
Example agent response
# 1. Repair Decision **Decision: EARLY-RETURN STREAM/PIPE/SUBPROCESS CLEANUP GAP FOUND — SAFE LOCAL PATCH AVAILABLE; production descriptor usage remains unverified.** # 2. Scope & Safety Boundary Reviewed upload handler, ZIP parser, streams, helper subprocess, validation branch, temp cleanup, tests, metrics, and docs. # 3. Handle Source Register Input stream, parser, output streams, helper process/stdio, and temp directory all have incomplete failure-path ownership. # 4. Acquire/Use/Release Trace Open resources → validation fails → early return bypasses stream destruction, process finalization, and temp cleanup. # 5. Leak Findings Cleanup is success-path-only; ownership is distributed; subprocess lifecycle lacks one awaited finalizer. # 6. Canonical Handle Contract Upload operation owns input/parser/temp resources; each writer owns its output until completion; helper wrapper owns process + stdio; all join one structured cleanup path. # 7. Repair Applied Prepared structured cleanup, centralized close/destroy helper, output cleanup on validation error, subprocess finalization, and temp cleanup. # 8. Retry / Cancellation / Ownership Safety Previous attempt releases all handles before retry. Cancellation enters the same cleanup path. # 9. Deterministic Leak Test Matrix 1. Success returns near baseline. 2. Validation failure returns near baseline. 3. Parser error cleans resources. 4. Output error cleans peers. 5. Helper failure closes stdio/reaps child. 6. Cancellation cleans resources. 7. 500 failures show no monotonic FD growth. 8. Temp dirs removed. # 10. Observability & Rollout Track owned opens/closes, helper finalization failures, and local leak-test deltas. # 11. Files Modified - `src/uploads/processZip.ts` - `src/uploads/archivePipeline.ts` - `src/process/helperProcess.ts` - `tests/uploadFdLeak.test.ts` # 12. Commands Executed - `npm test -- uploadFdLeak` - `npm run typecheck` - `npm run lint` # 13. Validation Repeated failure stability PASS; stream cleanup PASS; subprocess reap PASS; cancellation cleanup PASS; valid output regression PASS. # 14. Remaining Decisions & Handoff Owner decisions: operational alert thresholds. **Handoff: PATCH READY FOR LOCAL REVIEW — EARLY-RETURN HANDLE LEAKS REMOVED AND REPEATED-FAILURE TESTS STABLE LOCALLY; PRODUCTION DESCRIPTOR USAGE NOT VERIFIED.**
Cursor Skill

Repair File Descriptor Leaks

Add to Cart
PromptBase Select
Get this skill + 9 more with Select$14 your first month, then $19/mo$14 first month, then $19/mo
View Select
Instant accessInstant access
Usage rightsCommercial use
Money-back guaranteeMoney‑back
By purchasing this skill, you agree to our terms of service
Tested icon
Guide icon
Free credits icon
Repair file descriptor leaks across files, streams, sockets, pipes, subprocess stdio, filesystem watchers, temporary resources, and disposable handles. This skill finds missing close paths, early-return leaks, cancellation gaps, watcher accumulation, stream-error leaks, and retry-created handles; then prepares structured cleanup, deterministic repeated-use leak tests, ownership controls, and observability without inspecting production descriptors, killing processes, or changing OS limits.
...more
Added over 1 month ago
Report
Browse Marketplace