Skip to content

Fix shutdown hang: add timeout to discovery entry deletion#362

Merged
0pcom merged 2 commits intoskycoin:developfrom
0pcom:fix/shutdown-hang
Apr 1, 2026
Merged

Fix shutdown hang: add timeout to discovery entry deletion#362
0pcom merged 2 commits intoskycoin:developfrom
0pcom:fix/shutdown-hang

Conversation

@0pcom
Copy link
Copy Markdown
Collaborator

@0pcom 0pcom commented Mar 31, 2026

Summary

  • Client.Close() called delEntry(context.Background()) with no timeout
  • When discovery is accessed over dmsg (which is being closed), the Entry() lookup falls back to HTTP-over-dmsg and hangs forever
  • Add a 5-second timeout context so Close() always completes
  • This was the root cause of dmsgweb being unkillable with Ctrl+C

Test plan

  • go build ./...
  • go test ./pkg/dmsg/... passes
  • golangci-lint run clean
  • Manual: run skywire dmsg web, Ctrl+C, verify process exits within ~5 seconds

🤖 Generated with Claude Code

0pcom added 2 commits March 31, 2026 18:52
Client.Close() called delEntry(context.Background()) which makes HTTP
requests to the discovery server with no timeout. When discovery is
accessed over dmsg (the transport being closed), the Entry() lookup
falls back to HTTP-over-dmsg which hangs forever since the dmsg
client is already shut down.

Add a 5-second timeout context so Close() always completes.
Add a hidden persistent flag --with-kill that enables the force-exit
goroutine (3x Ctrl+C = os.Exit). Available on all subcommands as a
safety net when graceful shutdown hangs.

Usage: skywire dmsg web --with-kill
@0pcom 0pcom merged commit ad75a7e into skycoin:develop Apr 1, 2026
3 checks passed
@0pcom 0pcom deleted the fix/shutdown-hang branch April 3, 2026 20:27
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