You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by Matthew Chambers <mc...@wetafx.co.nz> on 2012/06/18 23:55:56 UTC

Thrift C++ question

Anyone have a good way to retry an RPC on another connection if the 
client side service object fails with a TTransportException or socket 
error?

In python its easy, I just bring up a new TSocket, Protocol, Transport, 
and Service on a different node and call the same function with the same 
args.  Users never even know a server just died or was restarted.  With 
C++ its proving to be more of a hassle.

-Matt

Re: Thrift C++ question

Posted by Nevo Hed <nh...@aereo.com>.
  ....  If you keep the rpc signatures simple, and put all of the
parameters in a struct, you could then keep the struct around for as long
as needed and reuse the same object for multiple calls ... If your rpc f
has many parameters, it becomes more of a pain...

On Monday, June 18, 2012, Matthew Chambers wrote:

>
> Actually, your right, I can.  My hassle is that its quite a bit of code
> duplication (we have a large API) but I can just make a macro.
>
> Thanks,
> Matt
>
> On 19/06/12 10:14, Mark Slee wrote:
>
>> Are you asking about a C++ client? Why can't you apply the same technique
>> as you're doing with Python?
>>
>> If you get a TTransportException, the right thing to do is to close and
>> discard the transport as it may no longer be in a reliable state, then try
>> again if so desired (ideally with some logic to prevent infinite retry
>> loops in a non-intermittent failure scenario).
>>
>> Another way of asking, what is the hassle you're encountering that seems
>> specific to C++?
>> ______________________________**__________
>> From: Matthew Chambers [mchambers@wetafx.co.nz]
>> Sent: Monday, June 18, 2012 2:55 PM
>> To: user@thrift.apache.org
>> Subject: Thrift C++ question
>>
>> Anyone have a good way to retry an RPC on another connection if the
>> client side service object fails with a TTransportException or socket
>> error?
>>
>> In python its easy, I just bring up a new TSocket, Protocol, Transport,
>> and Service on a different node and call the same function with the same
>> args.  Users never even know a server just died or was restarted.  With
>> C++ its proving to be more of a hassle.
>>
>> -Matt
>>
>

-- 
Sent from Gmail Mobile

Re: Thrift C++ question

Posted by Matthew Chambers <mc...@wetafx.co.nz>.
Actually, your right, I can.  My hassle is that its quite a bit of code 
duplication (we have a large API) but I can just make a macro.

Thanks,
Matt

On 19/06/12 10:14, Mark Slee wrote:
> Are you asking about a C++ client? Why can't you apply the same technique as you're doing with Python?
>
> If you get a TTransportException, the right thing to do is to close and discard the transport as it may no longer be in a reliable state, then try again if so desired (ideally with some logic to prevent infinite retry loops in a non-intermittent failure scenario).
>
> Another way of asking, what is the hassle you're encountering that seems specific to C++?
> ________________________________________
> From: Matthew Chambers [mchambers@wetafx.co.nz]
> Sent: Monday, June 18, 2012 2:55 PM
> To: user@thrift.apache.org
> Subject: Thrift C++ question
>
> Anyone have a good way to retry an RPC on another connection if the
> client side service object fails with a TTransportException or socket
> error?
>
> In python its easy, I just bring up a new TSocket, Protocol, Transport,
> and Service on a different node and call the same function with the same
> args.  Users never even know a server just died or was restarted.  With
> C++ its proving to be more of a hassle.
>
> -Matt

RE: Thrift C++ question

Posted by Mark Slee <ms...@fb.com>.
Are you asking about a C++ client? Why can't you apply the same technique as you're doing with Python?

If you get a TTransportException, the right thing to do is to close and discard the transport as it may no longer be in a reliable state, then try again if so desired (ideally with some logic to prevent infinite retry loops in a non-intermittent failure scenario).

Another way of asking, what is the hassle you're encountering that seems specific to C++?
________________________________________
From: Matthew Chambers [mchambers@wetafx.co.nz]
Sent: Monday, June 18, 2012 2:55 PM
To: user@thrift.apache.org
Subject: Thrift C++ question

Anyone have a good way to retry an RPC on another connection if the
client side service object fails with a TTransportException or socket
error?

In python its easy, I just bring up a new TSocket, Protocol, Transport,
and Service on a different node and call the same function with the same
args.  Users never even know a server just died or was restarted.  With
C++ its proving to be more of a hassle.

-Matt