Server hangs after logging `Waiting on child channel`
**Environment:**
hummingbird 2.22.0
swift-nio 2.97.1
Running on macOS 26.4, exposed to public internet (so various shenanigans)
**Problem:**
Service stops accepting connections every few hours, right after the following log entry:
```
Waiting on child channel: setsockopt(socket:level:optionName:optionValue:optionLen:): Invalid argument) (errno: 22)
```
Unfortunately, I can't reproduce this exact problem yet.
Questions:
1. I don't understand why such an error throws all the way to the input stream handler ([possibly related](https://github.com/apple/swift-nio/issues/3479)).
2. If the inbound stream fails, the service shouldn't hang ([possibly related](https://github.com/apple/swift-nio/issues/3472)). Even termination would be preferable to hanging, because then the service can be restarted. Would it be appropriate to set `self.state = .shutdown` [here](https://github.com/hummingbird-project/hummingbird/blob/0435b066d883f2e8a4e8abe10e0d33cff3091877/Sources/HummingbirdCore/Server/Server.swift#L127)?
3. The only `setsockopt` call related to child connections seems to be SO_REUSEADDR, originating [here](https://github.com/hummingbird-project/hummingbird/blob/0435b066d883f2e8a4e8abe10e0d33cff3091877/Sources/HummingbirdCore/Server/Server.swift#L293). Does ist even make sense to set SO_REUSEADDR on child connections?
关闭于 2026-05-10 12 条评论