Skip to content

Commit eafd0f5

Browse files
committed
fix(nfs): explicitly abort the server JoinHandle on shutdown
`tokio::pin!(server_handle)` plus dropping it at function end does not cancel a tokio task — the JoinHandle's Drop is a no-op for the underlying task. The NFS accept loop in `nfsserve::handle_forever()` would keep running after `mount_nfs` returned, leaking the bound TCP port until process exit. Caught by codex review on the Windows port PR. Now: explicit `.abort(); let _ = .await;` in the shutdown sequence.
1 parent 10d5740 commit eafd0f5

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/nfs.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,10 @@ pub async fn mount_nfs(
585585
}
586586
}
587587

588+
// Stop the NFS server task explicitly (dropping the JoinHandle does not
589+
// cancel a tokio task — the server would keep accept()ing on its socket).
590+
server_handle.abort();
591+
let _ = server_handle.await;
588592
#[cfg(windows)]
589593
portmapper_handle.abort();
590594

0 commit comments

Comments
 (0)