issue with XSLT [0.8.x]

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

issue with XSLT [0.8.x]

vedranf
I'm having a weird issue with the XSLT module in nginx: after some random time, requesting an XSLT-transformed URL generates 500-errors. The errorlog tells me that the XML-document is not well formed, which it is.

It seems to be similar to an issue raised on the Russian maillinglist (http://www.lexa.ru/nginx-ru/msg25325.html ), although I'm not using FastCGI but just use static XML files as input for the XSLT-engine.

Running an strace or debugging with http_debug doesn't show anything weird as far as I can tell:

2009/07/16 21:49:34  16452#0: *65 http cl:-1 max:1048576
2009/07/16 21:49:34  16452#0: *65 generic phase: 2
2009/07/16 21:49:34  16452#0: *65 post rewrite phase: 3
2009/07/16 21:49:34  16452#0: *65 generic phase: 4
2009/07/16 21:49:34  16452#0: *65 generic phase: 5
2009/07/16 21:49:34  16452#0: *65 access phase: 6
2009/07/16 21:49:34  16452#0: *65 access phase: 7
2009/07/16 21:49:34  16452#0: *65 post access phase: 8
2009/07/16 21:49:34  16452#0: *65 content phase: 9
2009/07/16 21:49:34  16452#0: *65 open index "/var/www/allyourbass.org/htdocs/index.xml"
2009/07/16 21:49:34  16452#0: *65 internal redirect: "/index.xml?"
2009/07/16 21:49:34  16452#0: *65 http cl:-1 max:1048576
2009/07/16 21:49:34  16452#0: *65 generic phase: 2
2009/07/16 21:49:34  16452#0: *65 post rewrite phase: 3
2009/07/16 21:49:34  16452#0: *65 generic phase: 4
2009/07/16 21:49:34  16452#0: *65 generic phase: 5
2009/07/16 21:49:34  16452#0: *65 access phase: 6
2009/07/16 21:49:34  16452#0: *65 access phase: 7
2009/07/16 21:49:34  16452#0: *65 post access phase: 8
2009/07/16 21:49:34  16452#0: *65 content phase: 9
2009/07/16 21:49:34  16452#0: *65 content phase: 10
2009/07/16 21:49:34  16452#0: *65 content phase: 11
2009/07/16 21:49:34  16452#0: *65 http filename: "/var/www/allyourbass.org/htdocs/index.xml"
2009/07/16 21:49:34  16452#0: *65 http static fd: 16
2009/07/16 21:49:34  16452#0: *65 http set discard body
2009/07/16 21:49:34  16452#0: *65 xslt filter header
2009/07/16 21:49:34  16452#0: *65 http output filter "/index.xml?"
2009/07/16 21:49:34  16452#0: *65 copy filter: "/index.xml?"
2009/07/16 21:49:34  16452#0: *65 xslt filter body
2009/07/16 21:49:34  16452#0: *65 not well formed XML document while sending response to client, client: 83.161.41.147, server: klep.name, request: "GET / HTTP/1.1", host: "klep.name"
2009/07/16 21:49:34  16452#0: *65 http special response: 500, "/index.xml?"
2009/07/16 21:49:34  16452#0: *65 http set discard body
2009/07/16 21:49:34  16452#0: *65 xslt filter header
2009/07/16 21:49:34  16452#0: *65 HTTP/1.1 500 Internal Server Error
Server: nginx/0.8.5
Date: Thu, 16 Jul 2009 19:49:34 GMT
Content-Type: text/html
Content-Length: 192
Connection: close

2009/07/16 21:49:34  16452#0: *65 http write filter: l:0 f:0 s:161
2009/07/16 21:49:34  16452#0: *65 http output filter "/index.xml?"
2009/07/16 21:49:34  16452#0: *65 copy filter: "/index.xml?"
2009/07/16 21:49:34  16452#0: *65 xslt filter body
2009/07/16 21:49:34  16452#0: *65 http postpone filter "/index.xml?" 098EDFE0
2009/07/16 21:49:34  16452#0: *65 http write filter: l:1 f:0 s:353
2009/07/16 21:49:34  16452#0: *65 http write filter limit 0
2009/07/16 21:49:34  16452#0: *65 http write filter 00000000
2009/07/16 21:49:34  16452#0: *65 copy filter: 0 "/index.xml?"
2009/07/16 21:49:34  16452#0: *65 copy filter: -1 "/index.xml?"
2009/07/16 21:49:34  16452#0: *65 http finalize request: -1, "/index.xml?" 1
2009/07/16 21:49:34  16452#0: *65 http close request
2009/07/16 21:49:34  16452#0: *65 http log handler
2009/07/16 21:49:34  16452#0: *65 close http connection: 15


Some more info

$ nginx -V
nginx version: nginx/0.8.5
configure arguments: --with-http_xslt_module --with-mail --http-client-body-temp-path=/tmp/nginx/client-body-temp/ --http-proxy-temp-path=/tmp/nginx/proxy-temp/ --http-fastcgi-temp-path=/tmp/nginx/fastcgi-temp/ --with-md5-asm --with-sha1-asm --with-http_ssl_module --with-http_perl_module --with-http_sub_module --with-http_secure_link_module --prefix=/usr --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid --http-log-path=/var/log/nginx/access.log --with-debug



$ uname -a
Linux webserver 2.6.26-1-openvz-686 #1 SMP Sat Nov 8 21:19:32 UTC 2008 i686 GNU/Linux


Does anyone have any idea what might be the issue? I've looked through the code of the module but nothing strikes me as obviously wrong.

Regards,
Robert

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,4128,4128#msg-4128


Reply | Threaded
Open this post in threaded view
|

Re: issue with XSLT [0.8.x]

Kuramoto Eiji
I think it may be a bug.

well-formed status (ctx->ctxt->wellFormed) should check and save
before free xmlParserCtxtPtr. like this,

--- ngx_http_xslt_filter_module.c 29 May 2009 03:29:15 -0000 1.8
+++ ngx_http_xslt_filter_module.c 2 Jun 2009 08:15:28 -0000 1.9
@@ -273,6 +273,7 @@
 {
     ngx_chain_t                 *cl;
     ngx_http_xslt_filter_ctx_t  *ctx;
+    int wellFormed;
 
     ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
                    "xslt filter body");
@@ -312,9 +313,14 @@
             ctx->doc->extSubset = NULL;
 #endif
 
+    /*
+     * save well-formed status, so free ctx->ctxt in xmlFreeParserCtxt().
+     */
+    wellFormed = ctx->ctxt->wellFormed;
+
             xmlFreeParserCtxt(ctx->ctxt);
 
-            if (ctx->ctxt->wellFormed) {
+            if (wellFormed) {
                 return ngx_http_xslt_send(r, ctx,
                                        ngx_http_xslt_apply_stylesheet(r, ctx));
             }

 On Thu, 16 Jul 2009 16:19:05 -0400
    valve wrote:

 } I'm having a weird issue with the XSLT module in nginx: after some random time, requesting an XSLT-transformed URL generates 500-errors. The errorlog tells me that the XML-document is not well formed, which it is.
 }
 } It seems to be similar to an issue raised on the Russian maillinglist (http://www.lexa.ru/nginx-ru/msg25325.html ), although I'm not using FastCGI but just use static XML files as input for the XSLT-engine.

- Kuramoto Eiji

Reply | Threaded
Open this post in threaded view
|

Re: issue with XSLT [0.8.x]

Maxim Dounin
In reply to this post by vedranf
Hello!

On Thu, Jul 16, 2009 at 04:19:05PM -0400, valve wrote:

> I'm having a weird issue with the XSLT module in nginx: after some random time, requesting an XSLT-transformed URL generates 500-errors. The errorlog tells me that the XML-document is not well formed, which it is.
>
> It seems to be similar to an issue raised on the Russian maillinglist (http://www.lexa.ru/nginx-ru/msg25325.html ), although I'm not using FastCGI but just use static XML files as input for the XSLT-engine.
>
> Running an strace or debugging with http_debug doesn't show anything weird as far as I can tell:

Could you please show full debug log of such request (not only
last lines) and with 'debug', not 'debug_http'?

Relevant debug log of successfull request may be usefull too.

Maxim Dounin

>
> 2009/07/16 21:49:34  16452#0: *65 http cl:-1 max:1048576
> 2009/07/16 21:49:34  16452#0: *65 generic phase: 2
> 2009/07/16 21:49:34  16452#0: *65 post rewrite phase: 3
> 2009/07/16 21:49:34  16452#0: *65 generic phase: 4
> 2009/07/16 21:49:34  16452#0: *65 generic phase: 5
> 2009/07/16 21:49:34  16452#0: *65 access phase: 6
> 2009/07/16 21:49:34  16452#0: *65 access phase: 7
> 2009/07/16 21:49:34  16452#0: *65 post access phase: 8
> 2009/07/16 21:49:34  16452#0: *65 content phase: 9
> 2009/07/16 21:49:34  16452#0: *65 open index "/var/www/allyourbass.org/htdocs/index.xml"
> 2009/07/16 21:49:34  16452#0: *65 internal redirect: "/index.xml?"
> 2009/07/16 21:49:34  16452#0: *65 http cl:-1 max:1048576
> 2009/07/16 21:49:34  16452#0: *65 generic phase: 2
> 2009/07/16 21:49:34  16452#0: *65 post rewrite phase: 3
> 2009/07/16 21:49:34  16452#0: *65 generic phase: 4
> 2009/07/16 21:49:34  16452#0: *65 generic phase: 5
> 2009/07/16 21:49:34  16452#0: *65 access phase: 6
> 2009/07/16 21:49:34  16452#0: *65 access phase: 7
> 2009/07/16 21:49:34  16452#0: *65 post access phase: 8
> 2009/07/16 21:49:34  16452#0: *65 content phase: 9
> 2009/07/16 21:49:34  16452#0: *65 content phase: 10
> 2009/07/16 21:49:34  16452#0: *65 content phase: 11
> 2009/07/16 21:49:34  16452#0: *65 http filename: "/var/www/allyourbass.org/htdocs/index.xml"
> 2009/07/16 21:49:34  16452#0: *65 http static fd: 16
> 2009/07/16 21:49:34  16452#0: *65 http set discard body
> 2009/07/16 21:49:34  16452#0: *65 xslt filter header
> 2009/07/16 21:49:34  16452#0: *65 http output filter "/index.xml?"
> 2009/07/16 21:49:34  16452#0: *65 copy filter: "/index.xml?"
> 2009/07/16 21:49:34  16452#0: *65 xslt filter body
> 2009/07/16 21:49:34  16452#0: *65 not well formed XML document while sending response to client, client: 83.161.41.147, server: klep.name, request: "GET / HTTP/1.1", host: "klep.name"
> 2009/07/16 21:49:34  16452#0: *65 http special response: 500, "/index.xml?"
> 2009/07/16 21:49:34  16452#0: *65 http set discard body
> 2009/07/16 21:49:34  16452#0: *65 xslt filter header
> 2009/07/16 21:49:34  16452#0: *65 HTTP/1.1 500 Internal Server Error
> Server: nginx/0.8.5
> Date: Thu, 16 Jul 2009 19:49:34 GMT
> Content-Type: text/html
> Content-Length: 192
> Connection: close
>
> 2009/07/16 21:49:34  16452#0: *65 http write filter: l:0 f:0 s:161
> 2009/07/16 21:49:34  16452#0: *65 http output filter "/index.xml?"
> 2009/07/16 21:49:34  16452#0: *65 copy filter: "/index.xml?"
> 2009/07/16 21:49:34  16452#0: *65 xslt filter body
> 2009/07/16 21:49:34  16452#0: *65 http postpone filter "/index.xml?" 098EDFE0
> 2009/07/16 21:49:34  16452#0: *65 http write filter: l:1 f:0 s:353
> 2009/07/16 21:49:34  16452#0: *65 http write filter limit 0
> 2009/07/16 21:49:34  16452#0: *65 http write filter 00000000
> 2009/07/16 21:49:34  16452#0: *65 copy filter: 0 "/index.xml?"
> 2009/07/16 21:49:34  16452#0: *65 copy filter: -1 "/index.xml?"
> 2009/07/16 21:49:34  16452#0: *65 http finalize request: -1, "/index.xml?" 1
> 2009/07/16 21:49:34  16452#0: *65 http close request
> 2009/07/16 21:49:34  16452#0: *65 http log handler
> 2009/07/16 21:49:34  16452#0: *65 close http connection: 15
>
>
> Some more info
>
> $ nginx -V
> nginx version: nginx/0.8.5
> configure arguments: --with-http_xslt_module --with-mail --http-client-body-temp-path=/tmp/nginx/client-body-temp/ --http-proxy-temp-path=/tmp/nginx/proxy-temp/ --http-fastcgi-temp-path=/tmp/nginx/fastcgi-temp/ --with-md5-asm --with-sha1-asm --with-http_ssl_module --with-http_perl_module --with-http_sub_module --with-http_secure_link_module --prefix=/usr --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid --http-log-path=/var/log/nginx/access.log --with-debug
>
>
>
> $ uname -a
> Linux webserver 2.6.26-1-openvz-686 #1 SMP Sat Nov 8 21:19:32 UTC 2008 i686 GNU/Linux
>
>
> Does anyone have any idea what might be the issue? I've looked through the code of the module but nothing strikes me as obviously wrong.
>
> Regards,
> Robert
>
> Posted at Nginx Forum: http://forum.nginx.org/read.php?2,4128,4128#msg-4128
>
>

Reply | Threaded
Open this post in threaded view
|

Re: issue with XSLT [0.8.x]

Maxim Dounin
In reply to this post by Kuramoto Eiji
Hello!

On Fri, Jul 17, 2009 at 11:14:57AM +0900, Kuramoto Eiji wrote:

> I think it may be a bug.
>
> well-formed status (ctx->ctxt->wellFormed) should check and save
> before free xmlParserCtxtPtr. like this,

Nice catch, thanks!

Maxim Dounin

>
> --- ngx_http_xslt_filter_module.c 29 May 2009 03:29:15 -0000 1.8
> +++ ngx_http_xslt_filter_module.c 2 Jun 2009 08:15:28 -0000 1.9
> @@ -273,6 +273,7 @@
>  {
>      ngx_chain_t                 *cl;
>      ngx_http_xslt_filter_ctx_t  *ctx;
> +    int wellFormed;
>  
>      ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
>                     "xslt filter body");
> @@ -312,9 +313,14 @@
>              ctx->doc->extSubset = NULL;
>  #endif
>  
> +    /*
> +     * save well-formed status, so free ctx->ctxt in xmlFreeParserCtxt().
> +     */
> +    wellFormed = ctx->ctxt->wellFormed;
> +
>              xmlFreeParserCtxt(ctx->ctxt);
>  
> -            if (ctx->ctxt->wellFormed) {
> +            if (wellFormed) {
>                  return ngx_http_xslt_send(r, ctx,
>                                         ngx_http_xslt_apply_stylesheet(r, ctx));
>              }
>
>  On Thu, 16 Jul 2009 16:19:05 -0400
>     valve wrote:
>
>  } I'm having a weird issue with the XSLT module in nginx: after some random time, requesting an XSLT-transformed URL generates 500-errors. The errorlog tells me that the XML-document is not well formed, which it is.
>  }
>  } It seems to be similar to an issue raised on the Russian maillinglist (http://www.lexa.ru/nginx-ru/msg25325.html ), although I'm not using FastCGI but just use static XML files as input for the XSLT-engine.
>
> - Kuramoto Eiji
>

Reply | Threaded
Open this post in threaded view
|

Re: issue with XSLT [0.8.x]

vedranf
In reply to this post by vedranf
Kuramoto Eiji Wrote:
-------------------------------------------------------
> I think it may be a bug.
>
> well-formed status (ctx->ctxt->wellFormed) should
> check and save
> before free xmlParserCtxtPtr. like this,

That sounds quite reasonable :)

I've applied your patch and will keep a close look on how it works.

Thx!

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,4128,4140#msg-4140


Reply | Threaded
Open this post in threaded view
|

Re: issue with XSLT [0.8.x]

vedranf
valve Wrote:
-------------------------------------------------------
> I've applied your patch and will keep a close look
> on how it works.

It's been a couple of days now, and it still works, whereas before it would start acting up within a few hours. Seems that it did the trick!

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,4128,4217#msg-4217