[GH-ISSUE #3900] [Issue]: Concurrent connection deletion can restore dangling references #2110

Closed
opened 2026-10-21 05:45:27 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Xelvanis on GitHub (Jul 21, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3900

Summary

Deleting multiple API connections concurrently can cause their dangling-reference cleanup sweeps to overwrite each other, restoring a reference to an already deleted connection. A cleanup failure can also leave deletion and reference cleanup only partially applied.

Expected behavior

Deleting a connection and clearing every reference covered by the existing cleanup sweep should complete atomically. Concurrent connection deletions should preserve each other's cleanup.

Actual behavior

Each deletion currently removes the connection and then performs the cleanup outside a transaction. Concurrent sweeps can read the same original JSON and write different stale whole-object snapshots, allowing the last write to restore the other deleted ID. An error during cleanup can leave a deleted connection with remaining references.

Steps to reproduce

  1. Create connections A and B, then store references to both in the same chat metadata object.
  2. Delete A and B concurrently, as the Connections panel bulk-delete action does.
  3. Inspect the stored chat metadata; depending on write ordering, one deleted connection ID can remain or be restored.

Environment

  • Marinara Engine version: staging at 5704d8a80
  • Install type: source
  • OS + version: Not environment-specific; reproduced with the file-backed storage implementation
  • Browser or app shell: Not applicable to the server-side storage race

Logs, screenshots, or video

No application log is required. An isolated actual file-store reproduction confirmed the stale-write outcome before the fix.

Additional context

Follow-up to merged PR #3866. The bounded fix wraps deletion and the complete reference sweep in the existing file-store transaction, which serializes writers and rolls back in-process failures.

Template check

  • I DID NOT read this template and provide the requested details.
Originally created by @Xelvanis on GitHub (Jul 21, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3900 ## Summary Deleting multiple API connections concurrently can cause their dangling-reference cleanup sweeps to overwrite each other, restoring a reference to an already deleted connection. A cleanup failure can also leave deletion and reference cleanup only partially applied. ## Expected behavior Deleting a connection and clearing every reference covered by the existing cleanup sweep should complete atomically. Concurrent connection deletions should preserve each other's cleanup. ## Actual behavior Each deletion currently removes the connection and then performs the cleanup outside a transaction. Concurrent sweeps can read the same original JSON and write different stale whole-object snapshots, allowing the last write to restore the other deleted ID. An error during cleanup can leave a deleted connection with remaining references. ## Steps to reproduce 1. Create connections A and B, then store references to both in the same chat metadata object. 2. Delete A and B concurrently, as the Connections panel bulk-delete action does. 3. Inspect the stored chat metadata; depending on write ordering, one deleted connection ID can remain or be restored. ## Environment - Marinara Engine version: `staging` at `5704d8a80` - Install type: source - OS + version: Not environment-specific; reproduced with the file-backed storage implementation - Browser or app shell: Not applicable to the server-side storage race ## Logs, screenshots, or video No application log is required. An isolated actual file-store reproduction confirmed the stale-write outcome before the fix. ## Additional context Follow-up to merged PR #3866. The bounded fix wraps deletion and the complete reference sweep in the existing file-store transaction, which serializes writers and rolls back in-process failures. ## Template check - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:45:27 +07: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
Pasta-Devs/Marinara-Engine#2110
No description provided.