Skip to content

fix: make hanwen FUSE Handle.Read() context-aware - #438

Merged
javi11 merged 1 commit into
mainfrom
fix/fuse-read-context-cancellation
Mar 23, 2026
Merged

fix: make hanwen FUSE Handle.Read() context-aware#438
javi11 merged 1 commit into
mainfrom
fix/fuse-read-context-cancellation

Conversation

@javi11

@javi11 javi11 commented Mar 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • FUSE reads could block indefinitely when NNTP servers hang, prefetch throttles deadlock, or pool connections are exhausted — unlike WebDAV which escapes via HTTP request context
  • Added readWithContext() and seekWithContext() helpers that wrap blocking I/O in goroutines with context select, returning EINTR on cancellation
  • Mirrors the proven readFullContext pattern already used in MetadataVirtualFile.ReadAt()

Test plan

  • go test ./internal/fuse/backend/hanwen/... -race -v — all 10 tests pass (3 new)
  • go vet ./internal/fuse/... — no issues
  • go build ./... — builds cleanly
  • Manual test: mount via FUSE, kill NNTP server mid-read, verify handle returns promptly instead of hanging

🤖 Generated with Claude Code

… forever

FUSE reads could block indefinitely when NNTP servers hang, prefetch
throttles deadlock, or pool connections are exhausted. Unlike WebDAV
(which escapes via HTTP request context), the hanwen FUSE Handle.Read()
called file.Seek/Read directly with no context checking.

Add readWithContext() and seekWithContext() helpers that wrap blocking
I/O in goroutines with context select, mirroring the proven
readFullContext pattern from MetadataVirtualFile.ReadAt(). On context
cancellation, returns EINTR; orphaned goroutines complete when
Handle.Release() calls file.Close().
@javi11
javi11 merged commit 835e876 into main Mar 23, 2026
2 checks passed
@javi11
javi11 deleted the fix/fuse-read-context-cancellation branch March 23, 2026 08:23
yoshitaka420 pushed a commit to yoshitaka420/altmount that referenced this pull request Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant