# Issues with "Connection reset" and mongrels loving memory

**URL:** <https://www.ruby-forum.com/t/issues-with-connection-reset-and-mongrels-loving-memory/123425>\
**Category:** Deployment\
**Created:** [December 17, 2007, 4:38pm UTC](https://www.ruby-forum.com/t/issues-with-connection-reset-and-mongrels-loving-memory/123425 "2007-12-17T16:38:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bill\_Turner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/848f3c/32.png) [@Bill\_Turner](https://www.ruby-forum.com/u/Bill_Turner)\
**Post date:** [December 17, 2007, 4:38pm UTC](https://www.ruby-forum.com/t/issues-with-connection-reset-and-mongrels-loving-memory/123425/1 "2007-12-17T16:38:45Z")

</div>

Hi folks,  
I’ve searched and search, but can’t seem to find solutions that work  
for me. I’m hoping if I include enough information I may find some  
help here. Here are the problems I am getting reports on:

1. While using the application, the users are getting intermittent  
“Connection reset by peer” errors in the browser. I’m told it doesn’t  
matter what action they’re performing, just that it is happening more  
and more often. I just turned on my nginx error logs to see if  
anything will show up in there (saw something to this effect in  
another thread somewhere).

2. I still have problems with the mongrel processes gobbling up memory  
to the point where everything seizes up. It seems to happen about once  
a week, or every other week. I’ve tried so many options that I’ve read  
here and in the mongrel mailing list, but none seem to have worked.  
(I’ve tried the verification\_timeout setting, and the  
verify\_active\_connections thread suggestions). I’m including my mysql  
config below as maybe the problem lies in there.

The server load never gets very high. The only exception is when the  
mongrel process get out of control.

My set up:

Ubuntu 7.10  
Ruby: 1.8.6  
Rails: 1.2.6  
MySQL: Ver 14.12 Distrib 5.0.45 (mysql gem: 2.7)  
Mongrel: 1.1.1 / mongrel\_cluster: 1.0.4  
nginx: 0.5.26

- nginx has 4 worker processes, and for the main app I have 10 mongrel  
servers
- Every night, the nginx and mongrel processes restart to rotate the  
logs

I may need help with optimizing mysql, here are the config options  
from my.cnf:

key\_buffer = 16M  
max\_allowed\_packet = 16M  
thread\_stack = 128K  
thread\_cache\_size = 8  
#max\_connections = 100  
#table\_cache = 64  
#thread\_concurrency = 10

# 

# \* Query Cache Configuration

# 

query\_cache\_limit = 1M  
query\_cache\_size = 32M

[isamchk]  
key\_buffer = 16M

If there’s any other information needed, I’ll gladly provide if asked.

Many thanks.

Bill

---

<div class="post-metadata">

**Author:** ![Bill\_Turner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/848f3c/32.png) [@Bill\_Turner](https://www.ruby-forum.com/u/Bill_Turner)\
**Post date:** [December 28, 2007, 1:56am UTC](https://www.ruby-forum.com/t/issues-with-connection-reset-and-mongrels-loving-memory/123425/2 "2007-12-28T01:56:08Z")

</div>

First thing, this bugs me, wondering what you firewall setup is.  
If your restarting mogrels, and nginx every night, something is  
getting “carried” over,  
or your getting a DOS attack.

For me, think I would look at half-open connections, and a packet  
trace for arround the time the resets are occurring.  
Also you may want to check your kernel paramters.  
Also sounds like a few different problems your having.
