[PR #4751] [CLOSED] fix(lldb): retain journal descriptor cleanup ownership #6387

Closed
opened 2026-10-31 01:14:05 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/4751
Author: @yadavd4631
Created: 10/17/2026
Status: ❌ Closed

Base: main ← Head: fix-lldb-journal-descriptor-cleanup


📝 Commits (1)

  • e7dd0d4 fix(lldb): retain journal descriptor cleanup ownership

📊 Changes

3 files changed (+441 additions, -137 deletions)

View changed files

📝 src/native/LldbCallTracer.ts (+230 -91)
📝 src/native/LldbRetainedObservations.ts (+130 -46)
📝 tests/boundary/providers/native/lldbCallTracerFailures.test.ts (+81 -0)

📄 Description

Summary

Reading back observation journals, output captures, and tracer output opened file handles with bare try/finally blocks that swallowed close() failures using .catch(() => undefined). When closing a descriptor failed, ownership of the handle was silently dropped, cleanup was reported as complete (cleanupIncomplete: false), and root.close() deleted the runtime directory while child file descriptors were still open.

Changes

  • Owned Readback Boundary: Route observation journal (observations.jsonl), capture files (stdout.capture, stderr.capture), and tracer results (result.json, pid) through readOwnedFile using withOwnedFileHandle.
  • Descriptor Ownership Retention: Track unclosed descriptor handles and exact cleanup failures in RetainedLldbResources.descriptors and retained.descriptorFailures.
  • Gated Runtime Root Removal: Gate root.close() on confirmed closure of all child descriptors (descriptors.size === 0) in addition to process-group and target termination.
  • Evidence Preservation: Retain parsed journal events and captured process outputs alongside incomplete cleanup reports (cleanupIncomplete: true, cleanupResources: [descriptorPath, root.path]).
  • Cleanup Retries: Retry closing retained descriptors in #retryPendingCleanup and tracer.close(), blocking subsequent traces until cleanup is resolved.
  • Regression Tests: Added regression tests in tests/boundary/providers/native/lldbCallTracerFailures.test.ts verifying that descriptor closure failure retains cleanup ownership, blocks subsequent runs with cleanup_incomplete, and cleans up during tracer.close().

Fixes #4742


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/4751 **Author:** [@yadavd4631](https://github.com/yadavd4631) **Created:** 10/17/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix-lldb-journal-descriptor-cleanup` --- ### 📝 Commits (1) - [`e7dd0d4`](https://github.com/morluto/rea/commit/e7dd0d41c863cb518e12400ce257f2f730b2d084) fix(lldb): retain journal descriptor cleanup ownership ### 📊 Changes **3 files changed** (+441 additions, -137 deletions) <details> <summary>View changed files</summary> 📝 `src/native/LldbCallTracer.ts` (+230 -91) 📝 `src/native/LldbRetainedObservations.ts` (+130 -46) 📝 `tests/boundary/providers/native/lldbCallTracerFailures.test.ts` (+81 -0) </details> ### 📄 Description ### Summary Reading back observation journals, output captures, and tracer output opened file handles with bare try/finally blocks that swallowed `close()` failures using `.catch(() => undefined)`. When closing a descriptor failed, ownership of the handle was silently dropped, cleanup was reported as complete (`cleanupIncomplete: false`), and `root.close()` deleted the runtime directory while child file descriptors were still open. ### Changes - **Owned Readback Boundary**: Route observation journal (`observations.jsonl`), capture files (`stdout.capture`, `stderr.capture`), and tracer results (`result.json`, `pid`) through `readOwnedFile` using `withOwnedFileHandle`. - **Descriptor Ownership Retention**: Track unclosed descriptor handles and exact cleanup failures in `RetainedLldbResources.descriptors` and `retained.descriptorFailures`. - **Gated Runtime Root Removal**: Gate `root.close()` on confirmed closure of all child descriptors (`descriptors.size === 0`) in addition to process-group and target termination. - **Evidence Preservation**: Retain parsed journal events and captured process outputs alongside incomplete cleanup reports (`cleanupIncomplete: true`, `cleanupResources: [descriptorPath, root.path]`). - **Cleanup Retries**: Retry closing retained descriptors in `#retryPendingCleanup` and `tracer.close()`, blocking subsequent traces until cleanup is resolved. - **Regression Tests**: Added regression tests in `tests/boundary/providers/native/lldbCallTracerFailures.test.ts` verifying that descriptor closure failure retains cleanup ownership, blocks subsequent runs with `cleanup_incomplete`, and cleans up during `tracer.close()`. Fixes #4742 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:14:05 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#6387
No description provided.