# Upstream keepalive - call for testing

**URL:** <https://www.ruby-forum.com/t/upstream-keepalive-call-for-testing/210170>\
**Category:** NGINX\
**Created:** [August 1, 2011, 6:08pm UTC](https://www.ruby-forum.com/t/upstream-keepalive-call-for-testing/210170 "2011-08-01T18:08:30Z")\
**Posts on this page:** 20\
**Page:** 3

<div class="post-metadata">

**Author:** ![Maxim\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@Maxim\_D](https://www.ruby-forum.com/u/Maxim_D)\
**Post date:** [August 26, 2011, 7:01pm UTC](https://www.ruby-forum.com/t/upstream-keepalive-call-for-testing/210170/41 "2011-08-26T19:01:20Z")

</div>

I think is not your plugins problem. That is nginx core problem.  
I using the original nginx/1.0.0 will continue to coredump.

but the dump position is not same.

gdb `which nginx` /var/www/ngx\_coredump/core  
GNU gdb (Ubuntu/Linaro 7.2-1ubuntu11) 7.2  
Copyright (C) 2010 Free Software Foundation, Inc.  
License GPLv3+: GNU GPL version 3 or later  
[http://gnu.org/licenses/gpl.html](http://gnu.org/licenses/gpl.html)  
This is free software: you are free to change and redistribute it.  
There is NO WARRANTY, to the extent permitted by law. Type “show  
copying”  
and “show warranty” for details.  
This GDB was configured as “x86\_64-linux-gnu”.  
For bug reporting instructions, please see:  
[http://www.gnu.org/software/gdb/bugs/](http://www.gnu.org/software/gdb/bugs/)…  
Reading symbols from /usr/sbin/nginx…done.  
[New Thread 22042]

warning: Can’t read pathname for load map: 输入/输出错误.  
Reading symbols from /lib/x86\_64-linux-gnu/libpcre.so.3…(no debugging  
symbols found)…done.  
Loaded symbols for /lib/x86\_64-linux-gnu/libpcre.so.3  
Reading symbols from /lib/libssl.so.0.9.8…(no debugging symbols  
found)…done.  
Loaded symbols for /lib/libssl.so.0.9.8  
Reading symbols from /lib/libcrypto.so.0.9.8…(no debugging symbols  
found)…done.  
Loaded symbols for /lib/libcrypto.so.0.9.8  
Reading symbols from /lib/x86\_64-linux-gnu/libdl.so.2…(no debugging  
symbols found)…done.  
Loaded symbols for /lib/x86\_64-linux-gnu/libdl.so.2  
Reading symbols from /lib/x86\_64-linux-gnu/libz.so.1…(no debugging  
symbols found)…done.  
Loaded symbols for /lib/x86\_64-linux-gnu/libz.so.1  
Reading symbols from /usr/local/lib/libprofiler.so.0…done.  
Loaded symbols for /usr/local/lib/libprofiler.so.0  
Reading symbols from /lib/x86\_64-linux-gnu/libc.so.6…(no debugging  
symbols found)…done.  
Loaded symbols for /lib/x86\_64-linux-gnu/libc.so.6  
Reading symbols from /lib64/ld-linux-x86-64.so.2…(no debugging symbols  
found)…done.  
Loaded symbols for /lib64/ld-linux-x86-64.so.2  
Reading symbols from /usr/local/lib/libunwind.so.7…(no debugging  
symbols found)…done.  
Loaded symbols for /usr/local/lib/libunwind.so.7  
Reading symbols from /usr/lib/x86\_64-linux-gnu/libstdc++.so.6…(no  
debugging symbols found)…done.  
Loaded symbols for /usr/lib/x86\_64-linux-gnu/libstdc++.so.6  
Reading symbols from /lib/x86\_64-linux-gnu/libm.so.6…(no debugging  
symbols found)…done.  
Loaded symbols for /lib/x86\_64-linux-gnu/libm.so.6  
Reading symbols from /lib/x86\_64-linux-gnu/libgcc\_s.so.1…(no debugging  
symbols found)…done.  
Loaded symbols for /lib/x86\_64-linux-gnu/libgcc\_s.so.1  
Reading symbols from /lib/x86\_64-linux-gnu/libnss\_compat.so.2…(no  
debugging symbols found)…done.  
Loaded symbols for /lib/x86\_64-linux-gnu/libnss\_compat.so.2  
Reading symbols from /lib/x86\_64-linux-gnu/libnsl.so.1…(no debugging  
symbols found)…done.  
Loaded symbols for /lib/x86\_64-linux-gnu/libnsl.so.1  
Reading symbols from /lib/x86\_64-linux-gnu/libnss\_nis.so.2…(no  
debugging symbols found)…done.  
Loaded symbols for /lib/x86\_64-linux-gnu/libnss\_nis.so.2  
Reading symbols from /lib/x86\_64-linux-gnu/libnss\_files.so.2…(no  
debugging symbols found)…done.  
Loaded symbols for /lib/x86\_64-linux-gnu/libnss\_files.so.2  
Reading symbols from /lib/x86\_64-linux-gnu/libnss\_dns.so.2…(no  
debugging symbols found)…done.  
Loaded symbols for /lib/x86\_64-linux-gnu/libnss\_dns.so.2  
Reading symbols from /lib/x86\_64-linux-gnu/libresolv.so.2…(no  
debugging symbols found)…done.  
Loaded symbols for /lib/x86\_64-linux-gnu/libresolv.so.2  
Core was generated by `nginx:'.  
Program terminated with signal 11, Segmentation fault.  
#0 ngx\_http\_upstream\_handler (ev=) at  
src/http/ngx\_http\_upstream.c:893  
893 ctx = c-\>log-\>data;  
(gdb) bt  
#0 ngx\_http\_upstream\_handler (ev=) at  
src/http/ngx\_http\_upstream.c:893  
#1 0x0000000000419979 in ngx\_event\_expire\_timers () at  
src/event/ngx\_event\_timer.c:149  
#2 0x00000000004195ab in ngx\_process\_events\_and\_timers (cycle=0x855b40)  
at src/event/ngx\_event.c:261  
#3 0x000000000041f1de in ngx\_worker\_process\_cycle (cycle=0x855b40,  
data=) at src/os/unix/ngx\_process\_cycle.c:800  
#4 0x000000000041dbdb in ngx\_spawn\_process (cycle=0x855b40,  
proc=0x41f10d \<ngx\_worker\_process\_cycle\>, data=0x0, name=0x46275d  
“worker process”, respawn=-4) at src/os/unix/ngx\_process.c:196  
#5 0x000000000041e876 in ngx\_start\_worker\_processes (cycle=0x855b40,  
n=4, type=-4) at src/os/unix/ngx\_process\_cycle.c:360  
#6 0x000000000041fe86 in ngx\_master\_process\_cycle (cycle=0x855b40) at  
src/os/unix/ngx\_process\_cycle.c:249  
#7 0x0000000000405e91 in main (argc=, argv=) at src/core/nginx.c:405  
(gdb) backtrace full  
#0 ngx\_http\_upstream\_handler (ev=) at  
src/http/ngx\_http\_upstream.c:893  
c = 0x0  
r = 0x1505440  
ctx =   
u = 0x0  
#1 0x0000000000419979 in ngx\_event\_expire\_timers () at  
src/event/ngx\_event\_timer.c:149  
ev = 0x7f6549bcd5a8  
root = 0x7f65ef2ca4e0  
sentinel = 0x687500  
#2 0x00000000004195ab in ngx\_process\_events\_and\_timers (cycle=0x855b40)  
at src/event/ngx\_event.c:261  
flags = 1  
timer =   
delta = 10  
#3 0x000000000041f1de in ngx\_worker\_process\_cycle (cycle=0x855b40,  
data=) at src/os/unix/ngx\_process\_cycle.c:800  
i =   
c =   
#4 0x000000000041dbdb in ngx\_spawn\_process (cycle=0x855b40,  
proc=0x41f10d \<ngx\_worker\_process\_cycle\>, data=0x0, name=0x46275d  
“worker process”, respawn=-4) at src/os/unix/ngx\_process.c:196  
on = 1  
pid = 0  
s = 6  
#5 0x000000000041e876 in ngx\_start\_worker\_processes (cycle=0x855b40,  
n=4, type=-4) at src/os/unix/ngx\_process\_cycle.c:360  
i =   
ch = {command = 1, pid = 22041, slot = 5, fd = 5}  
#6 0x000000000041fe86 in ngx\_master\_process\_cycle (cycle=0x855b40) at  
src/os/unix/ngx\_process\_cycle.c:249  
title =   
p =   
size =   
i =   
n =   
sigio = 0  
set = {\_\_val = {0 \<repeats 16 times\>}}  
itv = {it\_interval = {tv\_sec = 0, tv\_usec = 8170904}, it\_value =  
{tv\_sec = 0, tv\_usec = 0}}  
live = 1  
delay = 0  
ls =   
—Type to continue, or q to quit—  
ccf = 0x8562a0  
#7 0x0000000000405e91 in main (argc=, argv=) at src/core/nginx.c:405  
i =   
log = 0x685320  
cycle = 0x7cad80  
init\_cycle = {conf\_ctx = 0x0, pool = 0x7ca240, log = 0x685320,  
new\_log = {log\_level = 0, file = 0x0, connection = 0, handler = 0, data  
= 0x0, action = 0x0}, files = 0x0,  
free\_connections = 0x0, free\_connection\_n = 0,  
reusable\_connections\_queue = {prev = 0x0, next = 0x0}, listening = {elts  
= 0x0, nelts = 0, size = 0, nalloc = 0, pool = 0x0}, pathes = {  
elts = 0x0, nelts = 0, size = 0, nalloc = 0, pool = 0x0},  
open\_files = {last = 0x0, part = {elts = 0x0, nelts = 0, next = 0x0},  
size = 0, nalloc = 0, pool = 0x0}, shared\_memory = {  
last = 0x0, part = {elts = 0x0, nelts = 0, next = 0x0}, size  
= 0, nalloc = 0, pool = 0x0}, connection\_n = 0, files\_n = 0, connections  
= 0x0, read\_events = 0x0, write\_events = 0x0,  
old\_cycle = 0x0, conf\_file = {len = 21, data = 0x45ef76  
“/etc/nginx/nginx.conf”}, conf\_param = {len = 0, data = 0x0},  
conf\_prefix = {len = 11, data = 0x45ef76 “/etc/nginx/nginx.conf”},  
prefix = {len = 17, data = 0x45ef64 “/usr/local/nginx/”},  
lock\_file = {len = 0, data = 0x0}, hostname = {len = 0, data = 0x0}}  
ccf =

Posted at Nginx Forum:

> **[Re: upstream keepalive - call for testing](https://forum.nginx.org/read.php?2,213207,214355#msg-214355)**
>
> Hello! JFYI: Last week I posted patch to nginx-devel@ which adds keepalive support to various backends (as with upstream keepalive module), including fastcgi and http backends (this in turn means nginx now able to talk HTTP/1.1 to backends, in...

---

<div class="post-metadata">

**Author:** ![Maxim\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@Maxim\_D](https://www.ruby-forum.com/u/Maxim_D)\
**Post date:** [August 26, 2011, 6:29pm UTC](https://www.ruby-forum.com/t/upstream-keepalive-call-for-testing/210170/42 "2011-08-26T18:29:16Z")

</div>

I tried to disabled my script, but still cause a coredump.

here is my nginx.conf

user www-data;  
worker\_processes 4;

error\_log /var/log/nginx/error.log ;  
pid /var/run/nginx.pid;

worker\_rlimit\_core 8000M;  
working\_directory /var/www/ngx\_coredump/;  
debug\_points abort;

worker\_rlimit\_nofile 131072;  
events {  
worker\_connections 16384;  
use epoll;  
# multi\_accept on;  
}

http {  
log\_format logger  
‘$http\_host||$remote\_addr||$msec||$status||$request\_length||$bytes\_sent||“$request”||“$http\_referer”||“$http\_user\_agent”||$upstream\_cache\_status||$upstream\_status’;

```
include /etc/nginx/mime.types;

access_log /var/log/nginx/access.log;

sendfile on;

```

# double size of page (get : getconf PAGESIZE)

client\_header\_buffer\_size 64k;  
#open\_file\_cache max=150000 inactive=20s;  
#open\_file\_cache\_valid 2s;  
#open\_file\_cache\_min\_uses 1;  
large\_client\_header\_buffers 4 256k;

client\_max\_body\_size 100m;  
client\_body\_buffer\_size 128k;  
proxy\_temp\_path /dev/shm/proxy\_temp;  
proxy\_connect\_timeout 5s;  
proxy\_send\_timeout 10;  
proxy\_read\_timeout 10;  
proxy\_buffer\_size 4k;  
proxy\_buffers 16 32k;  
proxy\_busy\_buffers\_size 64k;  
proxy\_temp\_file\_write\_size 64k;  
proxy\_ignore\_client\_abort on;

fastcgi\_connect\_timeout 300;  
fastcgi\_send\_timeout 300;  
fastcgi\_read\_timeout 300;  
#first response buffer size  
fastcgi\_buffer\_size 256K;  
#continue response buffer size  
fastcgi\_buffers 32 256K;  
#busy buffer  
fastcgi\_busy\_buffers\_size 2048k;  
fastcgi\_temp\_file\_write\_size 2048k;

index index.html index.htm index.php;

#tcp\_nopush: Sends the HTTP response headers in one packet.  
tcp\_nopush on;

```
#keepalive_timeout 0;
keepalive_timeout 5;

```

# make it small for hard load server

#tcp\_nodelay: Disables the Nagle buffering algorithm. Well, that  
cleared that one up!

# General web use does require a response from the client , tune it to

off  
tcp\_nodelay off;

server\_tokens off;

```
gzip off;
gzip_disable msie6;

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;

```

}

=======================================================================================  
sites-enabled/site.conf

proxy\_cache\_path /var/www/cdn\_cache levels=1:2  
keys\_zone=cache\_proxy:2048m max\_size=4096m;

upstream backend {  
server 10.0.0.1 weight=3 fail\_timeout=2s;  
keepalive 30;  
}  
limit\_req\_zone $binary\_remote\_addr zone=limit\_cdn:32m rate=10r/s;  
server {  
listen 80;  
server\_name 10.0.0.2;

limit\_req zone=limit\_cdn burst=10;

add\_header X-Via “$hostname”;  
add\_header X-Debug “$server\_addr”;

root /var/www/cdn;  
access\_log /dev/shm/logger logger;

error\_log /var/log/nginx/ct.error;  
gzip on;  
gzip\_buffers 4 16k;  
gzip\_min\_length 1k;  
gzip\_http\_version 1.1;  
gzip\_comp\_level 9;  
gzip\_types text/plain application/x-javascript text/css  
application/xml;  
gzip\_vary on;  
gzip\_proxied any;

location ~ ^/purge(/.\*) {  
proxy\_cache\_purge cache\_proxy $1$is\_args$args;  
}  
location ~ .(swf)$  
{  
proxy\_cache cache\_proxy;  
proxy\_cache\_valid 200 304 1h;  
proxy\_cache\_key $uri;  
add\_header X-Cache “$upstream\_cache\_status from $hostname”;  
expires 600s;  
proxy\_ssl\_session\_reuse on;  
proxy\_set\_header X-Real-IP $remote\_addr;  
proxy\_set\_header Connection “keep-alive”;

```
proxy_pass http://backend;

```

}  
location ~ ^/images/(.+)  
{  
proxy\_cache cache\_proxy;  
proxy\_cache\_valid 200 304 8h;  
proxy\_cache\_key $uri;  
add\_header X-Cache “$upstream\_cache\_status from $hostname”;  
expires 1h;  
proxy\_ssl\_session\_reuse on;  
proxy\_set\_header X-Real-IP $remote\_addr;  
proxy\_set\_header Connection “keep-alive”;

```
proxy_pass http://backend;

```

}  
location ~ ^/sitemap/(.+)  
{  
proxy\_cache cache\_proxy;  
proxy\_cache\_valid 200 304 8h;  
proxy\_cache\_key $uri;  
add\_header X-Cache “$upstream\_cache\_status from $hostname”;  
expires 8h;  
proxy\_ssl\_session\_reuse on;  
proxy\_set\_header X-Real-IP $remote\_addr;  
proxy\_set\_header Connection “keep-alive”;

```
proxy_pass http://backend;

```

}  
location ~ ^/search  
{  
proxy\_cache cache\_proxy;  
proxy\_cache\_valid 200 304 600s;  
proxy\_cache\_key $uri$is\_args$args;  
add\_header X-Cache “$upstream\_cache\_status from $hostname”;  
expires 600s;  
proxy\_ssl\_session\_reuse on;  
proxy\_set\_header X-Real-IP $remote\_addr;  
proxy\_set\_header Connection “keep-alive”;

```
proxy_pass http://backend;

```

}  
location / {

```
proxy_set_header X-Real-IP $remote_addr;
add_header X-Cache "MISS from $hostname";
proxy_set_header Connection "keep-alive";
proxy_buffering off; #Direct send to client
proxy_ssl_session_reuse on;
proxy_pass http://backend;

```

}  
rewrite “^/$” /index.htm;  
}

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,213207,214354#msg-214354](http://forum.nginx.org/read.php?2,213207,214354#msg-214354)

---

<div class="post-metadata">

**Author:** ![Maxim\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@Maxim\_D](https://www.ruby-forum.com/u/Maxim_D)\
**Post date:** [August 26, 2011, 7:51pm UTC](https://www.ruby-forum.com/t/upstream-keepalive-call-for-testing/210170/43 "2011-08-26T19:51:58Z")

</div>

I am sorry, I just noticed that ngin 1.0.5 has fixed the cache cause  
segmentation failure bug.  
And I was test it at 1.0.0.

When I remove the following config, the server hasn’t dead again now.

> > proxy\_ssl\_session\_reuse on;

I will continued to keep checking.

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,213207,214356#msg-214356](http://forum.nginx.org/read.php?2,213207,214356#msg-214356)

---

<div class="post-metadata">

**Author:** ![Maxim\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@Maxim\_D](https://www.ruby-forum.com/u/Maxim_D)\
**Post date:** [August 26, 2011, 9:01pm UTC](https://www.ruby-forum.com/t/upstream-keepalive-call-for-testing/210170/44 "2011-08-26T21:01:08Z")

</div>

I have patch and it won’t dead again, Now run 50 minutes, and handled  
330000 request without problem.

the problem is not related to proxy\_ssl\_session\_reuse

## Maxim D. Wrote:

> > this problem.  
> > b/src/event/ngx\_event\_pipe.c  
> > if ((p-\>upstream\_eof || p-\>upstream\_error) &&  
> > nginx mailing list  
> > [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> > [mailman.nginx.org archive](http://mailman.nginx.org/mailman/listinfo/nginx)

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,213207,214359#msg-214359](http://forum.nginx.org/read.php?2,213207,214359#msg-214359)

---

<div class="post-metadata">

**Author:** ![Maxim\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@Maxim\_D](https://www.ruby-forum.com/u/Maxim_D)\
**Post date:** [August 26, 2011, 8:07pm UTC](https://www.ruby-forum.com/t/upstream-keepalive-call-for-testing/210170/45 "2011-08-26T20:07:25Z")

</div>

Hello!

On Fri, Aug 26, 2011 at 12:17:01PM -0400, magicbear wrote:

> It get the same result, I think may be cause by my upload script? I will  
> try to disable it to get result.  
> In another more high load server(without patch) using this script is no  
> this problem.

You mean you log rotation script you’ve posted earlier? It  
shouldn’t cause problems, if it does - this means there is a bug  
somewhere. And I think I’ve found the one you are seeing, please  
try the following patch:

diff --git a/src/event/ngx\_event\_pipe.c b/src/event/ngx\_event\_pipe.c  
— a/src/event/ngx\_event\_pipe.c  
+++ b/src/event/ngx\_event\_pipe.c  
@@ -414,6 +414,7 @@ ngx\_event\_pipe\_read\_upstream(ngx\_event\_p

```
 if (p->length == 0) {
     p->upstream_done = 1;

```

- 

```
   p->read = 1;

```

}

if ((p-\>upstream\_eof || p-\>upstream\_error) && p-\>free\_raw\_bufs) {

You may also grab one from here:

[http://mdounin.ru/files/patch-nginx-keepalive-cache.txt](http://mdounin.ru/files/patch-nginx-keepalive-cache.txt)

Maxim D.

---

<div class="post-metadata">

**Author:** ![Maxim\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@Maxim\_D](https://www.ruby-forum.com/u/Maxim_D)\
**Post date:** [August 28, 2011, 7:11pm UTC](https://www.ruby-forum.com/t/upstream-keepalive-call-for-testing/210170/46 "2011-08-28T19:11:12Z")

</div>

addition information:  
the server may dead when processed about 20 million requests. Not very  
high frequencies to dead.

2011/08/27 13:31:21 [alert] 30433#0: worker process 1944 exited on  
signal 11 (core dumped)

2011/08/28 14:40:35 [alert] 30433#0: worker process 14510 exited on  
signal 11 (core dumped)

Posted at Nginx Forum:

> **[Re: upstream keepalive - call for testing](https://forum.nginx.org/read.php?2,213207,214395#msg-214395)**
>
> Hello! JFYI: Last week I posted patch to nginx-devel@ which adds keepalive support to various backends (as with upstream keepalive module), including fastcgi and http backends (this in turn means nginx now able to talk HTTP/1.1 to backends, in...

---

<div class="post-metadata">

**Author:** ![Maxim\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@Maxim\_D](https://www.ruby-forum.com/u/Maxim_D)\
**Post date:** [August 29, 2011, 3:48am UTC](https://www.ruby-forum.com/t/upstream-keepalive-call-for-testing/210170/47 "2011-08-29T03:48:03Z")

</div>

Hello!

On Sun, Aug 28, 2011 at 01:07:25PM -0400, magicbear wrote:

> Hello, tested for 2 days, the segmentation failure frequence is  
> decreased, but sometime still will dead.
> 
> Here is the coredump information. It seems appear too at official  
> without patch version.

[…]

> (gdb) bt  
> #0 0x000000000045bd99 in ngx\_http\_upstream\_handler (ev=0x7f99438901e8)  
> at src/http/ngx\_http\_upstream.c:921  
> #1 0x0000000000427839 in ngx\_event\_expire\_timers () at  
> src/event/ngx\_event\_timer.c:149

Could you please test if the attached patch fixes things for you?

You may also grab it from here:  
[http://mdounin.ru/files/patch-nginx-ssl-shutdown.txt](http://mdounin.ru/files/patch-nginx-ssl-shutdown.txt)

Maxim D.

---

<div class="post-metadata">

**Author:** ![Maxim\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@Maxim\_D](https://www.ruby-forum.com/u/Maxim_D)\
**Post date:** [August 28, 2011, 7:08pm UTC](https://www.ruby-forum.com/t/upstream-keepalive-call-for-testing/210170/48 "2011-08-28T19:08:06Z")

</div>

Hello, tested for 2 days, the segmentation failure frequence is  
decreased, but sometime still will dead.

Here is the coredump information. It seems appear too at official  
without patch version.

GNU gdb (Ubuntu/Linaro 7.2-1ubuntu11) 7.2  
Copyright (C) 2010 Free Software Foundation, Inc.  
License GPLv3+: GNU GPL version 3 or later  
[http://gnu.org/licenses/gpl.html](http://gnu.org/licenses/gpl.html)  
This is free software: you are free to change and redistribute it.  
There is NO WARRANTY, to the extent permitted by law. Type “show  
copying”  
and “show warranty” for details.  
This GDB was configured as “x86\_64-linux-gnu”.  
For bug reporting instructions, please see:  
[http://www.gnu.org/software/gdb/bugs/](http://www.gnu.org/software/gdb/bugs/)…  
Reading symbols from /usr/sbin/nginx…done.  
[New Thread 14510]

warning: Can’t read pathname for load map: 输入/输出错误.  
Reading symbols from /lib/x86\_64-linux-gnu/libpthread.so.0…(no  
debugging symbols found)…done.  
Loaded symbols for /lib/x86\_64-linux-gnu/libpthread.so.0  
Reading symbols from /lib/x86\_64-linux-gnu/libpcre.so.3…(no debugging  
symbols found)…done.  
Loaded symbols for /lib/x86\_64-linux-gnu/libpcre.so.3  
Reading symbols from /lib/libssl.so.0.9.8…(no debugging symbols  
found)…done.  
Loaded symbols for /lib/libssl.so.0.9.8  
Reading symbols from /lib/libcrypto.so.0.9.8…(no debugging symbols  
found)…done.  
Loaded symbols for /lib/libcrypto.so.0.9.8  
Reading symbols from /lib/x86\_64-linux-gnu/libdl.so.2…(no debugging  
symbols found)…done.  
Loaded symbols for /lib/x86\_64-linux-gnu/libdl.so.2  
Reading symbols from /lib/x86\_64-linux-gnu/libz.so.1…(no debugging  
symbols found)…done.  
Loaded symbols for /lib/x86\_64-linux-gnu/libz.so.1  
Reading symbols from /usr/local/lib/libprofiler.so.0…done.  
Loaded symbols for /usr/local/lib/libprofiler.so.0  
Reading symbols from /lib/x86\_64-linux-gnu/libc.so.6…(no debugging  
symbols found)…done.  
Loaded symbols for /lib/x86\_64-linux-gnu/libc.so.6  
Reading symbols from /lib64/ld-linux-x86-64.so.2…(no debugging symbols  
found)…done.  
Loaded symbols for /lib64/ld-linux-x86-64.so.2  
Reading symbols from /usr/local/lib/libunwind.so.7…(no debugging  
symbols found)…done.  
Loaded symbols for /usr/local/lib/libunwind.so.7  
Reading symbols from /usr/lib/x86\_64-linux-gnu/libstdc++.so.6…(no  
debugging symbols found)…done.  
Loaded symbols for /usr/lib/x86\_64-linux-gnu/libstdc++.so.6  
Reading symbols from /lib/x86\_64-linux-gnu/libm.so.6…(no debugging  
symbols found)…done.  
Loaded symbols for /lib/x86\_64-linux-gnu/libm.so.6  
Reading symbols from /lib/x86\_64-linux-gnu/libgcc\_s.so.1…(no debugging  
symbols found)…done.  
Loaded symbols for /lib/x86\_64-linux-gnu/libgcc\_s.so.1  
Reading symbols from /lib/x86\_64-linux-gnu/libnss\_compat.so.2…(no  
debugging symbols found)…done.  
Loaded symbols for /lib/x86\_64-linux-gnu/libnss\_compat.so.2  
Reading symbols from /lib/x86\_64-linux-gnu/libnsl.so.1…(no debugging  
symbols found)…done.  
Loaded symbols for /lib/x86\_64-linux-gnu/libnsl.so.1  
Reading symbols from /lib/x86\_64-linux-gnu/libnss\_nis.so.2…(no  
debugging symbols found)…done.  
Loaded symbols for /lib/x86\_64-linux-gnu/libnss\_nis.so.2  
Reading symbols from /lib/x86\_64-linux-gnu/libnss\_files.so.2…(no  
debugging symbols found)…done.  
Loaded symbols for /lib/x86\_64-linux-gnu/libnss\_files.so.2  
Reading symbols from /lib/x86\_64-linux-gnu/libnss\_dns.so.2…(no  
debugging symbols found)…done.  
Loaded symbols for /lib/x86\_64-linux-gnu/libnss\_dns.so.2  
Reading symbols from /lib/x86\_64-linux-gnu/libresolv.so.2…(no  
debugging symbols found)…done.  
Loaded symbols for /lib/x86\_64-linux-gnu/libresolv.so.2  
Core was generated by `nginx:'.  
Program terminated with signal 11, Segmentation fault.  
#0 0x000000000045bd99 in ngx\_http\_upstream\_handler (ev=0x7f99438901e8)  
at src/http/ngx\_http\_upstream.c:921  
921 u-\>write\_event\_handler(r, u);  
(gdb) bt  
#0 0x000000000045bd99 in ngx\_http\_upstream\_handler (ev=0x7f99438901e8)  
at src/http/ngx\_http\_upstream.c:921  
#1 0x0000000000427839 in ngx\_event\_expire\_timers () at  
src/event/ngx\_event\_timer.c:149  
#2 0x0000000000425a04 in ngx\_process\_events\_and\_timers  
(cycle=0x12ba140) at src/event/ngx\_event.c:261  
#3 0x000000000043068c in ngx\_worker\_process\_cycle (cycle=0x12ba140,  
data=0x0) at src/os/unix/ngx\_process\_cycle.c:800  
#4 0x000000000042d993 in ngx\_spawn\_process (cycle=0x12ba140,  
proc=0x430509 \<ngx\_worker\_process\_cycle\>, data=0x0, name=0x49c6a0  
“worker process”, respawn=8) at src/os/unix/ngx\_process.c:196  
#5 0x0000000000430132 in ngx\_reap\_children (cycle=0x12ba140) at  
src/os/unix/ngx\_process\_cycle.c:617  
#6 0x000000000042f1da in ngx\_master\_process\_cycle (cycle=0x12ba140) at  
src/os/unix/ngx\_process\_cycle.c:180  
#7 0x00000000004054b9 in main (argc=1, argv=0x7fff33e74ef8) at  
src/core/nginx.c:405  
(gdb) backtrace full  
#0 0x000000000045bd99 in ngx\_http\_upstream\_handler (ev=0x7f99438901e8)  
at src/http/ngx\_http\_upstream.c:921  
c = 0x7f9943a4f010  
r = 0x11aee20  
ctx = 0x11b01e0  
u = 0x0  
#1 0x0000000000427839 in ngx\_event\_expire\_timers () at  
src/event/ngx\_event\_timer.c:149  
ev = 0x7f99438901e8  
node = 0x7f9943890210  
root = 0x7f99e91baf08  
sentinel = 0x6c2f60  
#2 0x0000000000425a04 in ngx\_process\_events\_and\_timers  
(cycle=0x12ba140) at src/event/ngx\_event.c:261  
flags = 1  
timer = 5  
delta = 5  
#3 0x000000000043068c in ngx\_worker\_process\_cycle (cycle=0x12ba140,  
data=0x0) at src/os/unix/ngx\_process\_cycle.c:800  
i = 0  
c = 0x7fff33e74ef0  
#4 0x000000000042d993 in ngx\_spawn\_process (cycle=0x12ba140,  
proc=0x430509 \<ngx\_worker\_process\_cycle\>, data=0x0, name=0x49c6a0  
“worker process”, respawn=8) at src/os/unix/ngx\_process.c:196  
on = 1  
pid = 0  
s = 8  
#5 0x0000000000430132 in ngx\_reap\_children (cycle=0x12ba140) at  
src/os/unix/ngx\_process\_cycle.c:617  
i = 8  
n = 13  
live = 1  
ch = {command = 2, pid = 1944, slot = 8, fd = -1}  
ccf = 0x6c26be  
#6 0x000000000042f1da in ngx\_master\_process\_cycle (cycle=0x12ba140) at  
src/os/unix/ngx\_process\_cycle.c:180  
title = 0x1282de6 “”  
p = 0x1282dfa “”  
size = 21  
i = 1  
n = 11215018668083  
sigio = 0  
set = {\_\_val = {0 \<repeats 16 times\>}}  
itv = {it\_interval = {tv\_sec = 0, tv\_usec = 0}, it\_value =  
{tv\_sec = 0, tv\_usec = 6}}  
live = 1  
delay = 0  
ls = 0x0  
ccf = 0x12ba8a0  
#7 0x00000000004054b9 in main (argc=1, argv=0x7fff33e74ef8) at  
src/core/nginx.c:405  
i = 47  
log = 0x6c0d60  
cycle = 0x11a1d90  
init\_cycle = {conf\_ctx = 0x0, pool = 0x11a1240, log = 0x6c0d60,  
new\_log = {log\_level = 0, file = 0x0, connection = 0, handler = 0, data  
= 0x0, action = 0x0}, files = 0x0, free\_connections = 0x0,  
free\_connection\_n = 0,  
—Type to continue, or q to quit—  
reusable\_connections\_queue = {prev = 0x0, next = 0x0},  
listening = {elts = 0x0, nelts = 0, size = 0, nalloc = 0, pool = 0x0},  
pathes = {elts = 0x0, nelts = 0, size = 0, nalloc = 0, pool = 0x0},  
open\_files = {  
last = 0x0, part = {elts = 0x0, nelts = 0, next = 0x0}, size  
= 0, nalloc = 0, pool = 0x0}, shared\_memory = {last = 0x0, part = {elts  
= 0x0, nelts = 0, next = 0x0}, size = 0, nalloc = 0, pool = 0x0},  
connection\_n = 0, files\_n = 0, connections = 0x0, read\_events  
= 0x0, write\_events = 0x0, old\_cycle = 0x0, conf\_file = {len = 21, data  
= 0x49977e “/etc/nginx/nginx.conf”}, conf\_param = {len = 0, data =  
0x0},  
conf\_prefix = {len = 11, data = 0x49977e  
“/etc/nginx/nginx.conf”}, prefix = {len = 17, data = 0x49976c  
“/usr/local/nginx/”}, lock\_file = {len = 0, data = 0x0}, hostname = {len  
= 0, data = 0x0}}  
ccf = 0x11a2c90

Posted at Nginx Forum:

> **[Re: upstream keepalive - call for testing](https://forum.nginx.org/read.php?2,213207,214394#msg-214394)**
>
> Hello! JFYI: Last week I posted patch to nginx-devel@ which adds keepalive support to various backends (as with upstream keepalive module), including fastcgi and http backends (this in turn means nginx now able to talk HTTP/1.1 to backends, in...

---

<div class="post-metadata">

**Author:** ![Maxim\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@Maxim\_D](https://www.ruby-forum.com/u/Maxim_D)\
**Post date:** [August 31, 2011, 10:05pm UTC](https://www.ruby-forum.com/t/upstream-keepalive-call-for-testing/210170/49 "2011-08-31T22:05:45Z")

</div>

OK, It works for 3 days with 40 million request haven’t coredump.  
Thanks.

## Maxim D. Wrote:

> appear too at official
> 
> > src/event/ngx\_event\_timer.c:149
> 
> # User Maxim D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
> 
> @@ -1205,6 +1205,7 @@  
> SSL\_get\_shutdown(c-\>ssl-\>connection);
> 
> - 
> 
> ```
> }
> 
> ```
> 
> }
> 
> SSL\_set\_shutdown(c-\>ssl-\>connection, mode);
> 
> * * *
> 
> nginx mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [mailman.nginx.org archive](http://mailman.nginx.org/mailman/listinfo/nginx)

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,213207,214602#msg-214602](http://forum.nginx.org/read.php?2,213207,214602#msg-214602)

---

<div class="post-metadata">

**Author:** ![Maxim\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@Maxim\_D](https://www.ruby-forum.com/u/Maxim_D)\
**Post date:** [September 1, 2011, 3:38pm UTC](https://www.ruby-forum.com/t/upstream-keepalive-call-for-testing/210170/50 "2011-09-01T15:38:28Z")

</div>

I use at 2x100Mbps server (40% and 10% utilisation), when stable  
enought, then I will continue to test at 1000Mbps server.

## splitice Wrote:

> haven’t coredump.
> 
> > > > (gdb) bt
> 
> 804454a04e22d32c064a3af8e7b24326c7fc2d63
> 
> > > This happens if there are some unsent alerts.  
> > > — a/src/event/ngx\_event\_openssl.c  
> > > } else {  
> > > +
> > 
> > [mailman.nginx.org archive](http://mailman.nginx.org/mailman/listinfo/nginx)
> 
> * * *
> 
> nginx mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [mailman.nginx.org archive](http://mailman.nginx.org/mailman/listinfo/nginx)

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,213207,214622#msg-214622](http://forum.nginx.org/read.php?2,213207,214622#msg-214622)

---

<div class="post-metadata">

**Author:** ![Maxim\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@Maxim\_D](https://www.ruby-forum.com/u/Maxim_D)\
**Post date:** [September 1, 2011, 3:58am UTC](https://www.ruby-forum.com/t/upstream-keepalive-call-for-testing/210170/51 "2011-09-01T03:58:07Z")

</div>

I havent had any crashes on 3x10mbit servers (90% utilisation) or  
2x100mbit  
servers (20% utilisation).

Seems very stable.

---

<div class="post-metadata">

**Author:** ![Maxim\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@Maxim\_D](https://www.ruby-forum.com/u/Maxim_D)\
**Post date:** [September 4, 2011, 7:34pm UTC](https://www.ruby-forum.com/t/upstream-keepalive-call-for-testing/210170/52 "2011-09-04T19:34:51Z")

</div>

Hello , when run for 5 days, today have 2 segment failure.

2011/09/04 12:00:47 [alert] 32147#0: worker process 8496 exited on  
signal 11 (core dumped)  
2011/09/04 12:17:32 [alert] 8497#0: ignore long locked inactive cache  
entry 57c7c6c612a651727b880a1c9a2c7d2d, count:1  
2011/09/04 12:21:31 [alert] 32147#0: worker process 19185 exited on  
signal 11 (core dumped)

Core was generated by `nginx:'.  
Program terminated with signal 11, Segmentation fault.  
#0 ngx\_http\_upstream\_handler (ev=0x7fc45735f8a8) at  
src/http/ngx\_http\_upstream.c:915  
915 ctx-\>current\_request = r;  
(gdb) bt  
#0 ngx\_http\_upstream\_handler (ev=0x7fc45735f8a8) at  
src/http/ngx\_http\_upstream.c:915  
#1 0x0000000000419e95 in ngx\_event\_expire\_timers () at  
src/event/ngx\_event\_timer.c:149  
#2 0x0000000000419ac7 in ngx\_process\_events\_and\_timers  
(cycle=0x21f1990) at src/event/ngx\_event.c:261  
#3 0x000000000041f76e in ngx\_worker\_process\_cycle (cycle=0x21f1990,  
data=) at src/os/unix/ngx\_process\_cycle.c:800  
#4 0x000000000041e16b in ngx\_spawn\_process (cycle=0x21f1990,  
proc=0x41f69d \<ngx\_worker\_process\_cycle\>, data=0x0, name=0x463f3d  
“worker process”, respawn=7) at src/os/unix/ngx\_process.c:196  
#5 0x000000000042008d in ngx\_reap\_children (cycle=0x21f1990) at  
src/os/unix/ngx\_process\_cycle.c:617  
#6 ngx\_master\_process\_cycle (cycle=0x21f1990) at  
src/os/unix/ngx\_process\_cycle.c:180  
#7 0x0000000000406061 in main (argc=, argv=) at src/core/nginx.c:405

(gdb) bt full  
#0 ngx\_http\_upstream\_handler (ev=0x7fc45735f8a8) at  
src/http/ngx\_http\_upstream.c:915  
c = 0x23b4160  
r = 0x22a2780  
ctx = \<error reading variable ctx (Cannot access memory at  
address 0x20)\>  
u = 0x0  
#1 0x0000000000419e95 in ngx\_event\_expire\_timers () at  
src/event/ngx\_event\_timer.c:149  
ev = 0x7fc45735f8a8  
root = 0x7fc4574ffa30  
sentinel = 0x689560  
#2 0x0000000000419ac7 in ngx\_process\_events\_and\_timers  
(cycle=0x21f1990) at src/event/ngx\_event.c:261  
flags = 1  
timer =   
delta = 21  
#3 0x000000000041f76e in ngx\_worker\_process\_cycle (cycle=0x21f1990,  
data=) at src/os/unix/ngx\_process\_cycle.c:800  
i =   
c =   
#4 0x000000000041e16b in ngx\_spawn\_process (cycle=0x21f1990,  
proc=0x41f69d \<ngx\_worker\_process\_cycle\>, data=0x0, name=0x463f3d  
“worker process”, respawn=7) at src/os/unix/ngx\_process.c:196  
on = 1  
pid = 0  
s = 7  
#5 0x000000000042008d in ngx\_reap\_children (cycle=0x21f1990) at  
src/os/unix/ngx\_process\_cycle.c:617  
i =   
live =   
n =   
ch = {command = 2, pid = 8496, slot = 7, fd = -1}  
ccf =   
#6 ngx\_master\_process\_cycle (cycle=0x21f1990) at  
src/os/unix/ngx\_process\_cycle.c:180  
title =   
p =   
size =   
i =   
n =   
sigio = 0  
set = {\_\_val = {0 \<repeats 16 times\>}}  
itv = {it\_interval = {tv\_sec = 0, tv\_usec = 35114632}, it\_value  
= {tv\_sec = 0, tv\_usec = 32146}}  
live =   
delay = 0  
ls =   
ccf = 0x21f2188  
#7 0x0000000000406061 in main (argc=, argv=) at src/core/nginx.c:405  
i =   
log = 0x687380  
cycle = 0x217ce70  
init\_cycle = {conf\_ctx = 0x0, pool = 0x217c240, log = 0x687380,  
new\_log = {log\_level = 0, file = 0x0, connection = 0, handler = 0, data  
= 0x0, action = 0x0}, files = 0x0,  
free\_connections = 0x0, free\_connection\_n = 0,  
reusable\_connections\_queue = {prev = 0x0, next = 0x0}, listening = {elts  
= 0x0, nelts = 0, size = 0, nalloc = 0, pool = 0x0},  
pathes = {elts = 0x0, nelts = 0, size = 0, nalloc = 0, pool =  
0x0}, open\_files = {last = 0x0, part = {elts = 0x0, nelts = 0, next =  
0x0}, size = 0, nalloc = 0, pool = 0x0},  
shared\_memory = {last = 0x0, part = {elts = 0x0, nelts = 0,  
next = 0x0}, size = 0, nalloc = 0, pool = 0x0}, connection\_n = 0,  
files\_n = 0, connections = 0x0, read\_events = 0x0,  
write\_events = 0x0, old\_cycle = 0x0, conf\_file = {len = 21,  
data = 0x4606b6 “/etc/nginx/nginx.conf”}, conf\_param = {len = 0, data =  
0x0}, conf\_prefix = {len = 11,  
data = 0x4606b6 “/etc/nginx/nginx.conf”}, prefix = {len =  
17, data = 0x4606a4 “/usr/local/nginx/”}, lock\_file = {len = 0, data =  
0x0}, hostname = {len = 0, data = 0x0}}  
—Type to continue, or q to quit—  
ccf =

Posted at Nginx Forum:

> **[Re: upstream keepalive - call for testing](https://forum.nginx.org/read.php?2,213207,214739#msg-214739)**
>
> Hello! JFYI: Last week I posted patch to nginx-devel@ which adds keepalive support to various backends (as with upstream keepalive module), including fastcgi and http backends (this in turn means nginx now able to talk HTTP/1.1 to backends, in...

---

<div class="post-metadata">

**Author:** ![Maxim\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@Maxim\_D](https://www.ruby-forum.com/u/Maxim_D)\
**Post date:** [September 4, 2011, 8:22pm UTC](https://www.ruby-forum.com/t/upstream-keepalive-call-for-testing/210170/53 "2011-09-04T20:22:27Z")

</div>

Hello!

On Sun, Sep 04, 2011 at 01:33:59PM -0400, magicbear wrote:

> src/event/ngx\_event\_timer.c:149  
> #2 0x0000000000419ac7 in ngx\_process\_events\_and\_timers  
> (cycle=0x21f1990) at src/event/ngx\_event.c:261

Hm, this looks identical to one you’ve reported previously. Do  
you have patch from

> **[upstream keepalive - call for testing](http://mailman.nginx.org/pipermail/nginx/2011-August/028809.html)**

applied?

> optimized out\>) at src/core/nginx.c:405
> 
> (gdb) bt full  
> #0 ngx\_http\_upstream\_handler (ev=0x7fc45735f8a8) at  
> src/http/ngx\_http\_upstream.c:915  
> c = 0x23b4160  
> r = 0x22a2780  
> ctx = \<error reading variable ctx (Cannot access memory at  
> address 0x20)\>  
> u = 0x0

Could you please show results of the following gdb commands:

fr 0  
p \*ev  
p \*((ngx\_connection\_t \*) ev-\>data)

Maxim D.

---

<div class="post-metadata">

**Author:** ![Maxim\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@Maxim\_D](https://www.ruby-forum.com/u/Maxim_D)\
**Post date:** [September 5, 2011, 9:08am UTC](https://www.ruby-forum.com/t/upstream-keepalive-call-for-testing/210170/54 "2011-09-05T09:08:51Z")

</div>

Hello!

On Mon, Sep 05, 2011 at 02:31:54AM +0800, MagicBear wrote:

> 0,  
> sent = 0, log = 0x21f1770, pool = 0x237ff70, sockaddr = 0x0, socklen = 0,  
> addr\_text = {len = 0, data = 0x0}, ssl = 0x0, local\_sockaddr = 0x0,  
> buffer = 0x0, queue = {prev = 0x0, next = 0x0}, number = 63713716,  
> requests = 0, buffered = 0, log\_error = 1, single\_connection = 0,  
> unexpected\_eof = 0, timedout = 0, error = 0, destroyed = 0, idle = 0,  
> reusable = 0, close = 0, sendfile = 1, sndlowat = 0, tcp\_nodelay = 0,  
> tcp\_nopush = 0}

Could you please also show the following (in the same frame, i.e.  
after “fr 0”):

p ngx\_cycle-\>log  
p \*r  
p \*r-\>connection

Maxim D.

> > > 2011/09/04 12:00:47 [alert] 32147#0: worker process 8496 exited on  
> > > Program terminated with signal 11, Segmentation fault.
> > 
> > > proc=0x41f69d \<ngx\_worker\_process\_cycle\>, data=0x0, name=0x463f3d  
> > > #0 ngx\_http\_upstream\_handler (ev=0x7fc45735f8a8) at  
> > > p \*ev  
> > > p \*((ngx\_connection\_t \*) ev-\>data)
> > 
> > Maxim D.
> > 
> > * * *
> > 
> > nginx mailing list  
> > [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> > [mailman.nginx.org archive](http://mailman.nginx.org/mailman/listinfo/nginx)

---

<div class="post-metadata">

**Author:** ![Maxim\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@Maxim\_D](https://www.ruby-forum.com/u/Maxim_D)\
**Post date:** [September 4, 2011, 8:32pm UTC](https://www.ruby-forum.com/t/upstream-keepalive-call-for-testing/210170/55 "2011-09-04T20:32:18Z")

</div>

# (gdb) fr 0 #0 ngx\_http\_upstream\_handler (ev=0x7fc45735f8a8) at src/http/ngx\_http\_upstream.c:915 915 ctx-\>current\_request = r; (gdb) p \*ev $1 = {data = 0x7fc4576aa750, write = 1, accept = 0, instance = 1, active

# 1, disabled = 0, ready = 1, oneshot = 0, complete = 0, eof = 0, error = 0, timedout = 1, timer\_set = 0, delayed = 0, read\_discarded = 0, unexpected\_eof = 0, deferred\_accept = 0, pending\_eof = 0, posted\_ready

0,  
available = 0, handler = 0x43bf9c \<ngx\_http\_upstream\_handler\>,  
index = 3503345872, log = 0x21f1770, timer = {key = 0, left = 0x0,  
right = 0x0, parent = 0x0, color = 0 ‘\000’, data = 0 ‘\000’},  
closed = 0, channel = 0, resolver = 0, next = 0x0, prev = 0x0}  
(gdb) p \*((ngx\_connection\_t \*) ev-\>data)  
$2 = {data = 0x22a2780, read = 0x7fc4575008a8, write = 0x7fc45735f8a8,  
fd = 66, recv = 0x41cc50 \<ngx\_unix\_recv\>, send = 0x41cf08  
\<ngx\_unix\_send\>,  
recv\_chain = 0x41cd00 \<ngx\_readv\_chain\>,  
send\_chain = 0x421050 \<ngx\_linux\_sendfile\_chain\>, listening = 0x0,  
sent = 0, log = 0x21f1770, pool = 0x237ff70, sockaddr = 0x0, socklen =  
0,  
addr\_text = {len = 0, data = 0x0}, ssl = 0x0, local\_sockaddr = 0x0,  
buffer = 0x0, queue = {prev = 0x0, next = 0x0}, number = 63713716,  
requests = 0, buffered = 0, log\_error = 1, single\_connection = 0,  
unexpected\_eof = 0, timedout = 0, error = 0, destroyed = 0, idle = 0,  
reusable = 0, close = 0, sendfile = 1, sndlowat = 0, tcp\_nodelay = 0,  
tcp\_nopush = 0}

2011/9/5 Maxim D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![Maxim\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@Maxim\_D](https://www.ruby-forum.com/u/Maxim_D)\
**Post date:** [September 5, 2011, 5:43pm UTC](https://www.ruby-forum.com/t/upstream-keepalive-call-for-testing/210170/56 "2011-09-05T17:43:23Z")

</div>

# (gdb) fr 0 #0 ngx\_http\_upstream\_handler (ev=0x7fc45735f8a8) at src/http/ngx\_http\_upstream.c:915 915 ctx-\>current\_request = r; (gdb) p ngx\_cycle-\>log $1 = (ngx\_log\_t \*) 0x21f19a8 (gdb) p \*r $2 = {signature = 51686928, connection = 0x23b4160, ctx = 0x0, main\_conf = 0x0, srv\_conf = 0x23e6dc8, loc\_conf = 0x2216d58, read\_event\_handler = 0x42d5dd \<ngx\_http\_block\_reading\>, write\_event\_handler = 0x42d2a6 \<ngx\_http\_request\_empty\_handler\>, cache = 0x0, upstream = 0x0, upstream\_states = 0x0, pool = 0x23e92d0, header\_in = 0x2309ea0, headers\_in = {headers = {last = 0x22a27f0, part = { elts = 0x23e9ae8, nelts = 5, next = 0x0}, size = 48, nalloc = 20, pool = 0x23e92d0}, host = 0x23e9b78, connection = 0x0, if\_modified\_since = 0x0, if\_unmodified\_since = 0x0, user\_agent = 0x23e9b48, referer = 0x0, content\_length = 0x0, content\_type = 0x0, range = 0x0, if\_range = 0x0, transfer\_encoding = 0x0, expect = 0x0, accept\_encoding = 0x0, via = 0x0, authorization = 0x0, keep\_alive = 0x0, x\_forwarded\_for = 0x0, user = {len = 0, data = 0x0}, passwd = {len = 0, data = 0x0}, cookies = {elts = 0x23e9ea8, nelts = 0, size = 8, nalloc = 2, pool = 0x23e92d0}, server = {len = 14, data = 0x23e9edb “static.loli.myconnectioner-ag\360\324,\002”}, content\_length\_n = -1, keep\_alive\_n = -1, connection\_type = 1, msie

# 1, msie6 = 1, opera = 0, gecko = 0, chrome = 0, safari = 0, konqueror = 0}, headers\_out = {headers = {last = 0x22a2920, part = {elts = 0x23e9320, nelts = 4, next = 0x0}, size = 48, nalloc = 20, pool = 0x23e92d0}, status = 200, status\_line = {len = 0, data = 0x0}, server = 0x0, date = 0x0, content\_length = 0x0, content\_encoding = 0x0, location = 0x0, refresh = 0x0, last\_modified = 0x0, content\_range = 0x0, —Type to continue, or q to quit— accept\_ranges = 0x23e93b0, www\_authenticate = 0x0, expires = 0x23e9320, etag = 0x0, override\_charset = 0x0, content\_type\_len = 24, content\_type = { len = 24, data = 0x23e5bf0 “application/x-javascript”}, charset = { len = 0, data = 0x0}, content\_type\_lowcase = 0x23ea1e8 “application/x-javascripts\016\>\002”, content\_type\_hash = 15285649345721276481, cache\_control = { elts = 0x23ea188, nelts = 1, size = 8, nalloc = 1, pool = 0x23e92d0}, content\_length\_n = 19773, date\_time = 0, last\_modified\_time = 1313998502}, request\_body = 0x0, lingering\_time = 1315110106, start\_sec = 1315110076, start\_msec = 683, method = 2, http\_version = 1001, request\_line = {len

# 0, data = 0x314ae20 “\360\f\>\002”}, uri = {len = 15, data = 0x314ae24 “”}, args = {len = 0, data = 0x0}, exten = {len = 2, data = 0x314ae31 “”}, unparsed\_uri = {len = 15, data = 0x314ae24 “”}, method\_name = {len = 3, data = 0x314ae20 “\360\f\>\002”}, http\_protocol = {len = 8, data = 0x314ae34 “”}, out = 0x0, main = 0x22a2780, parent = 0x0, postponed = 0x0, post\_subrequest = 0x0, posted\_requests = 0x0, virtual\_names = 0x2465c20, phase\_handler = 11, content\_handler = 0, access\_code = 0, variables = 0x23e9808, ncaptures = 4, captures = 0x23e9ff0, captures\_data = 0x314ae24 “”, limit\_rate = 0, header\_size = 339, request\_length = 183, err\_status = 0, http\_connection = 0x23b4228, log\_handler = 0x42da14 \<ngx\_http\_log\_error\_handler\>, cleanup = 0x0, subrequests = 51, count = 0, blocked = 0, aio = 0, http\_state = 2, complex\_uri = 0, quoted\_uri = 0, plus\_in\_uri = 0, space\_in\_uri = 0, —Type to continue, or q to quit— invalid\_header = 0, add\_uri\_to\_alias = 0, valid\_location = 1, valid\_unparsed\_uri = 1, uri\_changed = 0, uri\_changes = 11, request\_body\_in\_single\_buf = 0, request\_body\_in\_file\_only = 0, request\_body\_in\_persistent\_file = 0, request\_body\_in\_clean\_file = 0, request\_body\_file\_group\_access = 0, request\_body\_file\_log\_level = 5, subrequest\_in\_memory = 0, waited = 0, cached = 0, gzip\_tested = 1, gzip\_ok = 0, gzip\_vary = 1, proxy = 0, bypass\_cache = 0, no\_cache = 0, limit\_zone\_set = 0, limit\_req\_set = 0, pipeline = 0, plain\_http = 0, chunked = 0, header\_only = 0, keepalive = 0, lingering\_close = 0, discard\_body = 0, internal = 0, error\_page = 0, ignore\_content\_encoding = 0, filter\_finalize = 0, post\_action = 0, request\_complete = 1, request\_output = 1, header\_sent = 1, expect\_tested = 0, root\_tested = 1, done = 1, logged = 0, buffered = 0, main\_filter\_need\_in\_memory = 0, filter\_need\_in\_memory = 0, filter\_need\_temporary = 0, allow\_ranges = 1, stat\_reading = 0, stat\_writing = 1, state = 0, header\_hash = 2715320498552542, lowcase\_index = 10, lowcase\_header = “connectionguage”, ‘\000’ \<repeats 16 times\>, header\_name\_start = 0x314aed5 “\r\nible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; MALN; InfoPath.1; Media Center PC 6.0; Tablet PC 2.0; .NET4.0C; .NET4.0E)”, header\_name\_end = 0x314aecc “”, header\_start = 0x314aece “close”, header\_end = 0x314aed5 “\r\nible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; MALN; Info—Type to continue, or q to quit— Path.1; Media Center PC 6.0; Tablet PC 2.0; .NET4.0C; .NET4.0E)”, uri\_start = 0x314ae24 “”, uri\_end = 0x314ae33 “”, uri\_ext = 0x314ae31 “”, args\_start = 0x0, request\_start = 0x314ae20 “\360\f\>\002”, request\_end = 0x314ae3c “”, method\_end = 0x314ae22 “\>\002”, schema\_start = 0x0, schema\_end = 0x0, host\_start = 0x0, host\_end = 0x0, port\_start = 0x0, port\_end = 0x0, http\_minor = 1264, http\_major = 0} (gdb) p \*r-\>connection $3 = {data = 0x30, read = 0x111, write = 0x22a2770, fd = 36740720, recv = 0x2309e80, send = 0, recv\_chain = 0xb0, send\_chain = 0x23b4170, listening = 0x0, sent = 36740848, log = 0x0, pool = 0x23b41d0, sockaddr = 0xf088e714b9a0002, socklen = 0, addr\_text = {len = 4, data = 0x21f1c18 “S”}, ssl = 0x3cc35a0, local\_sockaddr = 0x42d957, buffer = 0x23b4210, queue = {prev = 0x465bfc, next = 0x2e3234312e333131}, number = 3256446919138946616, requests = 140481256921360, buffered = 0, log\_error = 0, single\_connection = 0, unexpected\_eof = 0, timedout = 0, error = 0, destroyed = 0, idle = 0, reusable = 0, close = 0, sendfile

0,  
sndlowat = 0, tcp\_nodelay = 0, tcp\_nopush = 0}

2011/9/5 Maxim D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![Maxim\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@Maxim\_D](https://www.ruby-forum.com/u/Maxim_D)\
**Post date:** [September 6, 2011, 8:39am UTC](https://www.ruby-forum.com/t/upstream-keepalive-call-for-testing/210170/57 "2011-09-06T08:39:59Z")

</div>

ok, I will try that at another dedicated server, thanks for your Helps.

MagicBear

## Maxim D. Wrote:

> > (gdb) p ngx\_cycle-\>log  
> > improper handling  
> > for details:
> 
> [http://mailman.nginx.org/pipermail/nginx-devel/201](http://mailman.nginx.org/pipermail/nginx-devel/201)  
> 1-September/001147.html
> 
> Maxim D.
> 
> * * *
> 
> nginx mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [mailman.nginx.org archive](http://mailman.nginx.org/mailman/listinfo/nginx)

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,213207,214853#msg-214853](http://forum.nginx.org/read.php?2,213207,214853#msg-214853)

---

<div class="post-metadata">

**Author:** ![Maxim\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@Maxim\_D](https://www.ruby-forum.com/u/Maxim_D)\
**Post date:** [September 5, 2011, 8:02pm UTC](https://www.ruby-forum.com/t/upstream-keepalive-call-for-testing/210170/58 "2011-09-05T20:02:43Z")

</div>

Hello!

On Mon, Sep 05, 2011 at 11:42:31PM +0800, ビリビリⅤ wrote:

> (gdb) fr 0  
> #0 ngx\_http\_upstream\_handler (ev=0x7fc45735f8a8)  
> at src/http/ngx\_http\_upstream.c:915  
> 915 ctx-\>current\_request = r;  
> (gdb) p ngx\_cycle-\>log  
> $1 = (ngx\_log\_t \*) 0x21f19a8  
> (gdb) p \*r  
> $2 = {signature = 51686928, connection = 0x23b4160, ctx = 0x0,

[…]

This looks like memory corruption, but unfortunately I don’t see  
any traces of the real cause. My best quess is improper handling  
of proxy\_ignore\_client\_abort as fixed in 1.1.2. Please try 1.1.2  
with patches from

[http://nginx.org/patches/patch-nginx-keepalive-full-5.txt](http://nginx.org/patches/patch-nginx-keepalive-full-5.txt)

It already includes upstream keepalive module, as well as all  
other upstream-keepalive related fixes. See here for details:

> **[\[PATCH 00 of 15\] upstream keepalive patch queue](http://mailman.nginx.org/pipermail/nginx-devel/2011-September/001147.html)**

Maxim D.

---

<div class="post-metadata">

**Author:** ![Maxim\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@Maxim\_D](https://www.ruby-forum.com/u/Maxim_D)\
**Post date:** [September 8, 2011, 11:28am UTC](https://www.ruby-forum.com/t/upstream-keepalive-call-for-testing/210170/59 "2011-09-08T11:28:14Z")

</div>

Hello!

On Wed, Sep 07, 2011 at 04:33:38PM -0700, Matthieu T. wrote:

> Thanks for the all-included patch from 1.1.2
> 
> It seems that keepalive connections aren’t working in combination with  
> proxy\_buffering off; (c-\>read-\>ready is set to 1)  
> It worked before this last update, is this the intended behavior ?

Linux with epoll, right? Please try the following patch:

diff --git a/src/http/modules/ngx\_http\_upstream\_keepalive\_module.c  
b/src/http/modules/ngx\_http\_upstream\_keepalive\_module.c  
— a/src/http/modules/ngx\_http\_upstream\_keepalive\_module.c  
+++ b/src/http/modules/ngx\_http\_upstream\_keepalive\_module.c  
@@ -321,7 +321,6 @@ ngx\_http\_upstream\_free\_keepalive\_peer(ng  
if (kp-\>failed  
|| c == NULL  
|| c-\>read-\>eof

- 

```
   || c->read->ready
   || c->read->error
   || c->read->timedout
   || c->write->error

```

@@ -382,6 +381,10 @@ ngx\_http\_upstream\_free\_keepalive\_peer(ng  
item-\>socklen = pc-\>socklen;  
ngx\_memcpy(&item-\>sockaddr, pc-\>sockaddr, pc-\>socklen);

- if (c-\>read-\>ready) {
- 

```
   ngx_http_upstream_keepalive_close_handler(c->read);

```

- }
- 

invalid:

```
 kp->original_free_peer(pc, kp->data, state);

```

diff --git a/src/http/ngx\_http\_upstream.c b/src/http/ngx\_http\_upstream.c  
— a/src/http/ngx\_http\_upstream.c  
+++ b/src/http/ngx\_http\_upstream.c  
@@ -2142,7 +2142,7 @@ ngx\_http\_upstream\_send\_response(ngx\_http  
return;  
}

- 

```
       if (u->peer.connection->read->ready) {

```

- 

```
       if (u->peer.connection->read->ready || u->length == 0) {
           ngx_http_upstream_process_non_buffered_upstream(r, u);
       }
   }

```

Second part fixes one more problem with handling of responses with  
empty body over keepalive connections, found during testing with  
various event methods.

Maxim D.

---

<div class="post-metadata">

**Author:** ![Maxim\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@Maxim\_D](https://www.ruby-forum.com/u/Maxim_D)\
**Post date:** [September 8, 2011, 5:42pm UTC](https://www.ruby-forum.com/t/upstream-keepalive-call-for-testing/210170/60 "2011-09-08T17:42:37Z")

</div>

Hello!

On Thu, Sep 08, 2011 at 01:27:34PM +0400, Maxim D. wrote:

> Linux with epoll, right? Please try the following patch:  
> Updated full patch may be grabbed here:

[http://nginx.org/patches/patch-nginx-keepalive-full-6.txt](http://nginx.org/patches/patch-nginx-keepalive-full-6.txt)

Maxim D.

[Previous page](https://www.ruby-forum.com/t/upstream-keepalive-call-for-testing/210170.md?page=2)

[Next page](https://www.ruby-forum.com/t/upstream-keepalive-call-for-testing/210170.md?page=4)
