# Nginx 0.8.55 && 1.1.0 core dump if switch from http to https with HUP

**URL:** <https://www.ruby-forum.com/t/nginx-0-8-55-1-1-0-core-dump-if-switch-from-http-to-https-with-hup/210199>\
**Category:** NGINX\
**Created:** [August 2, 2011, 10:36am UTC](https://www.ruby-forum.com/t/nginx-0-8-55-1-1-0-core-dump-if-switch-from-http-to-https-with-hup/210199 "2011-08-02T10:36:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [August 2, 2011, 10:36am UTC](https://www.ruby-forum.com/t/nginx-0-8-55-1-1-0-core-dump-if-switch-from-http-to-https-with-hup/210199/1 "2011-08-02T10:36:40Z")

</div>

Hi,  
Nginx crash if switch http to https, steps to reproduce are :

1. setup a normal config of http

2. start nginx

3. edit config file and add:  
ssl on;  
ssl\_certificate /path/to/root.cert;  
ssl\_certificate\_key /path/to//root.key;  
ssl\_client\_certificate /path/to//root.ca.cert;

4. kill -HUP pid\_of\_nginx

5. nginx crashed.

If I use the following cfg to start nginx http :  
ssl off;  
ssl\_certificate /path/to/root.cert;  
ssl\_certificate\_key /path/to//root.key;  
ssl\_client\_certificate /path/to//root.ca.cert;

after nginx started, then changed the config to :  
ssl on;  
ssl\_certificate /path/to/root.cert;  
ssl\_certificate\_key /path/to//root.key;  
ssl\_client\_certificate /path/to//root.ca.cert;

kill -HUP pid\_of\_nginx, everything is OK. nginx NOT crashed.

secone-dev:/secone/webap/conf# /secone/webap/sbin/nginx -V  
nginx version: nginx/0.8.55  
built by gcc 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)  
TLS SNI support disabled  
configure arguments: --prefix=/secone/webap --pid-path=/secone/var  
–with-cpu-opt=pentium4 --with-pcre --with-ipv6  
–without-http\_autoindex\_module --without-http\_ssi\_module  
–without-http\_empty\_gif\_module --without-http\_memcached\_module  
–without-http\_charset\_module --without-http\_split\_clients\_module  
–with-http\_stub\_status\_module --with-http\_ssl\_module  
–with-http\_realip\_module --with-http\_sub\_module  
–with-http\_geoip\_module

(gdb) bt  
#0 ngx\_slab\_alloc (pool=0x0, size=40) at src/core/ngx\_slab.c:145  
#1 0x080683c6 in ngx\_ssl\_session\_cache\_init (shm\_zone=0x81037e4,  
data=0x0)  
at src/event/ngx\_event\_openssl.c:1518  
#2 0x08058d14 in ngx\_init\_cycle (old\_cycle=0x80c8738)  
at src/core/ngx\_cycle.c:454  
#3 0x0806662f in ngx\_master\_process\_cycle (cycle=0x80c8738)  
at src/os/unix/ngx\_process\_cycle.c:240  
#4 0x0804d151 in main (argc=3, argv=0xbfaf09b4) at src/core/nginx.c:401

(gdb) frame 1  
#1 0x080683c6 in ngx\_ssl\_session\_cache\_init (shm\_zone=0x81037e4,  
data=0x0)  
at src/event/ngx\_event\_openssl.c:1518  
1518 cache = ngx\_slab\_alloc(shpool,  
sizeof(ngx\_ssl\_session\_cache\_t));  
(gdb) l  
1513 return NGX\_OK;  
1514 }  
1515  
1516 shpool = (ngx\_slab\_pool\_t \*) shm\_zone-\>shm.addr;  
1517  
1518 cache = ngx\_slab\_alloc(shpool,  
sizeof(ngx\_ssl\_session\_cache\_t));  
1519 if (cache == NULL) {  
1520 return NGX\_ERROR;  
1521 }  
1522

(gdb) info locals  
shpool = (ngx\_slab\_pool\_t \*) 0x0  
(gdb) info args  
shm\_zone = (ngx\_shm\_zone\_t \*) 0x81037e4  
data = (void \*) 0x0

It seems nginx 1.1.0 also has this issue.  
secone-dev:/secone/webap/conf# /secone/webap/sbin/nginx -V  
nginx: nginx version: nginx/1.1.0  
nginx: built by gcc 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)  
nginx: TLS SNI support disabled  
nginx: configure arguments: --prefix=/secone/webap  
–pid-path=/secone/var --with-cpu-opt=pentium4 --with-pcre --with-ipv6  
–without-http\_autoindex\_module --without-http\_ssi\_module  
–without-http\_empty\_gif\_module --without-http\_memcached\_module  
–without-http\_charset\_module --without-http\_split\_clients\_module  
–with-http\_stub\_status\_module --with-http\_ssl\_module  
–with-http\_realip\_module --with-http\_sub\_module  
–with-http\_geoip\_module

---

<div class="post-metadata">

**Author:** ![Delta\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f9ae1b/32.png) [@Delta\_Y](https://www.ruby-forum.com/u/Delta_Y)\
**Post date:** [August 2, 2011, 2:41pm UTC](https://www.ruby-forum.com/t/nginx-0-8-55-1-1-0-core-dump-if-switch-from-http-to-https-with-hup/210199/2 "2011-08-02T14:41:45Z")

</div>

Hello!

On Tue, Aug 02, 2011 at 04:35:28PM +0800, Delta Y. wrote:

> 1. kill -HUP pid\_of\_nginx
> 2. nginx crashed.

Thank you for your report. Attached patch should fix this problem.

Maxim D.

---

<div class="post-metadata">

**Author:** ![Delta\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f9ae1b/32.png) [@Delta\_Y](https://www.ruby-forum.com/u/Delta_Y)\
**Post date:** [August 3, 2011, 7:26am UTC](https://www.ruby-forum.com/t/nginx-0-8-55-1-1-0-core-dump-if-switch-from-http-to-https-with-hup/210199/3 "2011-08-03T07:26:40Z")

</div>

Thanks , after apply the patch, crash won’t happen again.

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

---

<div class="post-metadata">

**Author:** ![Delta\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f9ae1b/32.png) [@Delta\_Y](https://www.ruby-forum.com/u/Delta_Y)\
**Post date:** [August 4, 2011, 5:02am UTC](https://www.ruby-forum.com/t/nginx-0-8-55-1-1-0-core-dump-if-switch-from-http-to-https-with-hup/210199/4 "2011-08-04T05:02:12Z")

</div>

Hi Igor,

I apply your patch against svn trunk, it fix the crash.  
Thanks .

2011/8/3 Igor S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![Delta\_Y](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f9ae1b/32.png) [@Delta\_Y](https://www.ruby-forum.com/u/Delta_Y)\
**Post date:** [August 3, 2011, 5:47pm UTC](https://www.ruby-forum.com/t/nginx-0-8-55-1-1-0-core-dump-if-switch-from-http-to-https-with-hup/210199/5 "2011-08-03T17:47:09Z")

</div>

On Wed, Aug 03, 2011 at 01:26:04PM +0800, Delta Y. wrote:

> Thanks , after apply the patch, crash won’t happen again.

Could you test another attached patch ?
