[ 
https://issues.apache.org/jira/browse/THRIFT-3800?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

James E. King III updated THRIFT-3800:
--------------------------------------
    Affects Version/s:     (was: 1.0)

This issue was marked as affecting version 1.0 which is not possible.   If you 
know which version this issue was discovered in, please mark it as such.

> Python THttpClient hangs on Oneway methods in the test suite
> ------------------------------------------------------------
>
>                 Key: THRIFT-3800
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3800
>             Project: Thrift
>          Issue Type: Bug
>          Components: Python - Library, Test Suite
>    Affects Versions: 0.9.3
>         Environment: Linux / Python
>            Reporter: Martin Wilck
>            Priority: Major
>              Labels: patch, test
>         Attachments: 
> 0001-Python-THttpClient-Fix-Oneway-support-for-unit-tests.patch
>
>
> The generated python  code for "oneway" methods calls flush() to send the 
> data. The flush() method of THttpClient calls 
> http_client.HTTPCconnection.getresponse(). This hangs forever waiting for a 
> HTTP response from the server, unless a timeout  has been specified, in which 
> case the respective test simply fails. The reason for this is that the HTTP 
> TestServer (C++) does not send a HTTP response for oneway messages (verified 
> this using wireshark with the default "simple" server).
> IMO this is in fact a bug of the TestServer, because the HTTP protocol 
> specification clearly states that the server has to send "one ore more" HTTP 
> response messages in reply to every request message 
> (https://tools.ietf.org/html/rfc7230, 2.1).
> However, the test suite for other languages (C++) works fine with this setup 
> and fails with python.
> Steps to reproduce:
> #  Build thrift with py support
> # Run a HTTP test with cpp server and python client:
> {noformat}
> cd test/py
> ../cpp/TestServer --protocol=compact --transport=http --port=51291 &> 
> /tmp/server.log
> ./TestClient.py --verbose --host=localhost --genpydir=gen-py 
> --protocol=compact --http=/ --port=51291
> {noformat}
> *Result:* the client hangs forever in the "testOneway" test. When killed with 
> ctrl-c, it can be seen to hang in the following call stack:
> {noformat}
> ...
>   File "test/py/gen-py/ThriftTest/ThriftTest.py", line 1070, in testOneway
>     self.send_testOneway(secondsToSleep)
>   File "test/py/gen-py/ThriftTest/ThriftTest.py", line 1078, in 
> send_testOneway
>     self._oprot.trans.flush()
>   File "lib/py/build/lib.linux-x86_64-2.7/thrift/transport/THttpClient.py", 
> line 129, in _f
>     result = f(*args, **kwargs)
>   File "lib/py/build/lib.linux-x86_64-2.7/thrift/transport/THttpClient.py", 
> line 168, in flush
>     self.__http_response = self.__http.getresponse()
>   File "/usr/lib64/python2.7/httplib.py", line 1067, in getresponse
>     response.begin()
>   File "/usr/lib64/python2.7/httplib.py", line 409, in begin
>     version, status, reason = self._read_status()
>   File "/usr/lib64/python2.7/httplib.py", line 365, in _read_status
>     line = self.fp.readline(_MAXLINE + 1)
>   File "/usr/lib64/python2.7/socket.py", line 476, in readline
>     data = self._sock.recv(self._rbufsize)
> {noformat}
> *Expected Result:* Success.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to