[Mulgara-dev] Query cancellation

Alex Hall alexhall at revelytix.com
Tue Jan 19 16:31:19 UTC 2010


On 1/19/2010 11:09 AM, Paul Gearon wrote:
> On Tue, Jan 19, 2010 at 10:10 AM, Alex Hall <alexhall at revelytix.com> wrote:
>> On 1/18/2010 9:29 PM, peter royal wrote:
>>> On Jan 18, 2010, at 8:13 PM, Paul Gearon wrote:
>>>>> It would be nice if the servlet container could detect that the client
>>>>> has abandoned a request and notify you, but I have no idea whether or
>>>>> not that is the case.
>>>>
>>>> I don't think so, but we can look. We could always add it as a patch
>>>> to Jetty (I wonder if Morton Bay would be interested?), so at least
>>>> one configuration had it, but it would be nice to find that the
>>>> servlet API allowed for something like this.
>>>
>>> I believe you find out at the time of the first byte being written to the output stream (where "finding out" is an IOException)
>>
>> That's what I was afraid of. By the time you are ready to write the
>> first byte to the output stream, you're done processing the query so
>> there's not much use in canceling at that point.
>>
>> The only thing I can think of using the servlet API would be finding
>> some method on the ServletInputStream or ServletOutputStream associated
>> with the request that is more or less a no-op, but would throw an
>> exception if the request is abandoned. Then, you could perhaps monitor
>> the client connection while doing the query in a worker thread. I'm not
>> sure if that would be feasible or not.
> 
> I thought it was the other way around, where a client (whether active
> or not) has slowed down a server, so you have to kill the associated
> operation on the server. Once you identify the rogue thread, you
> signal for it to die at the server end. If the client is still
> waiting, it would get the IOException at this time.
> 
> Do you want to be able to have clients abandon operations as well? I
> can understand why you'd want to, but I didn't realize that this is
> what you were trying to do here.

Yes, perhaps I should have been more explicitly clear on that point in
the beginning. My intention here is not to have the server actively
police all running operations and kill the rogue threads. My intention
is to provide a mechanism for the client to abandon a query that is
taking too long, or perhaps provide an administrative console on the
client side where a super-user can view queries submitted by the client
and kill the problem queries.

Alex



More information about the Mulgara-dev mailing list