dropbox / dropbox/PyHive

[Errno 104] Connection reset by peer at big queries

Open
#344 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.7k
Forks
545
PR merge metrics
No merged PRs in 30d

Description

I have a huge query which takes on Hue (https://gethue.com/) around 15min and works fine but on my hive query I always get an error after around x time. Small queries work fine the python client but not big ones. Does somebody know how to fix this issue. I cant figure out something out of the error message. I'm running the whole thing on a juypterlab docker.

## Code

```python
conn = hive.Connection(
host="xxxxxxxx",
port=10000,
auth="KERBEROS",
database="xxxxxxxx",
kerberos_service_name="hive")

cur = conn.cursor()
cur.execute(query)
responde=cur.fetchall()
cur.close()
```

## Error message

---------------------------------------------------------------------------
ConnectionResetError Traceback (most recent call last)
/opt/conda/lib/python3.7/site-packages/thrift/transport/TSocket.py in read(self, sz)
125 try:
--> 126 buff = self.handle.recv(sz)
127 except socket.error as e:

ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

TTransportException Traceback (most recent call last)
in
7
8 cur = conn.cursor()
----> 9 cur.execute(query)
10 responde=cur.fetchall()
11 cur.close()

/opt/conda/lib/python3.7/site-packages/pyhive/hive.py in execute(self, operation, parameters, **kwargs)
362 sql, runAsync=async_)
363 _logger.debug(req)
--> 364 response = self._connection.client.ExecuteStatement(req)
365 _check_status(response)
366 self._operationHandle = response.operationHandle

/opt/conda/lib/python3.7/site-packages/TCLIService/TCLIService.py in ExecuteStatement(self, req)
278 """
279 self.send_ExecuteStatement(req)
--> 280 return self.recv_ExecuteStatement()
281
282 def send_ExecuteStatement(self, req):

/opt/conda/lib/python3.7/site-packages/TCLIService/TCLIService.py in recv_ExecuteStatement(self)
290 def recv_ExecuteStatement(self):
291 iprot = self._iprot
--> 292 (fname, mtype, rseqid) = iprot.readMessageBegin()
293 if mtype == TMessageType.EXCEPTION:
294 x = TApplicationException()

/opt/conda/lib/python3.7/site-packages/thrift/protocol/TBinaryProtocol.py in readMessageBegin(self)
132
133 def readMessageBegin(self):
--> 134 sz = self.readI32()
135 if sz < 0:
136 version = sz & TBinaryProtocol.VERSION_MASK

/opt/conda/lib/python3.7/site-packages/thrift/protocol/TBinaryProtocol.py in readI32(self)
215
216 def readI32(self):
--> 217 buff = self.trans.readAll(4)
218 val, = unpack('!i', buff)
219 return val

/opt/conda/lib/python3.7/site-packages/thrift/transport/TTransport.py in readAll(self, sz)
60 have = 0
61 while (have < sz):
---> 62 chunk = self.read(sz - have)
63 chunkLen = len(chunk)
64 have += chunkLen

/opt/conda/lib/python3.7/site-packages/thrift_sasl/__init__.py in read(self, sz)
171 return ret
172
--> 173 self._read_frame()
174 return ret + self.__rbuf.read(sz - len(ret))
175

/opt/conda/lib/python3.7/site-packages/thrift_sasl/__init__.py in _read_frame(self)
175
176 def _read_frame(self):
--> 177 header = self._trans_read_all(4)
178 (length,) = struct.unpack(">I", header)
179 if self.encode:

/opt/conda/lib/python3.7/site-packages/thrift_sasl/__init__.py in _trans_read_all(self, sz)
196 except AttributeError:
197 read_all = self._trans.read # thriftpy
--> 198 return read_all(sz)
199
200 def close(self):

/opt/conda/lib/python3.7/site-packages/thrift/transport/TTransport.py in readAll(self, sz)
60 have = 0
61 while (have < sz):
---> 62 chunk = self.read(sz - have)
63 chunkLen = len(chunk)
64 have += chunkLen

/opt/conda/lib/python3.7/site-packages/thrift/transport/TSocket.py in read(self, sz)
138 raise TTransportException(type=TTransportException.TIMED_OUT, message="read timeout", inner=e)
139 else:
--> 140 raise TTransportException(message="unexpected exception", inner=e)
141 if len(buff) == 0:
142 raise TTransportException(type=TTransportException.END_OF_FILE,

TTransportException: unexpected exception

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.