Welcome! Log In Create A New Profile

Advanced

Issue with 3rd-party memc and eval modules

Markus Jelsma
February 16, 2010 05:56AM
Hi,


There is an issue with the 3rd-party memc module for Nginx [1] where it
doesn't close the connection when it resides in an eval [2] block.


Consider the following with memc in eval:

eval $memc_return
{
set $memc_cmd 'set';
set $memc_key 'key';
set $memc_value 'value';

memc_pass memcache_cluster;
}

echo 'hello!';
echo_flush;

When this location is called via curl, you'll get to see the following:
* About to connect() to localhost port 81 (#0)
* Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 81 (#0)
> GET
/session/synchronize/da39a3ee5e6b4b0d3255bfef95601890afd80709/da39a3ee5e6b4b0d3255bfef95601890afd80709/abc
HTTP/1.1
> User-Agent: curl/7.19.5 (i486-pc-linux-gnu) libcurl/7.19.5 OpenSSL/0.9.8g
zlib/1.2.3.3 libidn/1.15
> Host: localhost:81
> Accept: */*
>
^C
markus@zealand:/opt/nginx#

You can see i have to close the connection manually. I have also got a verbose
memcache server log which exactly closes the connection at the point i press
CTRL+C.




Now consider the following with memcached in eval, i have changed the above
configuration to use memcached instead of memc:

* About to connect() to localhost port 81 (#0)
* Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 81 (#0)
> GET
/session/synchronize/da39a3ee5e6b4b0d3255bfef95601890afd80709/da39a3ee5e6b4b0d3255bfef95601890afd80709/abc
HTTP/1.1
> User-Agent: curl/7.19.5 (i486-pc-linux-gnu) libcurl/7.19.5 OpenSSL/0.9.8g
zlib/1.2.3.3 libidn/1.15
> Host: localhost:81
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: nginx
< Date: Tue, 16 Feb 2010 10:46:22 GMT
< Content-Type: text/plain
< Transfer-Encoding: chunked
< Connection: close
<
hello!
* Closing connection #0


You can clearly see what's going on: this is what it should look like. Now,
also consider using the memc module with the eval lines commented out. I also
had to comment out the echo lines because otherwise it won't pass to memcache:


* About to connect() to localhost port 81 (#0)
* Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 81 (#0)
> GET
/session/synchronize/da39a3ee5e6b4b0d3255bfef95601890afd80709/da39a3ee5e6b4b0d3255bfef95601890afd80709/abc
HTTP/1.1
> User-Agent: curl/7.19.5 (i486-pc-linux-gnu) libcurl/7.19.5 OpenSSL/0.9.8g
zlib/1.2.3.3 libidn/1.15
> Host: localhost:81
> Accept: */*
>
< HTTP/1.1 201 Created
< Server: nginx
< Date: Tue, 16 Feb 2010 10:50:31 GMT
< Content-Type: text/plain
< Content-Length: 8
< Connection: close
<
STORED
* Closing connection #0



There is also a difference in HTTP response code and body if only using set,
here is what i found:

memc returns code=HTTP 201 body=STORED
memcached returns code=HTTP 200 body= <-- this is empty


Can the contributers of the modules please tell us something about this
behaviour? I'm using the latest stable 0.7 nginx and modules.


Many many thanks in advance


[1]: http://wiki.nginx.org/NginxHttpMemcModule
[2]: http://www.grid.net.ru/nginx/eval.en.html

Cheers,


Markus Jelsma - Technisch Architect - Buyways BV
http://www.linkedin.com/in/markus17
050-8536620 / 06-50258350


_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Issue with 3rd-party memc and eval modules

Markus Jelsma February 16, 2010 05:56AM

Re: Issue with 3rd-party memc and eval modules

Piotr Sikora February 16, 2010 06:20AM

Re: Issue with 3rd-party memc and eval modules

Markus Jelsma February 16, 2010 06:50AM

Re: Issue with 3rd-party memc and eval modules

Piotr Sikora February 16, 2010 07:12AM

Re: Issue with 3rd-party memc and eval modules

Markus Jelsma February 16, 2010 07:10AM

Re: Issue with 3rd-party memc and eval modules

Markus Jelsma February 17, 2010 03:54AM

Re: Issue with 3rd-party memc and eval modules

Piotr Sikora February 17, 2010 05:04AM

Re: Issue with 3rd-party memc and eval modules

Valery Kholodkov February 17, 2010 06:22AM

Re: Issue with 3rd-party memc and eval modules

Markus Jelsma February 17, 2010 06:58AM

Re: Issue with 3rd-party memc and eval modules

agentzh February 17, 2010 07:30AM

Re: Issue with 3rd-party memc and eval modules

Valery Kholodkov February 17, 2010 07:24AM

Re: Issue with 3rd-party memc and eval modules

Markus Jelsma February 17, 2010 07:30AM

Re: Issue with 3rd-party memc and eval modules

Piotr Sikora February 20, 2010 11:36AM

Re: Issue with 3rd-party memc and eval modules

Markus Jelsma February 20, 2010 11:36AM

Re: Issue with 3rd-party memc and eval modules

agentzh February 23, 2010 11:30PM

Re: Issue with 3rd-party memc and eval modules

Markus Jelsma February 24, 2010 08:56AM

Re: Issue with 3rd-party memc and eval modules

agentzh February 24, 2010 09:06PM

Re: Issue with 3rd-party memc and eval modules

Markus Jelsma February 20, 2010 11:36AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 313
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready