thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Craig <ben.cr...@ni.com>
Subject Re: AW: Cancellation of a blocking read operation
Date Wed, 04 Sep 2013 13:51:33 GMT
If I were in your position, I would fork TSocket (TInterruptibleSocket?). 
I would then look at the implementation for the interrupt() method and the 
acceptImpl() method on TServerSocket, and transplant that into 
TInterruptibleSocket's read and write methods.  When read() and write() 
detect an interruption, you could either signal that via a return of 0, or 
with an exception.  Then, you would create your thrift client with a 
TInterruptibleSocket, and when your dialog starts to go away, you would 
call interrupt() on your TInterruptibleSocket.



From:   Jens Geyer <jensgeyer@hotmail.com>
To:     "user@thrift.apache.org" <user@thrift.apache.org>, 
Date:   09/01/2013 01:36 PM
Subject:        AW: Cancellation of a blocking read operation



What language? C# has async support, for example.

In general it's not recommended to do any cross machine/network calls in 
the UI thread, not only with Thrift.

Have fun,
Jens
________________________________
Von: Alex Shtof
Gesendet: 01.09.2013 14:48
An: user@thrift.apache.org
Betreff: RE: Cancellation of a blocking read operation

I am more concerned about client-side cancellation. For example, I would 
like to be able to hit "Cancel" in the UI of my application and all 
communications with the server will cease. I believe I am not the first to 
encounter the need to cancel thrift-based communications. Is there any 
other solution you might think of? I haven't seen any support for 
cancellation thrift/async headers either.

Alex.

-----Original Message-----
From: Ben Craig [mailto:ben.craig@ni.com]
Sent: Thursday, August 29, 2013 5:09 PM
To: user@thrift.apache.org
Subject: Re: Cancellation of a blocking read operation

There is not a safe, portable way to do that as far as I know.

One common way that this is mitigated is by using a framed transport. Most 
transports just send data as soon as it is available.  The framed 
transport puts the size of a message as the first four bytes.

On the server side, the framed transport is used by TNonBlockingServer to 
set up a state machine, such that you can call interrupt() on the server 
to tear things down.

There is a good reason that Thrift doesn't support cancellation of 
individual transport.  The typical way to implement cancellation is to 
change every "read()" call into both a "select()" and a "read()".  This 
double the number of system calls that need to be made, and does horrible 
things to performance.



From:   Alex Shtof <shtof.alex@visionmap.com>
To:     "user@thrift.apache.org" <user@thrift.apache.org>,
Date:   08/29/2013 02:39 AM
Subject:        Cancellation of a blocking read operation



Hi all.
I would like to ask for your help with cancellation of a blocking read 
operation that is in progress. The read operation (for example –
TProtocol::readByte) is blocked until the data is received. When I close 
the transport from another thread, I get a failed assertion about a null 
pointer.

Is there any other way to cancel a blocked read operation?

Alex.

This email and any files transmitted with it are confidential and contain 
proprietary information belonging to VisionMap Ltd. VisionMap Ltd. asserts 
in respect of this email and any files transmitted with it all rights for 
confidentiality and proprietary interests to the fullest extent permitted 
by law. If you are not the intended recipient you are notified that 
disclosing, copying, distributing or taking any action in reliance on the 
contents of this information is strictly prohibited. Thank you.



This email and any files transmitted with it are confidential and contain 
proprietary information belonging to VisionMap Ltd. VisionMap Ltd. asserts 
in respect of this email and any files transmitted with it all rights for 
confidentiality and proprietary interests to the fullest extent permitted 
by law. If you are not the intended recipient you are notified that 
disclosing, copying, distributing or taking any action in reliance on the 
contents of this information is strictly prohibited. Thank you.


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message