Github user sstach commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/1093#discussion_r80482717
  
    --- Diff: lib/php/lib/Thrift/Protocol/TBinaryProtocol.php ---
    @@ -246,6 +257,10 @@ public function readMessageBegin(&$name, &$type, 
&$seqid)
           }
         }
     
    +    if ($seqid != $this->seqid_) {
    +      throw new TApplicationException("TBinaryProtocol::ReadMessageBegin 
received SequenceID: $seqid not matches requested ID: $this->seqid_ " . 
TApplicationException::BAD_SEQUENCE_ID);
    +    }
    --- End diff --
    
    Okay the seqid_ itself is not the problem. I agree to your statement that 
it depends on the implementations of the client or the server.
    
    But here is our problem, we introduced Thrift as a performance boost by 
using persistent connections. Now that we use it in production we identified 
that the PHP implementation is not robust enough for us. It occurs that the 
client Socket gets closed by timeout and the client got an Exception. If 
another client requested something he got the response that was meant for the 
client which got the timeout.
    
    With the seqid_ we have a robust functionality to check that our java 
server returns the correct answer to our question, irrelevant whether its a 
rand() or a simple increment.
    And if we have a miss match we can react on that and our client can handle 
the error by opening a new Socket and request again.
    
    We spend a lot of time to get to the bottom of this problem and the seqid_ 
seems to be the missing piece we are looking for. We were surprised to find out 
that it seems that no one else is running into the same problem. Only a 5 year 
old  [abandoned issue](https://issues.apache.org/jira/browse/THRIFT-1310) seems 
to reference this topic.
    
    Do we miss something about the persistence? Is there another way to 
determine if the response matches the request?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to