# Memory leak in outgoing https connections

**URL:** <https://www.ruby-forum.com/t/memory-leak-in-outgoing-https-connections/209745>\
**Category:** NGINX\
**Created:** [July 21, 2011, 6:45pm UTC](https://www.ruby-forum.com/t/memory-leak-in-outgoing-https-connections/209745 "2011-07-21T18:45:26Z")\
**Posts on this page:** 2\
**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:** [July 21, 2011, 6:45pm UTC](https://www.ruby-forum.com/t/memory-leak-in-outgoing-https-connections/209745/1 "2011-07-21T18:45:26Z")

</div>

Hi!

I believe, there is a memory leak in nginx somewhere in handling  
outgoing HTTPS connections. I am using it as a simple http-to-https  
proxy. My configuration is the following:

resolver 8.8.8.8;  
server {  
listen 127.0.0.1:81;  
server\_name localhost;  
access\_log off;  
location / {  
proxy\_pass $http\_x\_proxy\_url;  
}  
}

When I try to run something like:  
bash -c “while :; do curl -H ‘X-Proxy-Url: [https://any-https-site.tld/](https://any-https-site.tld/)’  
[http://localhost:81/](http://localhost:81/); done”

I see nginx eating more and more memory with each request.

I used the latest stable version and compiled it from source on Debian  
Lenny x64:  
root@debian-amd64:/usr/local/nginx/sbin# ./nginx -V  
nginx: nginx version: nginx/1.0.5  
nginx: built by gcc 4.3.4 (Debian 4.3.4-6~bpo50+1)  
nginx: TLS SNI support enabled  
nginx: configure arguments: --with-debug --with-http\_stub\_status\_module  
–with-http\_flv\_module --with-http\_ssl\_module --with-http\_dav\_module

Best regards,  
Anton.

Posted at Nginx Forum:

> **[Memory leak in outgoing https connections](https://forum.nginx.org/read.php?2,212769,212769#msg-212769)**
>
> Hi! I believe, there is a memory leak in nginx somewhere in handling outgoing HTTPS connections. I am using it as a simple http-to-https proxy. My configuration is the following: resolver 8.8.8.8; server { listen 127.0.0.1:81; server\_name

---

<div class="post-metadata">

**Author:** ![knyar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/dfb087/32.png) [@knyar](https://www.ruby-forum.com/u/knyar)\
**Post date:** [July 21, 2011, 11:59pm UTC](https://www.ruby-forum.com/t/memory-leak-in-outgoing-https-connections/209745/2 "2011-07-21T23:59:30Z")

</div>

Hello!

On Thu, Jul 21, 2011 at 12:44:50PM -0400, knyar wrote:

> ```
> access_log off;
> location / {
> proxy_pass $http_x_proxy_url;
> }
> 
> ```
> 
> }
> 
> When I try to run something like:  
> bash -c “while :; do curl -H ‘X-Proxy-Url: [https://any-https-site.tld/](https://any-https-site.tld/)’  
> [http://localhost:81/](http://localhost:81/); done”
> 
> I see nginx eating more and more memory with each request.

Thank you for report, attached patch fixes the leak.

Workaround is “proxy\_ssl\_session\_reuse off;”.

Maxim D.
