dropbox / dropbox/PyHive

Databricks: Invalid token, server shutdown and bad http path are not handled

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

Description

In case when the token is invalid, just EOFError is raised, without any explanation. Though the response from a server contains a meaningful message.
TBinaryProtocol.trans contain code=403, message='forbidden' and headers. But never checked.

```
File "pyhive/hive.py", line 104, in connect
return Connection(*args, **kwargs)
File "pyhive/hive.py", line 249, in __init__
response = self._client.OpenSession(open_session_req)
File "TCLIService/TCLIService.py", line 187, in OpenSession
return self.recv_OpenSession()
File "TCLIService/TCLIService.py", line 199, in recv_OpenSession
(fname, mtype, rseqid) = iprot.readMessageBegin()
File "thrift/protocol/TBinaryProtocol.py", line 148, in readMessageBegin
name = self.trans.readAll(sz)
File "thrift/transport/TTransport.py", line 68, in readAll
raise EOFError()
EOFError
```

Same for bad HTTP path

put just 's' to HTTP path and other and keep other values from working connection settings
TBinaryProtocol.trans contain code=303, message='See other'

Same stack trace.

Also, EOFError raised when token invalidated after connection and when databricks cluster shutting down

The reason is thrift.transport.TTransport.TTransportBase.readAll just raises EOFError on the empty body regardless of response headers.

That may be the issue with thrift code.

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.