[ 
https://issues.apache.org/jira/browse/TINKERPOP-1726?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16369098#comment-16369098
 ] 

ASF GitHub Bot commented on TINKERPOP-1726:
-------------------------------------------

Github user spmallette commented on a diff in the pull request:

    https://github.com/apache/tinkerpop/pull/800#discussion_r169065664
  
    --- Diff: 
gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/AbstractChannelizer.java
 ---
    @@ -147,7 +149,12 @@ public void init(final 
ServerGremlinExecutor<EventLoopGroup> serverGremlinExecut
         public void initChannel(final SocketChannel ch) throws Exception {
             final ChannelPipeline pipeline = ch.pipeline();
     
    -        if (sslContext.isPresent()) pipeline.addLast(PIPELINE_SSL, 
sslContext.get().newHandler(ch.alloc()));
    +        sslContext.ifPresent(sslContext -> pipeline.addLast(PIPELINE_SSL, 
sslContext.newHandler(ch.alloc())));
    +
    +        // checks for no activity on a channel and triggers an event that 
is consumed by the OpSelectorHandler
    +        // and either closes the connection or sends a ping to see if the 
client is still alive
    +        if (supportsIdleMonitor())
    +            pipeline.addLast(new IdleStateHandler((int) 
(settings.idleReadLimit / 1000), (int) (settings.idleWriteLimit / 1000),0));
    --- End diff --
    
    The constructor for `IdleStateHandler` is seconds but all Gremlin Server 
time settings are milliseconds so i had to convert: 
https://netty.io/4.0/api/io/netty/handler/timeout/IdleStateHandler.html#IdleStateHandler-int-int-int-


> Support WebSockets ping/pong keep-alive in Gremlin server
> ---------------------------------------------------------
>
>                 Key: TINKERPOP-1726
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1726
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: server
>    Affects Versions: 3.2.5
>            Reporter: Andy Davidoff
>            Priority: Major
>
> The ping/pong keep-alive system that is part of the WebSockets spec provides 
> for successful identification of a dropped connection from either end of the 
> connection.
> Currently, the Java client successfully issues keep-alive pings and receives 
> pong replies from the server.  Unfortunately, the server does not actively 
> ping clients, nor does it discover and react to dead clients when keep-alive 
> fails.
> This can cause pending client writes to lock up the server indefinitely when 
> a client spontaneously disconnects.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to