mirror of
https://github.com/RhapsodiOS/RhapsodiOS.git
synced 2026-11-03 22:01:40 -07:00
[GH-ISSUE #67] net: stress-net fdpass (SCM_RIGHTS over Unix sockets) intermittently hangs until the watchdog #60
Labels
No labels
bug
documentation
enhancement
enhancement
good first issue
help wanted
help wanted
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github-starred/RhapsodiOS#60
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @raynorpat on GitHub (Oct 19, 2026).
Original GitHub issue: https://github.com/RhapsodiOS/RhapsodiOS/issues/67
Symptom
stress-net fdpasshangs until its watchdog fires:STRESS net fdpass FAIL reason=timeout secs=600.--fsacceptance, UFS run (2026-10-19, #60 kernel): it hung again. That guest's clock ran at half speed (#64), so the 600 s watchdog was about 20 real minutes, which makes this a real hang, not a slow test.lost-childcheck: the leader now ends withFAIL reason=lost-childwhenwaitpidreports no children while it still counts live workers. It did not fire, so on this occurrence the workers were still alive, orwaitpidwas not returning ECHILD.Reproduce
Intermittent.
run 1orrun -a 1with all categories, or a soak, on the dev guest.fdpasspasses file descriptors over Unix-domain sockets withSCM_RIGHTSbetween worker processes (src/Commands/stress/net/net.c).Evidence:
vm/work/stress-suite-evidence/phase3/final/fdpass-hang-note.md(phase 3: process state, analysis)vm/work/ffsbench/runs/p4-accept/stress-0/net.out(phase 4)Where to look
SCM_RIGHTShandling inbsd/kern/uipc_usrreq.c(unp_internalize/unp_externalize);soreceivewaiting for a message whose rights could not be attached;sosendon a full socket buffer whose reader has died.vm/work/issue59/fw*.txtshow how. If it turns out to be a test bug (both ends waiting on each other by design), fix the test instead.Found by the stress suite.
@raynorpat commented on GitHub (Oct 20, 2026):
Fixed by
0a354086c(ffs: reclaim an old fifo's or device's vnode when ffs_valloc reuses its inode, so a new file does not keep fifo ops), merged into ffs-perf in240f072ca.Not #71: it reproduced on a kernel with the FSAVE workaround (ffs-perf
4fd6d07b6): fdpass besidestress-misc fifoin the same directory hung 3 times out of 3, within about a minute.Not a socket bug. gdbstub showed:
select, its workers exiting (P_WEXIT, offallproc, sopscan't see them) but not yet zombies. Sowaitpidreturned 0, and the lost-child check never fired.write()to a newly created regular file wentvn_write→ufsfifo_write→fifo_write→sosend(0xf000ff53), a garbage socket pointer. The new file's vnode was VREG, mode 0100600, but itsv_opwasffs_fifoop_p.Root cause:
ufs_inactive(ufs_inode.c~117) frees the inode in the cylinder-group bitmap before it recycles the vnode (~130).ffs_valloc(ffs_alloc.c~669) reallocates that inode in between,VFS_VGETreturns the old vnode from the inode hash.v_un(fifo info) is reused asvm_info, so the next write goes throughfifo_writewith a garbage socket.trap.c(~255-272) treats a kernel fault belowKERNEL_LINEAR_BASElike a user fault, sending the thread back to user mode with kernel registers. That is the endless loop.Fix: if the vnode
ffs_vallocgets back doesn't haveffs_vnodeop_p, it is released withvput(itsi_modeis 0, soufs_inactivereclaims it), andffs_vallocfetches a fresh vnode. Device vnodes are covered by the same check.Verified on the fixed kernel (cksum 606865771):
fsck -nclean.make check-net,check-miscandcheck-fspass.Found along the way, not fixed here:
unp_gcinuipc_usrreq.ccan freeze the guest. A socketpair carrying an open file plus its own peer spins forever insbflush.trap.cbehaviour above turns any kernel NULL dereference in a syscall into an unkillable, invisible loop.