Rails to DB TCP Reset issue

Phusion Passenger version 3.0.18 nginx version: nginx/1.2.4

ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]

rails (3.0.20)

MULTIPLE TCP RESETS sent

I usually see 20-25 database connections from my ruby/rails//passenger/nginx server to my database server. Pool is set to 25. Passenger is limited to 20

I am seeing lots of TCP Resets and dropped mysql connections. I run the DB on port 3312…and using tcpdump I can see the db sends a [S.] SYN-ACK but the rails server responds with a [R] RESET immediately.

tcptrack on port 3312 shows 20-25 connections then all of a sudden it jumps to 300-600 connections but the majority are RESET (s) Any idea why rails would be killing off so many DB connections (more then are even established)

-dave webster

yyy.yyy.yyy.yyy:56468 xxx.xxx.xxx.xxx:3312 RESET 2s 0 B/s

yyy.yyy.yyy.yyy:56590 xxx.xxx.xxx.xxx:3312 RESET 1s 0 B/s

yyy.yyy.yyy.yyy:56511 xxx.xxx.xxx.xxx:3312 RESET 1s 0 B/s

yyy.yyy.yyy.yyy:56469 xxx.xxx.xxx.xxx:3312 RESET 2s 0 B/s

yyy.yyy.yyy.yyy:49257 xxx.xxx.xxx.xxx:3312 ESTABLISHED 1s 7 KB/s

yyy.yyy.yyy.yyy:56610 xxx.xxx.xxx.xxx:3312 RESET 1s 0 B/s

yyy.yyy.yyy.yyy:56497 xxx.xxx.xxx.xxx:3312 RESET 2s 0 B/s

yyy.yyy.yyy.yyy:56575 xxx.xxx.xxx.xxx:3312 RESET 1s 0 B/s

yyy.yyy.yyy.yyy:56470 xxx.xxx.xxx.xxx:3312 RESET 2s 0 B/s

yyy.yyy.yyy.yyy:56585 xxx.xxx.xxx.xxx:3312 RESET 1s 0 B/s

yyy.yyy.yyy.yyy:56541 xxx.xxx.xxx.xxx:3312 RESET 1s 0 B/s

yyy.yyy.yyy.yyy:56480 xxx.xxx.xxx.xxx:3312 RESET 2s 0 B/s

yyy.yyy.yyy.yyy:56477 xxx.xxx.xxx.xxx:3312 RESET 2s 0 B/s

yyy.yyy.yyy.yyy:56471 xxx.xxx.xxx.xxx:3312 RESET 2s 0 B/s

yyy.yyy.yyy.yyy:56509 xxx.xxx.xxx.xxx:3312 RESET 2s 0 B/s

yyy.yyy.yyy.yyy:56457 xxx.xxx.xxx.xxx:3312 RESET 2s 0 B/s

yyy.yyy.yyy.yyy:56563 xxx.xxx.xxx.xxx:3312 RESET 1s 0 B/s

yyy.yyy.yyy.yyy:56519 xxx.xxx.xxx.xxx:3312 RESET 1s 0 B/s

yyy.yyy.yyy.yyy:56494 xxx.xxx.xxx.xxx:3312 RESET 2s 0 B/s

yyy.yyy.yyy.yyy:56493 xxx.xxx.xxx.xxx:3312 RESET 2s 0 B/s

yyy.yyy.yyy.yyy:56548 xxx.xxx.xxx.xxx:3312 RESET 1s 0 B/s

yyy.yyy.yyy.yyy:56536 xxx.xxx.xxx.xxx:3312 RESET 1s 0 B/s

yyy.yyy.yyy.yyy:56504 xxx.xxx.xxx.xxx:3312 RESET 2s 0 B/s

yyy.yyy.yyy.yyy:56472 xxx.xxx.xxx.xxx:3312 RESET 2s 0 B/s

yyy.yyy.yyy.yyy:56462 xxx.xxx.xxx.xxx:3312 RESET 2s 0 B/s

yyy.yyy.yyy.yyy:56579 xxx.xxx.xxx.xxx:3312 RESET 1s 0 B/s

yyy.yyy.yyy.yyy:56521 xxx.xxx.xxx.xxx:3312 RESET 1s 0 B/s

yyy.yyy.yyy.yyy:56526 xxx.xxx.xxx.xxx:3312 RESET 1s 0 B/s

yyy.yyy.yyy.yyy:56488 xxx.xxx.xxx.xxx:3312 RESET 2s 0 B/s

yyy.yyy.yyy.yyy:56571 xxx.xxx.xxx.xxx:3312 RESET 1s 0 B/s

yyy.yyy.yyy.yyy:56529 xxx.xxx.xxx.xxx:3312 RESET 1s 0 B/s

yyy.yyy.yyy.yyy:56564 xxx.xxx.xxx.xxx:3312 RESET 1s 0 B/s

yyy.yyy.yyy.yyy:56501 xxx.xxx.xxx.xxx:3312 RESET 2s 0 B/s

yyy.yyy.yyy.yyy:56478 xxx.xxx.xxx.xxx:3312 RESET 2s 0 B/s

yyy.yyy.yyy.yyy:56532 xxx.xxx.xxx.xxx:3312 RESET 1s 0 B/s

yyy.yyy.yyy.yyy:56461 xxx.xxx.xxx.xxx:3312 RESET 2s 0 B/s

yyy.yyy.yyy.yyy:56481 xxx.xxx.xxx.xxx:3312 RESET 2s 0 B/s

yyy.yyy.yyy.yyy:56547 xxx.xxx.xxx.xxx:3312 RESET 1s 0 B/s

yyy.yyy.yyy.yyy:56597 xxx.xxx.xxx.xxx:3312 RESET 1s 0 B/s

MDLIVE, INC. CONFIDENTIALITY NOTICE:

This e-mail and any attachments are for the exclusive and confidential use of the intended recipient. If you are not the intended recipient, please do not read, distribute or take action in reliance on this message. If you have received this message in error, please notify us immediately by return e-mail and promptly delete this message and its attachments from your computer system. We do not waive attorney-client, work product, doctor-patient, therapist-client or intellectual property privileges by the transmission of this message.

Unless funny business is happening I wouldn’t thought this mattered but there is very little point in setting the pool to 25 since each passenger instance only processes one request at a time. The default of 5 is usually ample. I wouldn’t have thought this mattered though - the limit of 25 would normally never kick in in the first place.

Fred