(excerpt from chat)
07:38 < Dreamer3> after running for about a day my rails app starts to err out with broken pipe
07:39 < Dreamer3> restarting apache fixes it, but obviously that isn't an acceptible solution
07:40 < nextangle> dreamer3: could be mysql timeouts
07:41 < kwe> dreamer3: I get mysql timeouts
07:41 < Dreamer3> nextangle: ?? it breaks consistently until apache is restarted and i can access mysql just fine by itself
07:41 < Dreamer3> nextangle: and this machine has like 0 load
07:41 < nextangle> dreamer3: FCGI holds a permanent connection to MySQL that might timeout
07:42 < alexeyv> Dreamer3: 2 cents say it's connection time-out
07:42 < alexeyv> Rails never renews database connections
07:43 < nextangle> I think you can look it up in the MySQL docs..
07:43 < nextangle> When you figure it out, lemme know and I'll post something about it
---
Ok, I don't have a solution yet... but here are the references I have...
http://dev.mysql.com/doc/mysql/en/Gone_away.html
"By default, the server closes the connection after eight hours if nothing has happened. You can change the time limit by setting the wait_timeout variable when you start mysqld."
http://one.textdrive.com/pipermail/rails/2004-October/000100.html
Someone else noting the same problem...
http://one.textdrive.com/pipermail/rails/2004-November/000203.html
"PROPOSED FIX: Since Rails is going to be heavily used within
a FastCGI environment, I suggest fixing the problem within
ActiveRecord itself. More specifically, before abstract_adapter.rb
raises ActiveRecord::StatementInvalid, it should check if the
caught exception was caused by a broken pipe error, and in that
case establish a new connection to the database."
(I don't think this is a half bad idea - wouldn't guess it would be hard to impliment)
http://one.textdrive.com/pipermail/rails/2004-November/000204.html
Seems to be a "hack" fix to me... as killing the FastCGI thread every "x units of time" for no reason other than a dropped connection (that AR could reestablish) is going to be slower (have to reload and recache all those Ruby files) than just adding a check to the AR code to deal with this issue.
I like the proposed solution with modifying AR (or would it be the MySQL adapter?)... but am thinking of using the workaround and killing the FastCGI every 7 hours to insure the app continues to work. It's worth nothing that since this seems to be a timeout issue heavy (or even low-medium) traffic sites _should_ not even see this problem... Though I can't really imagine no one hit the website in question in the past 8 hours, I suppose it is possible...
I suppose I could also make the MySQL timeout longer... 16 hours, 24 hours, etc... but I don't like this idea. Perhaps this is a better idea than changing the FCGI settings...
If anyone else has thoughts, commends, ideas, please add...