Search code examples
pythonthrift

EOFError error Apache Thrift on Ubuntu 18.04 LTS


I'm reading the Learning Apache Thrift book by Krzysztof Rakowski. In chapter 3 (found [here]), he explains how to execute the server with python using python runserver.py command. I execute that command and in another terminal, I execute the client using python client.py.

On the server side I see this output:

Starting server on port 8081...
127.0.0.1 - - [12/Sep/2018 04:32:38] code 403, message CGI script is not executable ('//MyFirstServer.php')
127.0.0.1 - - [12/Sep/2018 04:32:38] "POST MyFirstServer.php HTTP/1.1" 403 -
127.0.0.1 - - [12/Sep/2018 04:32:38] code 403, message CGI script is not executable ('//MyFirstServer.php')
127.0.0.1 - - [12/Sep/2018 04:32:38] "POST MyFirstServer.php HTTP/1.1" 403 -

On the client side I see this output:

martinez@VM:~/Development$ python client.py
logged current time to logfile (not waiting for response)
Traceback (most recent call last):
  File "client.py", line 31, in <module>
    product = client.multiply(number1,number2)
  File "gen-py/myfirst/MyFirstService.py", line 74, in multiply
    return self.recv_multiply()
  File "gen-py/myfirst/MyFirstService.py", line 87, in recv_multiply
    (fname, mtype, rseqid) = iprot.readMessageBegin()
  File "thrift-0.11.0/lib/py/build/lib.linux-x86_64-2.7/thrift/protocol/TBinaryProtocol.py", line 148, in readMessageBegin
    name = self.trans.readAll(sz)
  File "thrift-0.11.0/lib/py/build/lib.linux-x86_64-2.7/thrift/transport/TTransport.py", line 66, in readAll
    raise EOFError()
EOFError

My attempts to fix this situation

  1. Re-installed thrift
  2. Removed Php 7 from Ubuntu and installed php version 5.
  3. Checked all the files to make sure I switched from port 8080 to port 8181.
  4. Check all the files to make sure the directories path corresponds to the right version of thrift.

How can I solve this issue? Also, what is causing it?


Solution

  • code 403, message CGI script is not executable suggests a permission problem to me, which can be fixed by chmod +x MyFirstServer.php.