You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafficserver.apache.org by Carlos Guerreiro <ca...@gmail.com> on 2013/10/25 07:59:02 UTC

what is the correct way to abort an HTTP transaction in a transformation plugin?

Hi,

What is the correct way to abort an HTTP transaction in a transformation
plugin, while transforming the message body?
So that origin server and client sockets are closed ASAP and everything is
cleaned up properly in the entire transformation chain.

Br,
Carlos

Re: what is the correct way to abort an HTTP transaction in a transformation plugin?

Posted by James Peach <jp...@apache.org>.
On Oct 28, 2013, at 3:51 AM, Carlos Guerreiro <ca...@gmail.com> wrote:

> Thanks for the hint.
> 
> I've tried that before (and again now). Unfortunately I get an assert and a
> crash right on TSContCall.
> 
> [Oct 28 12:37:48.170] Server {0x2aaaadbea700} DEBUG: <HttpTunnel.cc:1241
> (consumer_handler)> (http_tunnel) [0] consumer_handler [transform write
> VC_EVENT_ERROR]
> FATAL: HttpTunnel.cc:1243: failed assert `c->alive == true`
> 
> This happens at a point where data has been written to the output
> connection but the write operation has not yet completed.
> Any suggestions are welcome.

I think that Brian and Alan are the most experience with transformations. Maybe they can help ...

> 
> Br,
> Carlos
> 
> 
> 
> On Fri, Oct 25, 2013 at 6:56 PM, James Peach <jp...@apache.org> wrote:
> 
>> On Oct 24, 2013, at 10:59 PM, Carlos Guerreiro <
>> carlos.h.guerreiro@gmail.com> wrote:
>> 
>>> Hi,
>>> 
>>> What is the correct way to abort an HTTP transaction in a transformation
>>> plugin, while transforming the message body?
>>> So that origin server and client sockets are closed ASAP and everything
>> is
>>> cleaned up properly in the entire transformation chain.
>> 
>> I'm guessing that you would inject the error into the transformation chain
>> using TSContCall(..., TS_EVENT_ERROR, ...). I see this being done in
>> plugins/gzip/gzip.cc, plugins/experimental/esi/esi.cc and
>> lib/atscppapi/src/TransformationPlugin.cc.
>> 
>> Interestingly, most of these examples use that pattern to propagate
>> errors, but few (none?) use it to generate errors.
>> 
>> J
>> 


RE: what is the correct way to abort an HTTP transaction in a transformation plugin?

Posted by Shaun McGinnity <Sh...@owmobility.com>.
Hi Carlos,

Have you tried sending TS_EVENT_VCONN_EOS to the VConn write VIO?

Regards,

Shaun

-----Original Message-----
From: Carlos Guerreiro [mailto:carlos.h.guerreiro@gmail.com] 
Sent: Monday, October 28, 2013 10:51 AM
To: dev@trafficserver.apache.org
Subject: Re: what is the correct way to abort an HTTP transaction in a transformation plugin?

Thanks for the hint.

I've tried that before (and again now). Unfortunately I get an assert and a crash right on TSContCall.

[Oct 28 12:37:48.170] Server {0x2aaaadbea700} DEBUG: <HttpTunnel.cc:1241 (consumer_handler)> (http_tunnel) [0] consumer_handler [transform write VC_EVENT_ERROR]
FATAL: HttpTunnel.cc:1243: failed assert `c->alive == true`

This happens at a point where data has been written to the output connection but the write operation has not yet completed.
Any suggestions are welcome.

Br,
Carlos



On Fri, Oct 25, 2013 at 6:56 PM, James Peach <jp...@apache.org> wrote:

