[ https://issues.apache.org/jira/browse/THRIFT-4600?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17938084#comment-17938084 ]
Jeffrey Tolar commented on THRIFT-4600: --------------------------------------- This would be helpful for us: we're talking to a Hive cluster via a load balancer. There's a very high chance that subsequent TCP connections will hit a different backend server, which causes problems for Hive. I believe the Hive protocol involves first calling {{{}OpenSession{}}}; that returns a handle that seems to be valid only on the server that created it - requests to other servers using that handle will fail. Additionally, Hive makes use of signed cookies: the secret used to sign the cookie [is randomly generated during startup|https://github.com/apache/hive/blob/f06aa9541cdfc314831c2026fcddd552042e3ea4/service/src/java/org/apache/hive/service/auth/HttpAuthService.java#L48-L49], which means that cookies generated by one server won't be accepted by another. I've got a monkey-patch for the Thrift client that works to allow connection reuse, but it'd be great if it could be addressed upstream - it looks like [https://github.com/apache/thrift/pull/2204] still applies cleanly. I've tested that patch locally, and it successfully allows connections to be reused (and resolves the issue we see when connections aren't reused). > Don't close the connection in flush for python THttpClient.py > ------------------------------------------------------------- > > Key: THRIFT-4600 > URL: https://issues.apache.org/jira/browse/THRIFT-4600 > Project: Thrift > Issue Type: Bug > Components: Python - Library > Affects Versions: 0.11.0 > Reporter: Finn Isaac Norris Colman > Priority: Major > Attachments: 1572.patch > > Time Spent: 50m > Remaining Estimate: 0h > > In thrift/lib/py/src/transport/THttpClient.py in the flush method it closes > and reopens the connection: > {noformat} > if self.isOpen(): > self.close() > self.open(){noformat} > > This code is closing the connection on every flush request. The flush request > occurs for every message send, which means that keep alive cannot be used. > Removing this code from flush means that keep alive can be used as the user > now has control over when the connection is closed. -- This message was sent by Atlassian Jira (v8.20.10#820010)