You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@trafficserver.apache.org by Jason Wieland <jw...@gmail.com> on 2010/07/16 02:31:41 UTC

help with ats plugins: logging, segfaults and malformed content

Hello group,  I'm running an up to date (Revision: 964088) of ATS on 64bit
ubuntu using the official ec2 images as a forward proxy.

I'm now attempting to write a plugin that will inject a line of html into
the body of the response content for every request the proxy serves.  ATS is
supplied with a bunch of example plugins that give me a great starting point
but I'm having a couple problems.

1. I can't seem to get the ' INKDebug("debug-hello", "Hello World!\n");' as
log by the hello.so plugin into either stdout or into syslog.  I added the
following options to records.config, but still no log messages

CONFIG proxy.config.diags.output.diag SE
CONFIG proxy.config.diags.output.debug SE
CONFIG proxy.config.diags.output.status SE
CONFIG proxy.config.diags.output.note SE
CONFIG proxy.config.diags.output.warning SE
CONFIG proxy.config.diags.output.error SE
CONFIG proxy.config.diags.output.fatal SE
CONFIG proxy.config.diags.output.alert SE
CONFIG proxy.config.diags.output.emergency SE


2. I compiled and successfully loaded in hello.so example plugin.  However
when I load in the null-transform.so plugin I get Segmentation faults after
about 3-4 requests:

root@ip-10-251-163-xxx:/usr/local# ./bin/traffic_server
[TrafficServer] using root directory '/usr/local'
[Jul 15 23:44:52.866] {140596841482000} STATUS: opened
/usr/local/var/log/trafficserver/diags.log
NOTE: Traffic Server received Sig 11: Segmentation fault
./bin/traffic_server - STACK TRACE:
Segmentation fault


3. When trying out the example plugin
append-transform.so /usr/local/etc/trafficserver/content_injection

and the inside the file content_injection I have:
<span>foo bar baz</span>



About 9 out of 10 times I get just the appended html


