You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by Vivek Goel <go...@gmail.com> on 2013/01/28 11:13:32 UTC

How to detect client abort?

Hi,
I am using C++ thrift library.
Is there a way to detect client abort and cancel the  request on server
side?

If not.
What should be the best way to achieve this type of functionality?

regards
Vivek Goel

Re: How to detect client abort?

Posted by tom schuring <to...@gmail.com>.
Another option is to implement a heart-beat function and call it
regularly, if it disappears then that client seems to have died ?

Re: How to detect client abort?

Posted by George Chung <ge...@glympse.com>.
I'm reading a lot into your question, so apologies if I'm not answering the
correct question...

Basically, it's very difficult to get "exactly once" semantics in a client
server environment...over the Internet...in ANY environment...without
esoteric frameworks like transactional queues or two-phase-commit
protocols. And the Thrift libraries are not going to help you in this
manner at all (unless you decide to implement your own transport).

You will have to implement something similar to what credit card processors
do to prevent duplicate transactions: allow the client to tag a request
with a client side transaction id and retry safely in the case of an
ambiguous response (aka lost response). This implies that the server has to
behave in an idempotent manner...it pays attention to client generated
transaction ids, takes precautions not to execute them twice, and formats
the response to a duplicate request (because the client retried)
identically as if it were the initial request.

Same with a cancellation operations.

These client generated transaction ids would be defined in the IDL as part
of the application level protocol.

In transactional theory, the client is acting as the transaction manager.

On Mon, Jan 28, 2013 at 2:13 AM, Vivek Goel <go...@gmail.com> wrote:

> Hi,
> I am using C++ thrift library.
> Is there a way to detect client abort and cancel the  request on server
> side?
>
> If not.
> What should be the best way to achieve this type of functionality?
>
> regards
> Vivek Goel
>