Repository navigation
File handles leak when the owning shell job is killed (File is already open for writing) #649
Copy link
Copy link
Open
Labels
agent/needs-infoThe agent has posted clarifying questions; waiting for the reporter.The agent has posted clarifying questions; waiting for the reporter.area/fsfs/ — filesystem drivers (FAT, ext2, HFS+, NTFS, ISO9660, ExFAT).fs/ — filesystem drivers (FAT, ext2, HFS+, NTFS, ISO9660, ExFAT).kind/bugConfirmed bug report with a repro or stack trace.Confirmed bug report with a repro or stack trace.
Description
Activity
- addedkind/bugConfirmed bug report with a repro or stack trace.Confirmed bug report with a repro or stack trace.area/fsfs/ — filesystem drivers (FAT, ext2, HFS+, NTFS, ISO9660, ExFAT).fs/ — filesystem drivers (FAT, ext2, HFS+, NTFS, ISO9660, ExFAT).
on Sep 17, 2026 - addedno-autoSkip all automation; human drives via /oc and /run only.Skip all automation; human drives via /oc and /run only.
on Sep 24, 2026 /oc triage
Reacted by Levente SánthaTriage
- Area: area/fs (Sub: generic VFS file-handle manager; filesystem type not identified)
- Kind: kind/bug
- Repro: needs more info from reporter
- Blast radius: L1 class (FileHandleManager/FileHandleImpl in org.jnode.fs.service.def); cleanup behavior may touch the file-write path, but the implementation entry points are not yet confirmed
- Expected scope: Inspect and update
fs/src/fs/org/jnode/fs/service/def/FileHandleManager.javaand its handle implementation, with a focused lifecycle regression test; do not change ASM, public APIs, or unrelated shell behavior - Test path:
sh build.sh -f fs/build-tests.xml all-junit, plus a 32-bit QEMU/VirtualBox run reproducing the kill-and-reopen sequence - Merge signal: human-review (filesystem write-path behavior; requires VM-level verification)
- Gaps: exact build target, filesystem/device identification, and complete boot/run reproduction are missing; these are blocking for DEV
- Suggested next: needs-info
- Split proposal: none - likely focused if the missing runtime details keep the fix within the file-handle package
- Labels applied: kind/bug, area/fs, no-auto (audit confirmed; no removals)
Auto-run: skipped (no-auto)
Needs the following before work can start:
- Which exact build command and target produced the tested ISO (
sh build.sh <target>)? - What filesystem is mounted at
/devices/hdb1, and what device/mount setup command created it? - What exact VirtualBox/QEMU command and serial
--interruptsequence was used, including the 20–60 line log around the first killed job and retry?
(empty)
- addedagent/needs-infoThe agent has posted clarifying questions; waiting for the reporter.The agent has posted clarifying questions; waiting for the reporter.and removedno-autoSkip all automation; human drives via /oc and /run only.Skip all automation; human drives via /oc and /run only.
on Sep 24, 2026 /run
/oc Please proceed with this task.
Reacted by Levente Sántha🤖 Working on this. Run: automatic
Plan: inspect FileHandleManager and VmThread lifecycle; implement the smallest thread-safe cleanup fix; add focused regression coverage; run filesystem tests and validation.- addedagent/in-progressThe OpenCode agent is currently working on this issue.The OpenCode agent is currently working on this issue.and removedagent/in-progressThe OpenCode agent is currently working on this issue.The OpenCode agent is currently working on this issue.
on Sep 25, 2026 /oc Please proceed with this task.
Reacted by Levente Sántha/oc Please proceed with this task.
Reacted by Levente SánthaCreated PR #667
Metadata
Metadata
Assignees
Labels
agent/needs-infoThe agent has posted clarifying questions; waiting for the reporter.The agent has posted clarifying questions; waiting for the reporter.area/fsfs/ — filesystem drivers (FAT, ext2, HFS+, NTFS, ISO9660, ExFAT).fs/ — filesystem drivers (FAT, ext2, HFS+, NTFS, ISO9660, ExFAT).kind/bugConfirmed bug report with a repro or stack trace.Confirmed bug report with a repro or stack trace.


Summary
When a shell job holding a file open for writing is killed via job control (Ctrl-C), its file handle is never released. Any later attempt to open the same path for writing fails with
File is already open for writinguntil the VM is rebooted.Environment
0.2.9-dev(x86 32-bit), VirtualBox 7.2.6, serial consoleReproduction
FileOutputStream, e.g.:--interrupt, delivered as guest job-control ETX). The shell prints a stack trace showing the job died insideMauveDriver.main.Expected behavior
Thread death (including kill-by-job-control) releases that thread's file handles — or at minimum,
close()from another thread / a subsequent open is able to reclaim them. A single Ctrl-C should not permanently burn a pathname for the rest of the uptime.Suspected component
org.jnode.fs.service.def.FileHandleManager— handle table keyed without cleanup onVmThreadtermination. (Normalclose()path works; only the killed-thread path leaks.)Impact
Breaks the standard run-kill-retry loop for long guest-side jobs: every killed run forces the operator to mint a fresh output filename (or reboot), which complicates automated test harnesses.
Triage Addendum (auto, 2026-09-24)
fs/src/fs/org/jnode/fs/service/def/FileHandleManager.javaand its handle implementation, with a focused lifecycle regression test; do not change ASM, public APIs, or unrelated shell behaviorsh build.sh -f fs/build-tests.xml all-junit, plus a 32-bit QEMU/VirtualBox run reproducing the kill-and-reopen sequence## Triagecomment below.✅ Ticket Runner Status