2 messages in ru.sysoev.nginxRe: error when using memcached_pass +...
FromSent OnAttachments
LarrytheliquidDec 22, 2007 2:52 am 
Igor SysoevDec 26, 2007 2:11 am.txt
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: error when using memcached_pass + "if statement" that evaluates to trueActions...
From:Igor Sysoev (is-G@public.gmane.org)
Date:Dec 26, 2007 2:11:42 am
List:ru.sysoev.nginx
Attachments:

On Sat, Dec 22, 2007 at 05:52:25AM -0500, Larrytheliquid wrote:

The following error occurs when any "if statement" evaluates to true inside of a context with a memcached_pass: 2007/12/22 05:47:42 [alert] 1333#0: worker process 1334 exited on signal 10

Here are some example files to demonstrate the error (remember to run memcached):

------------------------------------------------------ nginx.conf

------------------------------------------------------ worker_processes 1; events { worker_connections 256; }

http { server { listen 8084; default_type text/html;

location / { # If you comment out this if statement, or change != to =, the error will not occur if ($request != "") { # The following error occurs when any "if statement" # evaluates to true inside of a context with a memcached_pass: # 2007/12/22 05:47:42 [alert] 1333#0: worker process 1334 exited on signal 10 }

set $memcached_key "NOT_IN_CACHE"; memcached_pass localhost:11211; proxy_intercept_errors on; error_page 404 502 = /cache_miss.html; }

location /cache_miss.html { root /Users/larry/Sites/ngingx_request_uri; } } }

The attched patch shoudl fix the bug.

-- Igor Sysoev http://sysoev.ru/en/

Index: src/http/modules/ngx_http_memcached_module.c =================================================================== --- src/http/modules/ngx_http_memcached_module.c (revision 1096) +++ src/http/modules/ngx_http_memcached_module.c (working copy) @@ -524,8 +524,6 @@ * conf->upstream.schema = { 0, NULL }; * conf->upstream.uri = { 0, NULL }; * conf->upstream.location = NULL; - * - * conf->index = 0; */

conf->upstream.connect_timeout = NGX_CONF_UNSET_MSEC; @@ -548,6 +546,8 @@ conf->upstream.pass_request_headers = 0; conf->upstream.pass_request_body = 0;

+ conf->index = NGX_CONF_UNSET; + return conf; }

@@ -582,6 +582,15 @@ |NGX_HTTP_UPSTREAM_FT_OFF; }

+ if (conf->upstream.upstream == NULL) { + conf->upstream.upstream = prev->upstream.upstream; + conf->upstream.schema = prev->upstream.schema; + } + + if (conf->index == NGX_CONF_UNSET) { + conf->index = prev->index; + } + return NGX_CONF_OK; }