Description
Describe the bug
We have reports from the users that after keeping the app in the background for some time, when the app is brought back into the foreground all network requests fail until the app is re-launched. Internally, one of our employees encountered the same issue and in our logs, we see deadline exceeded (4): Timed out waiting for an HTTP/2 stream from the connection pool, cause: ioOnClosedChannel
error.
We use GRPCChannelPool
with the following initialization:
private let grpcEventLoopGroup = PlatformSupport.makeEventLoopGroup(loopCount: 1)
...
return try GRPCChannelPool.with(
target: .host(endpoint.url.absoluteString),
transportSecurity: .tls(.makeClientDefault(compatibleWith: grpcEventLoopGroup)),
eventLoopGroup: grpcEventLoopGroup, {
$0.idleTimeout = TimeAmount.minutes(5)
$0.connectionPool.connectionsPerEventLoop = 16
$0.connectionPool.maxWaitTime = .seconds(10)
}
)
swift-grpc version: 1.18.0
platform: iOS (all versions)
We are not sure if this is a bug, behavior by design, or we are not using the library correctly, so any help is highly appreciated!
To reproduce
This behavior is not easily reproducible.
Expected behavior
Users should be able to make network requests after bringing the app into the foreground after a long background stay.