python thrift error ```TSocket read 0 bytes```

后端 未结 4 1102
礼貌的吻别
礼貌的吻别 2021-02-20 04:30

My python version:2.7.8
thrift version:0.9.2
python-thrift version:0.9.2
OS: centOS 6.8
My test.thrift file:

const string HELLO_IN_KOREAN         


        
相关标签:
4条回答
  • 2021-02-20 05:17

    My OS environment problems.
    I change port 30303 to 9999, it run successfully.

    0 讨论(0)
  • 2021-02-20 05:18

    When you start the thrift service ,you need set protocol, like this:

    ./hbase-daemon.sh start thrift -c compact protocol;
    

    In your code, you need set protocol = 'compact', like this:

    con = happybase.Connection(host='localhost',port=your thriftport,autoconnect=True,protocol = 'compact',timeout = xxx)
    
    0 讨论(0)
  • 2021-02-20 05:21

    I had this problem because my implementation was raising an exception that the service endpoint wasn't specified to raise, I fixed it by adding a throws ( 1: MyException exc) to the end of my endpoint specification.

    0 讨论(0)
  • 2021-02-20 05:29

    I guess this question is old, but I hit the same error message. It turned out that there was a typo on the server side. The thrift libraries were trying to log the message using Python logging, but I hadn't set up logging, so it just said, "No handlers could be found for logger "thrift.server.TServer"".

    When I did some minimal logging, (add this code to the server side):

    import logging
    logging.basicConfig(level=logging.DEBUG)
    

    The logging showed me my typo in a Python stack trace, I fixed it and it worked again. The "TSocket read 0 bytes" error means the server got an exception and didn't write out a message.

    0 讨论(0)
提交回复
热议问题