# Nginx hangs on page with multiple virtual ssi tags that hit memcache

**URL:** <https://www.ruby-forum.com/t/nginx-hangs-on-page-with-multiple-virtual-ssi-tags-that-hit-memcache/135319>\
**Category:** NGINX\
**Created:** [April 21, 2008, 7:08am UTC](https://www.ruby-forum.com/t/nginx-hangs-on-page-with-multiple-virtual-ssi-tags-that-hit-memcache/135319 "2008-04-21T07:08:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![knappe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/5fc32e/32.png) [@knappe](https://www.ruby-forum.com/u/knappe)\
**Post date:** [April 21, 2008, 7:08am UTC](https://www.ruby-forum.com/t/nginx-hangs-on-page-with-multiple-virtual-ssi-tags-that-hit-memcache/135319/1 "2008-04-21T07:08:36Z")

</div>

I have discovered a situation where nginx consistently hangs when  
interacting  
with memcached while using multiple SSI virtual tags in a single page.  
Our  
application returns a page that looks like this:

…

…

nginx is configured to serve local files, then fallback to memcache then  
fallback to my upstream app (Rails) like this:

location / {  
error\_page 404 = @memcache;  
}

location @memcache {  
set $memcached\_key “nginx:$uri?$args”;  
memcached\_pass localhost:11212;  
default\_type text/html;  
error\_page 404 502 = @fallback;  
}

location @fallback {  
ssi on;  
proxy\_pass [http://zvents](http://zvents);  
}

nginx returns the page and then attempts to process the SSI virtual  
tags. If  
the page has multiple virtual SSI and they are not set to wait then  
nginx hangs  
when trying to talk to memcached. Sometimes the first few requests are  
successful but it doesn’t take long for nginx to lock up. nginx does  
not lock  
up under any of these conditions:

- there’s only 1 SSI virtual on the page
- there’s multiple SSI virtual but each is set wait=“yes”
- memcached is not running or the memcache requests are cache misses

I have tested with nginx 0.5.32, 0.5.35 and 0.6.29 with memcached 1.2.2  
and  
1.2.5 - it happens with each combination.

Has anyone else seen this?

---

<div class="post-metadata">

**Author:** ![knappe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/5fc32e/32.png) [@knappe](https://www.ruby-forum.com/u/knappe)\
**Post date:** [October 7, 2008, 10:06am UTC](https://www.ruby-forum.com/t/nginx-hangs-on-page-with-multiple-virtual-ssi-tags-that-hit-memcache/135319/2 "2008-10-07T10:06:13Z")

</div>

This post was a life saver. I’ve used wait=yes option and that has  
helped remedy my ‘hang’ as well .

Thank god for ruby-talk.  
Here’s an awesome link as well, with other ssi methods/gotcha’s -

[http://wiki.codemongers.com/NginxHttpSsiModule](http://wiki.codemongers.com/NginxHttpSsiModule)

Thanks again!

Tyler K. wrote:

> I have discovered a situation where nginx consistently hangs when  
> interacting  
> with memcached while using multiple SSI virtual tags in a single page.  
> Our  
> nginx returns the page and then attempts to process the SSI virtual  
> tags. If  
> the page has multiple virtual SSI and they are not set to wait then  
> nginx hangs  
> when trying to talk to memcached. Sometimes the first few requests are  
> successful but it doesn’t take long for nginx to lock up. nginx does  
> not lock  
> up under any of these conditions:
> 
> - there’s only 1 SSI virtual on the page
> - there’s multiple SSI virtual but each is set wait=“yes”
> - memcached is not running or the memcache requests are cache misses
> 
> I have tested with nginx 0.5.32, 0.5.35 and 0.6.29 with memcached 1.2.2  
> and  
> 1.2.5 - it happens with each combination.
> 
> Has anyone else seen this?
