Need help with abort connection

Need help with abort connection

am 22.07.2010 12:34:50 von Tobias Wagener

Hello,

I'm using
> apache 2.2.3
> mod_perl 2.0.2
> mod_apreq2 2.08
on a linux box.

In my enviroment a user can submit a query to a database. This request
is handled as an Ajax-request. If he forget to add some search parameters
this query can run a long time. So I add a "Cancel"-Button to the frontend
that abort the request. That will work with no problems. But on the
server side the request/query keeps on running.

My handler first collect all data and then send the header and print
the content. Because the handler works for Ajax and "normal" Requests
and first after finishing the complete request I can decide if the
"Content-Type" is html/pdf/json/xml/etc.

Can someone give me a hint or better a solution how I can abort the
request on the server side, too.

Please excuse my english, but I hope you understand my question ;-)

Best regards,

Tobias

Re: Need help with abort connection

am 22.07.2010 12:51:46 von Andreas Mock

Hi Tobias,

your whole scenario depends on the possibility to reliably
cancel a running query on the database.

If your database and client (software) is able to do so,
which has to be tested, the cancel button could send
another ajax request with an identifier of the initial
query which then would be canceled on the server side.

That on the other handside would mean that your initial
query request would put the query in a queue with an id,
send the id back immediately, redirecting the client to
an response page wich would present the query result
when available. Beware of TCP-IP timeouts, so that the
resultpage should redirect to itself regularly.

Best regards
Andreas



-----Ursprüngliche Nachricht-----
Von: Tobias Wagener
Gesendet: 22.07.2010 12:34:50
An: modperl@perl.apache.org
Betreff: Need help with abort connection

>Hello,
>
>I'm using=20
> > apache 2.2.3=20
> > mod_perl 2.0.2
> > mod_apreq2 2.08
>on a linux box.
>
>In my enviroment a user can submit a query to a database. This request
>is handled as an Ajax-request. If he forget to add some search parameters
>this query can run a long time. So I add a "Cancel"-Button to the frontend
>that abort the request. That will work with no problems. But on the
>server side the request/query keeps on running.
>
>My handler first collect all data and then send the header and print
>the content. Because the handler works for Ajax and "normal" Requests
>and first after finishing the complete request I can decide if the
>"Content-Type" is html/pdf/json/xml/etc.
>
>Can someone give me a hint or better a solution how I can abort the
>request on the server side, too.
>
>Please excuse my english, but I hope you understand my question ;-)
>
>Best regards,
>
>Tobias
>