[
https://issues.apache.org/jira/browse/THRIFT-1310?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15523170#comment-15523170
]
ASF GitHub Bot commented on THRIFT-1310:
----------------------------------------
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?
> Generate PHP client code not check sequence ID in messages
> ----------------------------------------------------------
>
> Key: THRIFT-1310
> URL: https://issues.apache.org/jira/browse/THRIFT-1310
> Project: Thrift
> Issue Type: Bug
> Components: PHP - Compiler
> Affects Versions: 0.7
> Reporter: Fang Jian
> Attachments: t_php_generator.patch
>
>
> The PHP client code not check sequence ID in messages, when client connect
> timeout, the return of results are out of sequence. I try to fix this by
> throwing a exception when sequence ID not equal. Patch file is listed below.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)