python-happybase / happybase

A developer-friendly Python library to interact with Apache HBase
https://happybase.readthedocs.io/
Other
611 stars 163 forks source link

thriftpy2.protocol.exc.TProtocolException: Bad protocol id in the message: 72 #244

Open xiasanshi opened 4 years ago

xiasanshi commented 4 years ago
connection = happybase.Connection( port=9090, protocol='compact')
print('All tables: ', connection.tables(), '\n')

errors:

Traceback (most recent call last):
  File "D:/python/workspace/spider/mo-spider-client/tests/test-happybase.py", line 62, in <module>
    main()
  File "D:/python/workspace/spider/mo-spider-client/tests/test-happybase.py", line 26, in main
    print('All tables: ', connection.tables(), '\n')
  File "D:\python\workspace\spider\mo-spider-client\venv\lib\site-packages\happybase\connection.py", line 242, in tables
    names = self.client.getTableNames()
  File "D:\python\workspace\spider\mo-spider-client\venv\lib\site-packages\thriftpy2\thrift.py", line 219, in _req
    return self._recv(_api)
  File "D:\python\workspace\spider\mo-spider-client\venv\lib\site-packages\thriftpy2\thrift.py", line 231, in _recv
    fname, mtype, rseqid = self._iprot.read_message_begin()
  File "D:\python\workspace\spider\mo-spider-client\venv\lib\site-packages\thriftpy2\protocol\compact.py", line 148, in read_message_begin
    % proto_id)
thriftpy2.protocol.exc.TProtocolException: Bad protocol id in the message: 72
hbase cmd is:hbase thrift start --infoport 9095 --port 9090 -threadpool --bind 0.0.0.0 --compact

hbase version is hbase-1.2.0-cdh5.14.2

wbolster commented 4 years ago

never seen this before. have you tried other thrift protocols?

see e.g. https://github.com/carpedm20/LINE/issues/26 for a similar error message

is this reproducable with python 3?

NicholasZXT commented 1 year ago

I encounterd the same error and solved it by checking hbase configuration in cloudera manager and ensure the following items off: hbase.regionserver.thrift.http = False hbase.thrift.support.proxyuser = False # maybe this one is not necessary but I have no idea why does it work, expecting someone else giving more detailed explainations.

aisk commented 9 months ago

Protocol id is the first byte of the response. The magic number 72 is the ascii code H.

I think you've connected to a HTTP Server with thrift client (happybase), the HTTP response format's first line is something like HTTP/1.1 200 OK.

MoonCesar commented 1 month ago

I encounterd the same error and solved it by checking hbase configuration in cloudera manager and ensure the following items off: hbase.regionserver.thrift.http = False hbase.thrift.support.proxyuser = False # maybe this one is not necessary but I have no idea why does it work, expecting someone else giving more detailed explainations.

this help me