You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Pascal Qu (JIRA)" <ji...@apache.org> on 2011/03/01 07:29:37 UTC
[jira] Created: (THRIFT-1076) Erlang Thrift socket server has a bug
that causes java thrift client of framed binary client to throw "out of
sequence" exception
Erlang Thrift socket server has a bug that causes java thrift client of framed binary client to throw "out of sequence" exception
---------------------------------------------------------------------------------------------------------------------------------
Key: THRIFT-1076
URL: https://issues.apache.org/jira/browse/THRIFT-1076
Project: Thrift
Issue Type: Bug
Components: Erlang - Library
Affects Versions: 0.5
Environment: CentOS5.5, Erlang 13B04, thrift 0.5
Reporter: Pascal Qu
Priority: Critical
Fix For: 0.5
Repro step:
1) I defined a thrift file like below:
namespace java com.foo.jabber
service FrontendService {
bool isUserOnline(1:string userId, 2:string userDomain)
}
2) I implemented an erlang thrift server of framed, binary;
3) I use a java thrift framed+binary client to talk to the server;
4) I always got an exception of "out of sequence" while call isUserOnline(), while the thrift server had responsed to the request.
After some investigation, i found the field seq of reply's protocol_message_begin is hardcoded as 0 in thrift_processor.erl. I think it should be the save as that of request.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Updated: (THRIFT-1076) Erlang Thrift socket server has a bug
that causes java thrift client of framed binary client to throw "out of
sequence" exception
Posted by "Pascal Qu (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-1076?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pascal Qu updated THRIFT-1076:
------------------------------
Attachment: thrift_protocol.erl
you can search the word "seq" to find my change. If any issue, please feel free to contact me.
> Erlang Thrift socket server has a bug that causes java thrift client of framed binary client to throw "out of sequence" exception
> ---------------------------------------------------------------------------------------------------------------------------------
>
> Key: THRIFT-1076
> URL: https://issues.apache.org/jira/browse/THRIFT-1076
> Project: Thrift
> Issue Type: Bug
> Components: Erlang - Library
> Affects Versions: 0.5
> Environment: CentOS5.5, Erlang 13B04, thrift 0.5
> Reporter: Pascal Qu
> Priority: Critical
> Fix For: 0.5
>
> Attachments: thrift_protocol.erl
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> Repro step:
> 1) I defined a thrift file like below:
> namespace java com.foo.jabber
> service FrontendService {
> bool isUserOnline(1:string userId, 2:string userDomain)
> }
> 2) I implemented an erlang thrift server of framed, binary;
> 3) I use a java thrift framed+binary client to talk to the server;
> 4) I always got an exception of "out of sequence" while call isUserOnline(), while the thrift server had responsed to the request.
> After some investigation, i found the field seq of reply's protocol_message_begin is hardcoded as 0 in thrift_processor.erl. I think it should be the save as that of request.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (THRIFT-1076) Erlang Thrift socket server has a
bug that causes java thrift client of framed binary client to throw "out of
sequence" exception
Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-1076?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13000921#comment-13000921 ]
Bryan Duxbury commented on THRIFT-1076:
---------------------------------------
Pascal - I'd much prefer a patch to a completely new version of the file. Can you attach the results of "svn diff" from the root of the thrift tree?
> Erlang Thrift socket server has a bug that causes java thrift client of framed binary client to throw "out of sequence" exception
> ---------------------------------------------------------------------------------------------------------------------------------
>
> Key: THRIFT-1076
> URL: https://issues.apache.org/jira/browse/THRIFT-1076
> Project: Thrift
> Issue Type: Bug
> Components: Erlang - Library
> Affects Versions: 0.5
> Environment: CentOS5.5, Erlang 13B04, thrift 0.5
> Reporter: Pascal Qu
> Priority: Critical
> Fix For: 0.5
>
> Attachments: thrift_processor.erl
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> Repro step:
> 1) I defined a thrift file like below:
> namespace java com.foo.jabber
> service FrontendService {
> bool isUserOnline(1:string userId, 2:string userDomain)
> }
> 2) I implemented an erlang thrift server of framed, binary;
> 3) I use a java thrift framed+binary client to talk to the server;
> 4) I always got an exception of "out of sequence" while call isUserOnline(), while the thrift server had responsed to the request.
> After some investigation, i found the field seq of reply's protocol_message_begin is hardcoded as 0 in thrift_processor.erl. I think it should be the save as that of request.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Updated: (THRIFT-1076) Erlang Thrift socket server has a bug
that causes java thrift client of framed binary client to throw "out of
sequence" exception
Posted by "Pascal Qu (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-1076?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pascal Qu updated THRIFT-1076:
------------------------------
Attachment: thrift_processor.erl
> Erlang Thrift socket server has a bug that causes java thrift client of framed binary client to throw "out of sequence" exception
> ---------------------------------------------------------------------------------------------------------------------------------
>
> Key: THRIFT-1076
> URL: https://issues.apache.org/jira/browse/THRIFT-1076
> Project: Thrift
> Issue Type: Bug
> Components: Erlang - Library
> Affects Versions: 0.5
> Environment: CentOS5.5, Erlang 13B04, thrift 0.5
> Reporter: Pascal Qu
> Priority: Critical
> Fix For: 0.5
>
> Attachments: thrift_processor.erl, thrift_protocol.erl
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> Repro step:
> 1) I defined a thrift file like below:
> namespace java com.foo.jabber
> service FrontendService {
> bool isUserOnline(1:string userId, 2:string userDomain)
> }
> 2) I implemented an erlang thrift server of framed, binary;
> 3) I use a java thrift framed+binary client to talk to the server;
> 4) I always got an exception of "out of sequence" while call isUserOnline(), while the thrift server had responsed to the request.
> After some investigation, i found the field seq of reply's protocol_message_begin is hardcoded as 0 in thrift_processor.erl. I think it should be the save as that of request.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Closed: (THRIFT-1076) Erlang Thrift socket server has a bug
that causes java thrift client of framed binary client to throw "out of
sequence" exception
Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-1076?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Bryan Duxbury closed THRIFT-1076.
---------------------------------
Resolution: Fixed
Fix Version/s: (was: 0.5)
0.7
Assignee: Pascal Qu
I just committed this patch to TRUNK. Thanks for the patch, Pascal!
I noticed that you had it listed as "fix for" 0.5, but 0.5 is already shipped. Generally, I'd rather not go down the road of maintenance releases for older versions, but if you *really* want to do that, start a thread on the mailing list.
> Erlang Thrift socket server has a bug that causes java thrift client of framed binary client to throw "out of sequence" exception
> ---------------------------------------------------------------------------------------------------------------------------------
>
> Key: THRIFT-1076
> URL: https://issues.apache.org/jira/browse/THRIFT-1076
> Project: Thrift
> Issue Type: Bug
> Components: Erlang - Library
> Affects Versions: 0.5
> Environment: CentOS5.5, Erlang 13B04, thrift 0.5
> Reporter: Pascal Qu
> Assignee: Pascal Qu
> Priority: Critical
> Fix For: 0.7
>
> Attachments: seq.diff, thrift_processor.erl
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> Repro step:
> 1) I defined a thrift file like below:
> namespace java com.foo.jabber
> service FrontendService {
> bool isUserOnline(1:string userId, 2:string userDomain)
> }
> 2) I implemented an erlang thrift server of framed, binary;
> 3) I use a java thrift framed+binary client to talk to the server;
> 4) I always got an exception of "out of sequence" while call isUserOnline(), while the thrift server had responsed to the request.
> After some investigation, i found the field seq of reply's protocol_message_begin is hardcoded as 0 in thrift_processor.erl. I think it should be the save as that of request.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Updated: (THRIFT-1076) Erlang Thrift socket server has a bug
that causes java thrift client of framed binary client to throw "out of
sequence" exception
Posted by "Pascal Qu (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-1076?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pascal Qu updated THRIFT-1076:
------------------------------
Attachment: (was: thrift_protocol.erl)
> Erlang Thrift socket server has a bug that causes java thrift client of framed binary client to throw "out of sequence" exception
> ---------------------------------------------------------------------------------------------------------------------------------
>
> Key: THRIFT-1076
> URL: https://issues.apache.org/jira/browse/THRIFT-1076
> Project: Thrift
> Issue Type: Bug
> Components: Erlang - Library
> Affects Versions: 0.5
> Environment: CentOS5.5, Erlang 13B04, thrift 0.5
> Reporter: Pascal Qu
> Priority: Critical
> Fix For: 0.5
>
> Attachments: thrift_processor.erl
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> Repro step:
> 1) I defined a thrift file like below:
> namespace java com.foo.jabber
> service FrontendService {
> bool isUserOnline(1:string userId, 2:string userDomain)
> }
> 2) I implemented an erlang thrift server of framed, binary;
> 3) I use a java thrift framed+binary client to talk to the server;
> 4) I always got an exception of "out of sequence" while call isUserOnline(), while the thrift server had responsed to the request.
> After some investigation, i found the field seq of reply's protocol_message_begin is hardcoded as 0 in thrift_processor.erl. I think it should be the save as that of request.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Updated: (THRIFT-1076) Erlang Thrift socket server has a bug
that causes java thrift client of framed binary client to throw "out of
sequence" exception
Posted by "Pascal Qu (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-1076?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pascal Qu updated THRIFT-1076:
------------------------------
Comment: was deleted
(was: add svn diff file)
> Erlang Thrift socket server has a bug that causes java thrift client of framed binary client to throw "out of sequence" exception
> ---------------------------------------------------------------------------------------------------------------------------------
>
> Key: THRIFT-1076
> URL: https://issues.apache.org/jira/browse/THRIFT-1076
> Project: Thrift
> Issue Type: Bug
> Components: Erlang - Library
> Affects Versions: 0.5
> Environment: CentOS5.5, Erlang 13B04, thrift 0.5
> Reporter: Pascal Qu
> Priority: Critical
> Fix For: 0.5
>
> Attachments: seq.diff, thrift_processor.erl
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> Repro step:
> 1) I defined a thrift file like below:
> namespace java com.foo.jabber
> service FrontendService {
> bool isUserOnline(1:string userId, 2:string userDomain)
> }
> 2) I implemented an erlang thrift server of framed, binary;
> 3) I use a java thrift framed+binary client to talk to the server;
> 4) I always got an exception of "out of sequence" while call isUserOnline(), while the thrift server had responsed to the request.
> After some investigation, i found the field seq of reply's protocol_message_begin is hardcoded as 0 in thrift_processor.erl. I think it should be the save as that of request.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (THRIFT-1076) Erlang Thrift socket server has a
bug that causes java thrift client of framed binary client to throw "out of
sequence" exception
Posted by "Dmitriy Kargapolov (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-1076?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13016150#comment-13016150 ]
Dmitriy Kargapolov commented on THRIFT-1076:
--------------------------------------------
Would you please take a look at another version of this fix, it passed sequence id through the thrift processor loop state (which I believe is very suitable for this purpose), and has less extra-argument additions to subsequent calls.
Sincerely...
{code}
diff --git a/src/thrift_processor.erl b/src/thrift_processor.erl
index 4315505..334a74e 100644
--- a/src/thrift_processor.erl
+++ b/src/thrift_processor.erl
@@ -24,7 +24,7 @@
-include("thrift_constants.hrl").
-include("thrift_protocol.hrl").
--record(thrift_processor, {handler, protocol, service}).
+-record(thrift_processor, {handler, protocol, service, seqid}).
init({_Server, ProtoGen, Service, Handler}) when is_function(ProtoGen, 0) ->
{ok, Proto} = ProtoGen(),
@@ -37,12 +37,14 @@ loop(State0 = #thrift_processor{protocol = Proto0}) ->
State1 = State0#thrift_processor{protocol = Proto1},
case MessageBegin of
#protocol_message_begin{name = Function,
- type = ?tMessageType_CALL} ->
- {State2, ok} = handle_function(State1, list_to_atom(Function)),
+ type = ?tMessageType_CALL,
+ seqid = SeqId} ->
+ {State2, ok} = handle_function(State1#thrift_processor{seqid = SeqId}, list_to_atom(Function)),
loop(State2);
#protocol_message_begin{name = Function,
- type = ?tMessageType_ONEWAY} ->
- {State2, ok} = handle_function(State1, list_to_atom(Function)),
+ type = ?tMessageType_ONEWAY,
+ seqid = SeqId} ->
+ {State2, ok} = handle_function(State1#thrift_processor{seqid = SeqId}, list_to_atom(Function)),
loop(State2);
{error, timeout} ->
thrift_protocol:close_transport(Proto1),
@@ -169,11 +171,11 @@ handle_error(State, Function, Error) ->
type = ?TApplicationException_UNKNOWN}},
send_reply(State, Function, ?tMessageType_EXCEPTION, Reply).
-send_reply(State = #thrift_processor{protocol = Proto0}, Function, ReplyMessageType, Reply) ->
+send_reply(State = #thrift_processor{protocol = Proto0, seqid = SeqId}, Function, ReplyMessageType, Reply) ->
{Proto1, ok} = thrift_protocol:write(Proto0, #protocol_message_begin{
name = atom_to_list(Function),
type = ReplyMessageType,
- seqid = 0}),
+ seqid = SeqId}),
{Proto2, ok} = thrift_protocol:write(Proto1, Reply),
{Proto3, ok} = thrift_protocol:write(Proto2, message_end),
{Proto4, ok} = thrift_protocol:flush_transport(Proto3),
{code}
> Erlang Thrift socket server has a bug that causes java thrift client of framed binary client to throw "out of sequence" exception
> ---------------------------------------------------------------------------------------------------------------------------------
>
> Key: THRIFT-1076
> URL: https://issues.apache.org/jira/browse/THRIFT-1076
> Project: Thrift
> Issue Type: Bug
> Components: Erlang - Library
> Affects Versions: 0.5
> Environment: CentOS5.5, Erlang 13B04, thrift 0.5
> Reporter: Pascal Qu
> Assignee: Pascal Qu
> Priority: Critical
> Fix For: 0.7
>
> Attachments: seq.diff, thrift_processor.erl
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> Repro step:
> 1) I defined a thrift file like below:
> namespace java com.foo.jabber
> service FrontendService {
> bool isUserOnline(1:string userId, 2:string userDomain)
> }
> 2) I implemented an erlang thrift server of framed, binary;
> 3) I use a java thrift framed+binary client to talk to the server;
> 4) I always got an exception of "out of sequence" while call isUserOnline(), while the thrift server had responsed to the request.
> After some investigation, i found the field seq of reply's protocol_message_begin is hardcoded as 0 in thrift_processor.erl. I think it should be the save as that of request.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Updated: (THRIFT-1076) Erlang Thrift socket server has a bug
that causes java thrift client of framed binary client to throw "out of
sequence" exception
Posted by "Pascal Qu (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-1076?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pascal Qu updated THRIFT-1076:
------------------------------
Attachment: seq.diff
add svn .diff file
> Erlang Thrift socket server has a bug that causes java thrift client of framed binary client to throw "out of sequence" exception
> ---------------------------------------------------------------------------------------------------------------------------------
>
> Key: THRIFT-1076
> URL: https://issues.apache.org/jira/browse/THRIFT-1076
> Project: Thrift
> Issue Type: Bug
> Components: Erlang - Library
> Affects Versions: 0.5
> Environment: CentOS5.5, Erlang 13B04, thrift 0.5
> Reporter: Pascal Qu
> Priority: Critical
> Fix For: 0.5
>
> Attachments: seq.diff, thrift_processor.erl
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> Repro step:
> 1) I defined a thrift file like below:
> namespace java com.foo.jabber
> service FrontendService {
> bool isUserOnline(1:string userId, 2:string userDomain)
> }
> 2) I implemented an erlang thrift server of framed, binary;
> 3) I use a java thrift framed+binary client to talk to the server;
> 4) I always got an exception of "out of sequence" while call isUserOnline(), while the thrift server had responsed to the request.
> After some investigation, i found the field seq of reply's protocol_message_begin is hardcoded as 0 in thrift_processor.erl. I think it should be the save as that of request.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (THRIFT-1076) Erlang Thrift socket server has a
bug that causes java thrift client of framed binary client to throw "out of
sequence" exception
Posted by "Pascal Qu (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-1076?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13000832#comment-13000832 ]
Pascal Qu commented on THRIFT-1076:
-----------------------------------
please ignore this file. I added it mistakenly. Sorry about that.
> Erlang Thrift socket server has a bug that causes java thrift client of framed binary client to throw "out of sequence" exception
> ---------------------------------------------------------------------------------------------------------------------------------
>
> Key: THRIFT-1076
> URL: https://issues.apache.org/jira/browse/THRIFT-1076
> Project: Thrift
> Issue Type: Bug
> Components: Erlang - Library
> Affects Versions: 0.5
> Environment: CentOS5.5, Erlang 13B04, thrift 0.5
> Reporter: Pascal Qu
> Priority: Critical
> Fix For: 0.5
>
> Attachments: thrift_processor.erl
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> Repro step:
> 1) I defined a thrift file like below:
> namespace java com.foo.jabber
> service FrontendService {
> bool isUserOnline(1:string userId, 2:string userDomain)
> }
> 2) I implemented an erlang thrift server of framed, binary;
> 3) I use a java thrift framed+binary client to talk to the server;
> 4) I always got an exception of "out of sequence" while call isUserOnline(), while the thrift server had responsed to the request.
> After some investigation, i found the field seq of reply's protocol_message_begin is hardcoded as 0 in thrift_processor.erl. I think it should be the save as that of request.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Updated: (THRIFT-1076) Erlang Thrift socket server has a bug
that causes java thrift client of framed binary client to throw "out of
sequence" exception
Posted by "Pascal Qu (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-1076?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pascal Qu updated THRIFT-1076:
------------------------------
Attachment: seq.diff
add svn diff file
> Erlang Thrift socket server has a bug that causes java thrift client of framed binary client to throw "out of sequence" exception
> ---------------------------------------------------------------------------------------------------------------------------------
>
> Key: THRIFT-1076
> URL: https://issues.apache.org/jira/browse/THRIFT-1076
> Project: Thrift
> Issue Type: Bug
> Components: Erlang - Library
> Affects Versions: 0.5
> Environment: CentOS5.5, Erlang 13B04, thrift 0.5
> Reporter: Pascal Qu
> Priority: Critical
> Fix For: 0.5
>
> Attachments: seq.diff, thrift_processor.erl
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> Repro step:
> 1) I defined a thrift file like below:
> namespace java com.foo.jabber
> service FrontendService {
> bool isUserOnline(1:string userId, 2:string userDomain)
> }
> 2) I implemented an erlang thrift server of framed, binary;
> 3) I use a java thrift framed+binary client to talk to the server;
> 4) I always got an exception of "out of sequence" while call isUserOnline(), while the thrift server had responsed to the request.
> After some investigation, i found the field seq of reply's protocol_message_begin is hardcoded as 0 in thrift_processor.erl. I think it should be the save as that of request.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Updated: (THRIFT-1076) Erlang Thrift socket server has a bug
that causes java thrift client of framed binary client to throw "out of
sequence" exception
Posted by "Pascal Qu (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-1076?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pascal Qu updated THRIFT-1076:
------------------------------
Attachment: (was: seq.diff)
> Erlang Thrift socket server has a bug that causes java thrift client of framed binary client to throw "out of sequence" exception
> ---------------------------------------------------------------------------------------------------------------------------------
>
> Key: THRIFT-1076
> URL: https://issues.apache.org/jira/browse/THRIFT-1076
> Project: Thrift
> Issue Type: Bug
> Components: Erlang - Library
> Affects Versions: 0.5
> Environment: CentOS5.5, Erlang 13B04, thrift 0.5
> Reporter: Pascal Qu
> Priority: Critical
> Fix For: 0.5
>
> Attachments: seq.diff, thrift_processor.erl
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> Repro step:
> 1) I defined a thrift file like below:
> namespace java com.foo.jabber
> service FrontendService {
> bool isUserOnline(1:string userId, 2:string userDomain)
> }
> 2) I implemented an erlang thrift server of framed, binary;
> 3) I use a java thrift framed+binary client to talk to the server;
> 4) I always got an exception of "out of sequence" while call isUserOnline(), while the thrift server had responsed to the request.
> After some investigation, i found the field seq of reply's protocol_message_begin is hardcoded as 0 in thrift_processor.erl. I think it should be the save as that of request.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira