vinodkc commented on code in PR #57202:
URL: https://github.com/apache/spark/pull/57202#discussion_r3566921018
##########
sql/connect/server/src/main/scala/org/apache/spark/sql/connect/service/SparkConnectService.scala:
##########
@@ -408,7 +408,21 @@ object SparkConnectService extends Logging {
case _ => NettyServerBuilder.forPort(port)
}
sb.maxInboundMessageSize(SparkEnv.get.conf.get(CONNECT_GRPC_MAX_INBOUND_MESSAGE_SIZE).toInt)
- .addService(sparkConnectService)
+ if (SparkEnv.get.conf.get(CONNECT_GRPC_KEEPALIVE_ENABLED)) {
+ val keepAliveTimeSeconds =
SparkEnv.get.conf.get(CONNECT_GRPC_KEEPALIVE_TIME)
+ // Detects a silently-dead client connection (e.g. a NAT gateway/load
balancer dropping
+ // an idle connection mapping without sending a TCP RST/FIN) via
gRPC/HTTP2 keepalive
+ // PINGs. permitKeepAliveTime must be <= the client's keepAliveTime
(matched here),
+ // otherwise the server rejects the client's keepalive PINGs as
"too_many_pings" and
+ // tears down every long-lived connection, not just dead ones.
+ sb.keepAliveTime(keepAliveTimeSeconds, TimeUnit.SECONDS)
+ sb.keepAliveTimeout(
+ SparkEnv.get.conf.get(CONNECT_GRPC_KEEPALIVE_TIMEOUT),
+ TimeUnit.SECONDS)
+ sb.permitKeepAliveTime(keepAliveTimeSeconds, TimeUnit.SECONDS)
Review Comment:
Fixed.
`permitKeepAliveTime` is now a fixed 10s floor
(`GRPC_KEEPALIVE_PERMIT_TIME_SECONDS`), decoupled from the server's own
keepAlive.time, per gRFC A8. Fixed the stale comment too and documented the
floor in the docs. Re-verified end-to-end with the proxy repro —
enabled/disabled behavior unchanged.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]