jwieland@ws-jwieland-lin2:~$ curl -v -x 184.73.156.165:8080
http://www.google.com
* About to connect() to proxy 184.73.156.165 port 8080 (#0)
*   Trying 184.73.156.165... connected
* Connected to 184.73.156.165 (184.73.156.165) port 8080 (#0)
> GET http://www.google.com HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/
3.12.6.2 zlib/1.2.3 libidn/1.9 libssh2/1.2.2
> Host: www.google.com
> Accept: */*
> Proxy-Connection: Keep-Alive
>
< HTTP/1.1 200 OK
< Date: Fri, 16 Jul 2010 00:04:15 GMT
< Expires: -1
< Cache-Control: private, max-age=0
< Content-Type: text/html; charset=ISO-8859-1
< Set-Cookie: xxxxxxx
< Server: ATS/2.1.2-unstable
< X-XSS-Protection: 1; mode=block
< Content-Length: 25
< Age: 1
< Proxy-Connection: keep-alive
< Via: HTTP/1.1 ip-10-251-163-160 (ApacheTrafficServer/2.1.2-unstable [c sSf
])
<
<span>foo bar baz</span>
* Connection #0 to host 184.73.156.165 left intact
* Closing connection #0

The 1/10 I would get the entire document with the addition.  I made sure I
restarted the server, I've set the

CONFIG proxy.config.http.cache.http INT 0

to make sure I'm not serving up a cached hit.  And I'm using curl to make
sure it is not a browser cache.


Thanks in advance for your help,

Jason Wieland

Re: help with ats plugins: logging, segfaults and malformed content

Posted by Leif Hedstrom <zw...@apache.org>.
On 07/16/2010 05:26 PM, Jason Wieland wrote:
> On Thu, Jul 15, 2010 at 6:18 PM, Leif Hedstrom <zwoop@apache.org 
> <ma...@apache.org>> wrote:
>
>     On 07/15/2010 06:31 PM, Jason Wieland wrote:
>
>         Hello group,  I'm running an up to date (Revision: 964088) of
>         ATS on 64bit ubuntu using the official ec2 images as a forward
>         proxy.
>
>         I'm now attempting to write a plugin that will inject a line
>         of html into the body of the response content for every
>         request the proxy serves.  ATS is supplied with a bunch of
>         example plugins that give me a great starting point but I'm
>         having a couple problems.
>
>         1. I can't seem to get the ' INKDebug("debug-hello", "Hello
>         World!\n");' as log by the hello.so plugin into either stdout
>         or into syslog.  I added the following options to
>         records.config, but still no log messages
>
>
>     You'd want to trace with "debug-hello", e.g. using traffic_server
>     from command line, run it with -T "debug-hello". That would
>     produce those on STDOUT. If enabling diagnostics via
>     records.config, and starting the normal way, I believe the output
>     should end up in traffic.out. E.g.
>
>     CONFIG proxy.config.diags.debug.enabled INT 1
>     CONFIG proxy.config.diags.debug.tags STRING debug-hello
>
>
>
> Got this working with -T 'tag'  but not with the CONFIG params.

Weird, worked for me. I tried with the "default" settings:

CONFIG proxy.config.diags.debug.enabled INT 1
CONFIG proxy.config.diags.debug.tags STRING http.*|dns.*


Then I did "trafficserver start", and

root@loki 543/0 # tail var/log/trafficserver/traffic.out
[Jul 18 15:40:46.952] Server {47879922951952} DEBUG: (http_tunnel) [4] 
consumer_handler [user agent VC_EVENT_WRITE_COMPLETE]
[Jul 18 15:40:46.952] Server {47879922951952} DEBUG: (http) [4] 
[&HttpSM::tunnel_handler_ua, VC_EVENT_WRITE_COMPLETE]
[Jul 18 15:40:46.952] Server {47879922951952} DEBUG: (http_cs) [4] 
session closed
[Jul 18 15:40:46.952] Server {47879922951952} DEBUG: (http_cs) [4] 
session destroy
[Jul 18 15:40:46.952] Server {47879922951952} DEBUG: (http_ss) [4] 
session closed


-- Leif


Re: help with ats plugins: logging, segfaults and malformed content

Posted by Jason Wieland <jw...@gmail.com>.
On Thu, Jul 15, 2010 at 6:18 PM, Leif Hedstrom <zw...@apache.org> wrote:

> On 07/15/2010 06:31 PM, Jason Wieland wrote:
>
>> Hello group,  I'm running an up to date (Revision: 964088) of ATS on 64bit
>> ubuntu using the official ec2 images as a forward proxy.
>>
>> I'm now attempting to write a plugin that will inject a line of html into
>> the body of the response content for every request the proxy serves.  ATS is
>> supplied with a bunch of example plugins that give me a great starting point
>> but I'm having a couple problems.
>>
>> 1. I can't seem to get the ' INKDebug("debug-hello", "Hello World!\n");'
>> as log by the hello.so plugin into either stdout or into syslog.  I added
>> the following options to records.config, but still no log messages
>>
>
> You'd want to trace with "debug-hello", e.g. using traffic_server from
> command line, run it with -T "debug-hello". That would produce those on
> STDOUT. If enabling diagnostics via records.config, and starting the normal
> way, I believe the output should end up in traffic.out. E.g.
>
> CONFIG proxy.config.diags.debug.enabled INT 1
> CONFIG proxy.config.diags.debug.tags STRING debug-hello
>
>
>
Got this working with -T 'tag'  but not with the CONFIG params.

Thanks.

Jason

Re: help with ats plugins: logging, segfaults and malformed content

Posted by Leif Hedstrom <zw...@apache.org>.
On 07/15/2010 06:31 PM, Jason Wieland wrote:
> Hello group,  I'm running an up to date (Revision: 964088) of ATS on 
> 64bit ubuntu using the official ec2 images as a forward proxy.
>
> I'm now attempting to write a plugin that will inject a line of html 
> into the body of the response content for every request the proxy 
> serves.  ATS is supplied with a bunch of example plugins that give me 
> a great starting point but I'm having a couple problems.
>
> 1. I can't seem to get the ' INKDebug("debug-hello", "Hello 
> World!\n");' as log by the hello.so plugin into either stdout or into 
> syslog.  I added the following options to records.config, but still no 
> log messages

You'd want to trace with "debug-hello", e.g. using traffic_server from 
command line, run it with -T "debug-hello". That would produce those on 
STDOUT. If enabling diagnostics via records.config, and starting the 
normal way, I believe the output should end up in traffic.out. E.g.

CONFIG proxy.config.diags.debug.enabled INT 1
CONFIG proxy.config.diags.debug.tags STRING debug-hello

>
> 2. I compiled and successfully loaded in hello.so example plugin. 
>  However when I load in the null-transform.so plugin I get 
> Segmentation faults after about 3-4 requests:
>
> root@ip-10-251-163-xxx:/usr/local# ./bin/traffic_server
> [TrafficServer] using root directory '/usr/local'
> [Jul 15 23:44:52.866] {140596841482000} STATUS: opened 
> /usr/local/var/log/trafficserver/diags.log
> NOTE: Traffic Server received Sig 11: Segmentation fault
> ./bin/traffic_server - STACK TRACE:
> Segmentation fault

I'd have to try this myself, unless you can provide a stack trace 
(and/or file a bug). I'm ooffice until next week though.


Cheers,

-- leif