dh-cloud commented on code in PR #2915:
URL: https://github.com/apache/tinkerpop/pull/2915#discussion_r1861788192
##########
gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/GremlinServer.java:
##########
@@ -146,6 +146,11 @@ public synchronized
CompletableFuture<ServerGremlinExecutor> start() throws Exce
b.childOption(ChannelOption.WRITE_BUFFER_WATER_MARK,
new WriteBufferWaterMark(settings.writeBufferLowWaterMark,
settings.writeBufferHighWaterMark));
b.childOption(ChannelOption.ALLOCATOR,
PooledByteBufAllocator.DEFAULT);
+ // Enable TCP Keep-Alive to detect if the remote peer is still
reachable.
+ // Keep-Alive sends periodic probes to check if the remote peer is
still active.
+ // If the remote peer is unreachable, the connection will be
closed, preventing resource leaks and
+ // avoiding the maintenance of stale connections.
+ b.childOption(ChannelOption.SO_KEEPALIVE, true);
Review Comment:
@andreachild
Yes, I agree that we can also add handling for idle connections, but the
**original intention** of this PR was to **destroy broken connections**,
especially in scenarios like the following: when a client establishes a long
connection with the gremlin-server, and then the client's network card is
suddenly unplugged to simulate a client-side network issue. In this case, when
the server uses netstat -antp to check, the connection still appears to be
established, but using the ping command to test the client's address fails, and
this connection will never be destroyed. I have reproduced this scenario.
Feel free to let me know if you need any further adjustments!
--
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]