thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Engelbrecht <...@engelbrecht.com>
Subject Issues with client transport not closing sockets
Date Fri, 27 Sep 2013 10:21:42 GMT
Hi all, have been quietly following this mailinglist for a while and doing some thrift programming.


I have stumbeled onto a java issue which relates (indirectly) to garbage collection. 

If I create a client that connects to a server and then let the client fall out of scope the
clients socket stays open (probably until gc?) which can be a long while - in my testapp that
equated to more or less "forever". 

This would not be so bad with the exception that my TThreadPool server wont stop. 

I can get around this by manually closing the transports for the client but that is quite
ugly:

client.getInputProtocol().getTransport().close();
client.getOutputProtocol().getTransport().close();

I could keep the client transport instance around but then I need to maintain two variables
for one client. 

Wouldn't a .close() on the client be a better option? Or am I missing something?

Best regards
Dan Engelbrecht
Mime
View raw message