Opened 8 years ago

Closed 8 years ago

#226 closed defect (invalid)

memcache_pass returns malformed content with big results

Reported by: Oscar Gentilezza Owned by: somebody
Priority: minor Milestone:
Component: nginx-module Version: 1.2.x
Keywords: memcache, memcached, HttpMemcachedModule Cc: tioscar@…
uname -a: Linux **** 2.6.18-028stab099.3 #1 SMP Wed Mar 7 15:20:22 MSK 2012 x86_64 GNU/Linux
nginx -V: 1.2.3 and 1.2.1


i'm trying to use HttpMemcachedModule in my server and i found that when it returns the memcache's content, nginx sends a page with binary content without format.
At first I thought it was a coding issue (gzip) and i lose a lot of time with it, then making several tests i realize doesn't have any logic and it was repeated in different pages, while the memcached's data were saved in correct way.
In order to reach a certain size of content, nginx send it broke (with binary code)

I tried modifying the memcached_buffer_size with differents sizes with no result.

I left an active configuration so you can see it by yourselves.

(just in this moment zoneedit is down, and my domain don't works)

If you see the first 2 links work fine, but the 3th fail (remember first time create the cache, so you must press F5 to see the cached page)

If you want to see the source code

This is the nginx configuration

server {

  listen 80;

  include /etc/nginx/proxy_params;

  location / {
    set $memcached_key "testmcngx:$uri?$args";
    memcached_pass     localhost:11211;
    default_type       text/html;
    error_page         404 = @fallback;
  location @fallback {
    proxy_pass http://localhost:8080;


About nginx, I am on a Ubuntu Server, but the sources are compiled with this parameters in the configure:

./configure --sbin-path=/usr/sbin --conf-path=/etc/nginx/nginx.conf
--error-log-path=/var/log/nginx/error.log --pid-path=/var/run/
--lock-path=/var/lock/nginx.lock --http-log-path=/var/log/nginx/access.log
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi --with-debug
--with-http_stub_status_module --with-http_flv_module --with-http_ssl_module
--with-http_dav_module --with-ipv6 --with-http_gzip_static_module

I test it on version 1.2.3 and 1.2.1 and both fails

Thanks and excuse my bad english.

Change History (1)

comment:1 by Maxim Dounin, 8 years ago

Resolution: invalid
Status: newclosed

This *is* compression, which is activated by your memcached client as long as key is big enough. It's not gzip though, it's zlib. In php using PECL memcache, use $m->setCompressThreshold(0); to disable compression.

Note: See TracTickets for help on using tickets.