when hy2 realm network is unstable, crash on no STUN responses received.
### Operating system
Linux
### System version
Ubuntu 24.04
### Installation type
Original sing-box Command Line
### If you are using a graphical client, please provide the version of the client.
_No response_
### Version
```shell
1.14.0-alpha.22
```
### Description
when network is unstable,hy2 realm should retry with a set interval instead of crash on no STUN responses received.
### Reproduction
1. configure hy2 with realm
2. unplug network cable
3. start sing-box
4. connect to network
5. sing-box crash
### Logs
```shell
+0000 2026-05-12 04:29:11 WARN inbound: close inbound/hysteria2[hysteria2] take too much time to finish!
ERROR[0024] sing-box did not closed properly: file already closed
start inbound/hysteria2[hysteria2]: start realm server: initial STUN discovery: no STUN responses received
goroutine 1 [running]:
runtime/debug.Stack()
runtime/debug/stack.go:26 +0x5e
runtime/debug.PrintStack()
runtime/debug/stack.go:18 +0x13
github.com/sagernet/sing-box.(*Box).Start.func1()
github.com/sagernet/sing-box/box.go:479 +0x96
panic({0x49bdc0?, 0x475a670?})
runtime/panic.go:783 +0x132
internal/sync.(*Mutex).Lock(...)
internal/sync/mutex.go:63
sync.(*Mutex).Lock(...)
sync/mutex.go:46
github.com/sagernet/fswatch.(*Watcher).Close(0x0)
github.com/sagernet/fswatch@v0.1.2/watcher.go:107 +0x3c
github.com/sagernet/sing/common.Close({0xc000ac71a8?, 0x1?, 0x0?})
github.com/sagernet/sing@v0.8.10-0.20260428084616-2bc976d03e39/common/cond.go:361 +0x15b
github.com/sagernet/sing-box/common/tls.(*STDServerConfig).Close(0x2414be5?)
github.com/sagernet/sing-box/common/tls/std_server.go:323 +0x85
github.com/sagernet/sing/common.Close({0xc000ac7268?, 0xc000ac7298?, 0x24a8f95?})
github.com/sagernet/sing@v0.8.10-0.20260428084616-2bc976d03e39/common/cond.go:361 +0x15b
github.com/sagernet/sing-box/protocol/hysteria2.(*Inbound).Close(0xc0003f23e0?)
github.com/sagernet/sing-box/protocol/hysteria2/inbound.go:257 +0x86
github.com/sagernet/sing-box/adapter/inbound.(*Manager).Close(0xc000198d20)
github.com/sagernet/sing-box/adapter/inbound/manager.go:74 +0x45b
github.com/sagernet/sing-box.(*Box).Close(0xc0006e5d40)
github.com/sagernet/sing-box/box.go:585 +0x282
github.com/sagernet/sing-box.(*Box).Start(0xc0006e5d40)
github.com/sagernet/sing-box/box.go:483 +0x194
main.create()
github.com/sagernet/sing-box/cmd/sing-box/cmd_run.go:160 +0x456
main.run()
github.com/sagernet/sing-box/cmd/sing-box/cmd_run.go:174 +0x105
main.init.func26(0xc000326b00?, {0x937de3?, 0x4?, 0x937de7?})
github.com/sagernet/sing-box/cmd/sing-box/cmd_run.go:30 +0x17
github.com/spf13/cobra.(*Command).execute(0x478f940, {0xc0002bd6a0, 0x2, 0x2})
github.com/spf13/cobra@v1.10.2/command.go:1019 +0xae7
github.com/spf13/cobra.(*Command).ExecuteC(0x478a8c0)
github.com/spf13/cobra@v1.10.2/command.go:1148 +0x465
github.com/spf13/cobra.(*Command).Execute(...)
github.com/spf13/cobra@v1.10.2/command.go:1071
main.main()
github.com/sagernet/sing-box/cmd/sing-box/main.go:8 +0x1e
panic on early start: runtime error: invalid memory address or nil pointer dereference
```
### Supporter
- [ ] I am a [sponsor](https://github.com/sponsors/nekohasekai/)
### Integrity requirements
- [x] I confirm that I have read the documentation, understand the meaning of all the configuration items I wrote, and did not pile up seemingly useful options or default values.
- [x] I confirm that I have provided the server and client configuration files and process that can be reproduced locally, instead of a complicated client configuration file that has been stripped of sensitive data.
- [x] I confirm that I have provided the simplest configuration that can be used to reproduce the error I reported, instead of depending on remote servers, TUN, graphical interface clients, or other closed-source software.
- [x] I confirm that I have provided the complete configuration files and logs, rather than just providing parts I think are useful out of confidence in my own intelligence.
关闭于 2026-05-13 3 条评论