thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James E. King III (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (THRIFT-4252) Cannot shutdown Java server when clients are still connected
Date Thu, 05 Jul 2018 11:17:00 GMT

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

James E. King III commented on THRIFT-4252:
-------------------------------------------

The issue here is that once a client connects, if it sits idle, it will hold the server hostage
until it disconnects.  This is a duplicate of THRIFT-2441 which was fixed for C++ by adding
an interruptable socket pair mechanism to each connected client as part of a library refactoring.
 It looks like the same thing needs to be done on the Java side, or alternatively the Java
server could be taught to keep track of the clients and when the server executes stop() it
could close all the client transports in addition to the server socket.  (Close the server
socket first to prevent new clients during the remainder...)

> Cannot shutdown Java server when clients are still connected
> ------------------------------------------------------------
>
>                 Key: THRIFT-4252
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4252
>             Project: Thrift
>          Issue Type: Bug
>          Components: Java - Library
>    Affects Versions: 0.10.0
>            Reporter: Mario Emmenlauer
>            Priority: Major
>
> I found issue https://issues.apache.org/jira/browse/THRIFT-2441 and I believe that the
same problem still exists in the Java servers, and I'm affected by it. Short summary: I can
not shut down the Java server (neither TSimpleServer nor TThreadedServer) while clients are
still connected. That is pretty bad, because essentially the clients are not under by control,
but they can essentially "block" server maintenance operations by blocking the shutdown.
> *In more detail:* I have a Java TSimpleServer runnable in a thread running. The main
thread eventually asks the server to stop(). But they seem to ignore the request. I checked
the code of TSimpleServer.java and I'm under the impression that the innermost loop the server
does not poll the variable stopped_ or does it? Looking at https://github.com/apache/thrift/blob/master/lib/java/src/org/apache/thrift/server/TSimpleServer.java
from line 76:
> {code}
>           while (true) {
>             if (eventHandler_ != null) {
>               eventHandler_.processContext(connectionContext, inputTransport, outputTransport);
>             }
>             if(!processor.process(inputProtocol, outputProtocol)) {
>               break;
>             }
>           }
> {code}
> I found that this loop is only interrupted if the client disconnects. I tried changing
{{while(true)}} for {{while(!stopped_)}} but that did not help. I guess that one of the methods
in the loop must be blocking.



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

Mime
View raw message