> On Oct 24, 2013, at 10:59 PM, Carlos Guerreiro < 
> carlos.h.guerreiro@gmail.com> wrote:
>
> > Hi,
> >
> > What is the correct way to abort an HTTP transaction in a 
> > transformation plugin, while transforming the message body?
> > So that origin server and client sockets are closed ASAP and 
> > everything
> is
> > cleaned up properly in the entire transformation chain.
>
> I'm guessing that you would inject the error into the transformation 
> chain using TSContCall(..., TS_EVENT_ERROR, ...). I see this being 
> done in plugins/gzip/gzip.cc, plugins/experimental/esi/esi.cc and 
> lib/atscppapi/src/TransformationPlugin.cc.
>
> Interestingly, most of these examples use that pattern to propagate 
> errors, but few (none?) use it to generate errors.
>
> J
>

Re: what is the correct way to abort an HTTP transaction in a transformation plugin?

Posted by Carlos Guerreiro <ca...@gmail.com>.
Thanks for the hint.

I've tried that before (and again now). Unfortunately I get an assert and a
crash right on TSContCall.

[Oct 28 12:37:48.170] Server {0x2aaaadbea700} DEBUG: <HttpTunnel.cc:1241
(consumer_handler)> (http_tunnel) [0] consumer_handler [transform write
VC_EVENT_ERROR]
FATAL: HttpTunnel.cc:1243: failed assert `c->alive == true`

This happens at a point where data has been written to the output
connection but the write operation has not yet completed.
Any suggestions are welcome.

Br,
Carlos



On Fri, Oct 25, 2013 at 6:56 PM, James Peach <jp...@apache.org> wrote:

> On Oct 24, 2013, at 10:59 PM, Carlos Guerreiro <
> carlos.h.guerreiro@gmail.com> wrote:
>
> > Hi,
> >
> > What is the correct way to abort an HTTP transaction in a transformation
> > plugin, while transforming the message body?
> > So that origin server and client sockets are closed ASAP and everything
> is
> > cleaned up properly in the entire transformation chain.
>
> I'm guessing that you would inject the error into the transformation chain
> using TSContCall(..., TS_EVENT_ERROR, ...). I see this being done in
> plugins/gzip/gzip.cc, plugins/experimental/esi/esi.cc and
> lib/atscppapi/src/TransformationPlugin.cc.
>
> Interestingly, most of these examples use that pattern to propagate
> errors, but few (none?) use it to generate errors.
>
> J
>

Re: what is the correct way to abort an HTTP transaction in a transformation plugin?

Posted by Nick Kew <ni...@apache.org>.
On 25 Oct 2013, at 16:56, James Peach wrote:

> On Oct 24, 2013, at 10:59 PM, Carlos Guerreiro <ca...@gmail.com> wrote:
> 
>> Hi,
>> 
>> What is the correct way to abort an HTTP transaction in a transformation
>> plugin, while transforming the message body?

I struggled with the same issue, and as far as I can tell it's not possible
within the public API.  We can handle events, but we can't originate them.

> I'm guessing that you would inject the error into the transformation chain using TSContCall(..., TS_EVENT_ERROR, ...). I see this being done in plugins/gzip/gzip.cc, plugins/experimental/esi/esi.cc and lib/atscppapi/src/TransformationPlugin.cc.

That seems to answer a slightly different question.  You're still (from the
Client's perspective) processing normally, but just returning an error
on completion.

-- 
Nick Kew

Re: what is the correct way to abort an HTTP transaction in a transformation plugin?

Posted by James Peach <jp...@apache.org>.
On Oct 24, 2013, at 10:59 PM, Carlos Guerreiro <ca...@gmail.com> wrote:

> Hi,
> 
> What is the correct way to abort an HTTP transaction in a transformation
> plugin, while transforming the message body?
> So that origin server and client sockets are closed ASAP and everything is
> cleaned up properly in the entire transformation chain.

I'm guessing that you would inject the error into the transformation chain using TSContCall(..., TS_EVENT_ERROR, ...). I see this being done in plugins/gzip/gzip.cc, plugins/experimental/esi/esi.cc and lib/atscppapi/src/TransformationPlugin.cc.

Interestingly, most of these examples use that pattern to propagate errors, but few (none?) use it to generate errors.

J