[jira] [Commented] (THRIFT-4656) infinite loop in latest PHP library

2018-12-05 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/THRIFT-4656?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16710636#comment-16710636
 ] 

ASF GitHub Bot commented on THRIFT-4656:


jeking3 closed pull request #1618: THRIFT-4656: Fix infinite loop in PHP 
TCurlClient
URL: https://github.com/apache/thrift/pull/1618
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/lib/php/lib/Transport/TCurlClient.php 
b/lib/php/lib/Transport/TCurlClient.php
index 3d4908d901..482b43b72c 100644
--- a/lib/php/lib/Transport/TCurlClient.php
+++ b/lib/php/lib/Transport/TCurlClient.php
@@ -169,6 +169,24 @@ public function read($len)
 }
 }
 
+/**
+ * Guarantees that the full amount of data is read. Since TCurlClient gets 
entire payload at
+ * once, parent readAll cannot be used.
+ *
+ * @return string The data, of exact length
+ * @throws TTransportException if cannot read data
+ */
+public function readAll($len)
+{
+$data = $this->read($len);
+
+if (TStringFuncFactory::create()->strlen($data) !== $len) {
+throw new TTransportException('TCurlClient could not read '.$len.' 
bytes');
+}
+
+return $data;
+}
+
 /**
  * Writes some data into the pending buffer
  *


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> infinite loop in latest PHP library
> ---
>
> Key: THRIFT-4656
> URL: https://issues.apache.org/jira/browse/THRIFT-4656
> Project: Thrift
>  Issue Type: Bug
>  Components: PHP - Library
>Reporter: Josip Sokcevic
>Priority: Major
> Fix For: 0.12.0
>
> Attachments: 
> 0001-THRIFT-4656-Fix-infinite-loop-in-PHP-TCurlClient.patch
>
>
> The latest PHP library can enter into infinite loop state when specific 
> payload is returned:
> HTTP status: 200
> Response body: 
>  
> It was introduced with THRIFT-4645, where check was replaced from
> {code:java}
> !$this->response_{code}
> to
> {code:java}
> $this->response_ === false{code}



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


[jira] [Commented] (THRIFT-4656) infinite loop in latest PHP library

2018-11-12 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/THRIFT-4656?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16684690#comment-16684690
 ] 

ASF GitHub Bot commented on THRIFT-4656:


sokac commented on issue #1618: THRIFT-4656: Fix infinite loop in PHP 
TCurlClient
URL: https://github.com/apache/thrift/pull/1618#issuecomment-438122866
 
 
   @jeking3 I updated PR. You were right about oneway - server returns 200 OK 
with empty body. Looks like 
https://github.com/apache/thrift/pull/1602/files#diff-74eb8d4b20c423c78252e3e3dc847099R227
 unintentionally fixed a bug, and the original version of this PR would have 
broken it.
   
   I tested with simple service that has both oneway and regular functions, 
everything was fully functional. I noticed php client will block until it gets 
response, but that's a different problem.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> infinite loop in latest PHP library
> ---
>
> Key: THRIFT-4656
> URL: https://issues.apache.org/jira/browse/THRIFT-4656
> Project: Thrift
>  Issue Type: Bug
>  Components: PHP - Library
>Reporter: Josip Sokcevic
>Priority: Major
> Fix For: 0.12.0
>
> Attachments: 
> 0001-THRIFT-4656-Fix-infinite-loop-in-PHP-TCurlClient.patch
>
>
> The latest PHP library can enter into infinite loop state when specific 
> payload is returned:
> HTTP status: 200
> Response body: 
>  
> It was introduced with THRIFT-4645, where check was replaced from
> {code:java}
> !$this->response_{code}
> to
> {code:java}
> $this->response_ === false{code}



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


[jira] [Commented] (THRIFT-4656) infinite loop in latest PHP library

2018-11-11 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/THRIFT-4656?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16682920#comment-16682920
 ] 

ASF GitHub Bot commented on THRIFT-4656:


allengeorge commented on issue #1618: THRIFT-4656: Fix infinite loop in PHP 
TCurlClient
URL: https://github.com/apache/thrift/pull/1618#issuecomment-437682746
 
 
   Oh. Hmm - you're absolutely right. Because the autogen'd code is protocol 
agnostic it doesn't know that in some cases the protocol has no concept of a 
one-way interaction. 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> infinite loop in latest PHP library
> ---
>
> Key: THRIFT-4656
> URL: https://issues.apache.org/jira/browse/THRIFT-4656
> Project: Thrift
>  Issue Type: Bug
>  Components: PHP - Library
>Reporter: Josip Sokcevic
>Priority: Major
> Fix For: 0.12.0
>
> Attachments: 
> 0001-THRIFT-4656-Fix-infinite-loop-in-PHP-TCurlClient.patch
>
>
> The latest PHP library can enter into infinite loop state when specific 
> payload is returned:
> HTTP status: 200
> Response body: 
>  
> It was introduced with THRIFT-4645, where check was replaced from
> {code:java}
> !$this->response_{code}
> to
> {code:java}
> $this->response_ === false{code}



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


[jira] [Commented] (THRIFT-4656) infinite loop in latest PHP library

2018-11-11 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/THRIFT-4656?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16682916#comment-16682916
 ] 

ASF GitHub Bot commented on THRIFT-4656:


jeking3 commented on issue #1618: THRIFT-4656: Fix infinite loop in PHP 
TCurlClient
URL: https://github.com/apache/thrift/pull/1618#issuecomment-437681718
 
 
   Sounds like an improvement, but here's the issue I think exists with oneway:
   
   1. Generated client code sends a oneway request.
   2. HTTP transport packages it up and send it to the server.  This could be 
through a proxy.
   3. Server receives it.  Since it is a oneway request, my assumption is the 
server, no matter what the language, has a HTTP transport that issues a 
response (like 200 OK without content, or 204 as you stated).  If it did not, 
it wouldn't work through a proxy (or at least, the proxy might behave badly).
   An example of this can be found at 
https://github.com/apache/thrift/blob/master/lib/py/src/server/THttpServer.py#L86.
   4. Client has no generated response reader code because it is oneway, so the 
client code never attempts to get the transport response (which is fair, oneway 
probably came around before we had a transport with a mandatory response).  
However now there's a transport reply sitting in the buffer.
   5. The next request sent by the client that is normal (not oneway) would 
send the request and then read the HTTP 1.1 200 OK response buffered from from 
the oneway request, and the actual reply to the two-way request would get 
queued up; however the response processor for the twoway request, seeing no 
payload, would throw an exception.
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> infinite loop in latest PHP library
> ---
>
> Key: THRIFT-4656
> URL: https://issues.apache.org/jira/browse/THRIFT-4656
> Project: Thrift
>  Issue Type: Bug
>  Components: PHP - Library
>Reporter: Josip Sokcevic
>Priority: Major
> Fix For: 0.12.0
>
> Attachments: 
> 0001-THRIFT-4656-Fix-infinite-loop-in-PHP-TCurlClient.patch
>
>
> The latest PHP library can enter into infinite loop state when specific 
> payload is returned:
> HTTP status: 200
> Response body: 
>  
> It was introduced with THRIFT-4645, where check was replaced from
> {code:java}
> !$this->response_{code}
> to
> {code:java}
> $this->response_ === false{code}



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


[jira] [Commented] (THRIFT-4656) infinite loop in latest PHP library

2018-11-11 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/THRIFT-4656?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16682908#comment-16682908
 ] 

ASF GitHub Bot commented on THRIFT-4656:


allengeorge commented on issue #1618: THRIFT-4656: Fix infinite loop in PHP 
TCurlClient
URL: https://github.com/apache/thrift/pull/1618#issuecomment-437680054
 
 
   Would it be better for the language runtime to return a `204` indicating a 
successful request but no content?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> infinite loop in latest PHP library
> ---
>
> Key: THRIFT-4656
> URL: https://issues.apache.org/jira/browse/THRIFT-4656
> Project: Thrift
>  Issue Type: Bug
>  Components: PHP - Library
>Reporter: Josip Sokcevic
>Priority: Major
> Fix For: 0.12.0
>
> Attachments: 
> 0001-THRIFT-4656-Fix-infinite-loop-in-PHP-TCurlClient.patch
>
>
> The latest PHP library can enter into infinite loop state when specific 
> payload is returned:
> HTTP status: 200
> Response body: 
>  
> It was introduced with THRIFT-4645, where check was replaced from
> {code:java}
> !$this->response_{code}
> to
> {code:java}
> $this->response_ === false{code}



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


[jira] [Commented] (THRIFT-4656) infinite loop in latest PHP library

2018-11-09 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/THRIFT-4656?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16681661#comment-16681661
 ] 

ASF GitHub Bot commented on THRIFT-4656:


jeking3 commented on issue #1618: THRIFT-4656: Fix infinite loop in PHP 
TCurlClient
URL: https://github.com/apache/thrift/pull/1618#issuecomment-437410921
 
 
   I'm still concerned about how oneway requests are handled with HTTP 
transport.  It would be a HTTP/1.1 200 OK response without any payload...


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> infinite loop in latest PHP library
> ---
>
> Key: THRIFT-4656
> URL: https://issues.apache.org/jira/browse/THRIFT-4656
> Project: Thrift
>  Issue Type: Bug
>  Components: PHP - Library
>Reporter: Josip Sokcevic
>Priority: Major
> Fix For: 0.12.0
>
> Attachments: 
> 0001-THRIFT-4656-Fix-infinite-loop-in-PHP-TCurlClient.patch
>
>
> The latest PHP library can enter into infinite loop state when specific 
> payload is returned:
> HTTP status: 200
> Response body: 
>  
> It was introduced with THRIFT-4645, where check was replaced from
> {code:java}
> !$this->response_{code}
> to
> {code:java}
> $this->response_ === false{code}



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


[jira] [Commented] (THRIFT-4656) infinite loop in latest PHP library

2018-11-06 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/THRIFT-4656?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16677176#comment-16677176
 ] 

ASF GitHub Bot commented on THRIFT-4656:


sokac commented on issue #1618: THRIFT-4656: Fix infinite loop in PHP 
TCurlClient
URL: https://github.com/apache/thrift/pull/1618#issuecomment-436368820
 
 
   @jeking3 200 OK with empty response was due an upstream bug not related to 
Thrift (our framework returned wrong http status code in case of exception, 
sits lower on stack than Thrift processor; already patched). From what I can 
tell, Thrift response should never be an empty response.
   
   However, no library shouldn't be stuck in an infinite loop due invalid 
server response imo. This change:
   
https://github.com/apache/thrift/pull/1602/files#diff-74eb8d4b20c423c78252e3e3dc847099R227
   introduced a change how empty response is handled by TCurlClient. Before it 
was merged, it would throw TTransportException on empty payload.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> infinite loop in latest PHP library
> ---
>
> Key: THRIFT-4656
> URL: https://issues.apache.org/jira/browse/THRIFT-4656
> Project: Thrift
>  Issue Type: Bug
>  Components: PHP - Library
>Reporter: Josip Sokcevic
>Priority: Major
> Fix For: 0.12.0
>
> Attachments: 
> 0001-THRIFT-4656-Fix-infinite-loop-in-PHP-TCurlClient.patch
>
>
> The latest PHP library can enter into infinite loop state when specific 
> payload is returned:
> HTTP status: 200
> Response body: 
>  
> It was introduced with THRIFT-4645, where check was replaced from
> {code:java}
> !$this->response_{code}
> to
> {code:java}
> $this->response_ === false{code}



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


[jira] [Commented] (THRIFT-4656) infinite loop in latest PHP library

2018-11-04 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/THRIFT-4656?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16674546#comment-16674546
 ] 

ASF GitHub Bot commented on THRIFT-4656:


jeking3 edited a comment on issue #1618: THRIFT-4656: Fix infinite loop in PHP 
TCurlClient
URL: https://github.com/apache/thrift/pull/1618#issuecomment-435716145
 
 
   I think we need to understand why there's a 0 length response sitting there. 
 My guess is that it's due to a oneway call followed by a normal call.  This 
issue has been seen in other language runtimes as well.  It's why the HTTP 
transport support is shaky at best.  There's a topic in Jira about HTTP 
transport with C++ and how broken it is...


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> infinite loop in latest PHP library
> ---
>
> Key: THRIFT-4656
> URL: https://issues.apache.org/jira/browse/THRIFT-4656
> Project: Thrift
>  Issue Type: Bug
>  Components: PHP - Library
>Reporter: Josip Sokcevic
>Priority: Major
> Fix For: 0.12.0
>
> Attachments: 
> 0001-THRIFT-4656-Fix-infinite-loop-in-PHP-TCurlClient.patch
>
>
> The latest PHP library can enter into infinite loop state when specific 
> payload is returned:
> HTTP status: 200
> Response body: 
>  
> It was introduced with THRIFT-4645, where check was replaced from
> {code:java}
> !$this->response_{code}
> to
> {code:java}
> $this->response_ === false{code}



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


[jira] [Commented] (THRIFT-4656) infinite loop in latest PHP library

2018-11-04 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/THRIFT-4656?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16674545#comment-16674545
 ] 

ASF GitHub Bot commented on THRIFT-4656:


jeking3 commented on issue #1618: THRIFT-4656: Fix infinite loop in PHP 
TCurlClient
URL: https://github.com/apache/thrift/pull/1618#issuecomment-435716145
 
 
   I think we need to understand why there's a 0 length response sitting there. 
 My guess is that it's due to a oneway call followed by a normal call.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> infinite loop in latest PHP library
> ---
>
> Key: THRIFT-4656
> URL: https://issues.apache.org/jira/browse/THRIFT-4656
> Project: Thrift
>  Issue Type: Bug
>  Components: PHP - Library
>Reporter: Josip Sokcevic
>Priority: Major
> Fix For: 0.12.0
>
> Attachments: 
> 0001-THRIFT-4656-Fix-infinite-loop-in-PHP-TCurlClient.patch
>
>
> The latest PHP library can enter into infinite loop state when specific 
> payload is returned:
> HTTP status: 200
> Response body: 
>  
> It was introduced with THRIFT-4645, where check was replaced from
> {code:java}
> !$this->response_{code}
> to
> {code:java}
> $this->response_ === false{code}



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


[jira] [Commented] (THRIFT-4656) infinite loop in latest PHP library

2018-11-01 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/THRIFT-4656?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16672320#comment-16672320
 ] 

ASF GitHub Bot commented on THRIFT-4656:


sokac commented on issue #1618: THRIFT-4656: Fix infinite loop in PHP 
TCurlClient
URL: https://github.com/apache/thrift/pull/1618#issuecomment-435215291
 
 
   @jeking3 it was the case before THRIFT-4645 got fixed. If response was 
empty, an exception was thrown.
   
   Alternative is to override readAll. Parent class TTransport, 
https://github.com/apache/thrift/blob/master/lib/php/lib/Transport/TTransport.php#L76
 , will keep calling read until receives all bytes. Since we know TCurlClient 
won't get any more bytes, an exception can be thrown in case read returns fewer 
than $len.
   
   To give a little bit of background how this issue was reproduced - due to 
bug in upstream under some conditions, upstream could respond with 200 OK and 
empty response. This caused PHP to spin until supervisor terminated it due 
reached timeout.
   
   Do you think this PR makes sense or should we override readAll? I'm open to 
suggestions too


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> infinite loop in latest PHP library
> ---
>
> Key: THRIFT-4656
> URL: https://issues.apache.org/jira/browse/THRIFT-4656
> Project: Thrift
>  Issue Type: Bug
>  Components: PHP - Library
>Reporter: Josip Sokcevic
>Priority: Major
> Fix For: 0.12.0
>
> Attachments: 
> 0001-THRIFT-4656-Fix-infinite-loop-in-PHP-TCurlClient.patch
>
>
> The latest PHP library can enter into infinite loop state when specific 
> payload is returned:
> HTTP status: 200
> Response body: 
>  
> It was introduced with THRIFT-4645, where check was replaced from
> {code:java}
> !$this->response_{code}
> to
> {code:java}
> $this->response_ === false{code}



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


[jira] [Commented] (THRIFT-4656) infinite loop in latest PHP library

2018-10-30 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/THRIFT-4656?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16669396#comment-16669396
 ] 

ASF GitHub Bot commented on THRIFT-4656:


sokac opened a new pull request #1618: THRIFT-4656: Fix infinite loop in PHP 
TCurlClient
URL: https://github.com/apache/thrift/pull/1618
 
 
   Infinite loop happens when response body is empty and HTTP status is
   200. This patch fixes it.
   
   * tested in production


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> infinite loop in latest PHP library
> ---
>
> Key: THRIFT-4656
> URL: https://issues.apache.org/jira/browse/THRIFT-4656
> Project: Thrift
>  Issue Type: Bug
>  Components: PHP - Library
>Reporter: Josip Sokcevic
>Priority: Major
> Fix For: 0.12.0
>
> Attachments: 
> 0001-THRIFT-4656-Fix-infinite-loop-in-PHP-TCurlClient.patch
>
>
> The latest PHP library can enter into infinite loop state when specific 
> payload is returned:
> HTTP status: 200
> Response body: 
>  
> It was introduced with THRIFT-4645, where check was replaced from
> {code:java}
> !$this->response_{code}
> to
> {code:java}
> $this->response_ === false{code}



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