Errno::EPIPE (Broken pipe - /tmp/mysql5.sock):
I was recently having problems with my rails installation. Since it appears to be repaired now and I can’t find anyone else talking about the error, I figured I should post my “solution” here.
The Symptoms
The server worked fine, for about 10-12 hours, then I would receive the dreaded, ambiuous “Rails Application Error”. In the logfile, the following was logged
Errno::EPIPE (Broken pipe - /tmp/mysql5.sock): /usr/local/lib/ruby/1.8/mysql.rb:1042:in `flush' /usr/local/lib/ruby/1.8/mysql.rb:1042:in `write' /usr/local/lib/ruby/1.8/mysql.rb:462:in `write' /usr/local/lib/ruby/1.8/mysql.rb:436:in `command' /usr/local/lib/ruby/1.8/mysql.rb:307:in `stat' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/mysql_adapter.rb:148:in `active?' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/abstract_adapter.rb:85:in `verify!' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:99:in `verify_active_connections!' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:98:in `verify_active_connections!' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:70:in `prepare_application' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:37:in `dispatch' /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4/lib/mongrel/rails.rb:66:in `process' /usr/local/lib/ruby/1.8/thread.rb:135:in `synchronize' /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4/lib/mongrel/rails.rb:64:in `process' /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4/lib/mongrel.rb:425:in `process_client' /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4/lib/mongrel.rb:424:in `process_client' /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4/lib/mongrel.rb:495:in `run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4/lib/mongrel.rb:494:in `run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4/lib/mongrel.rb:483:in `run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4/lib/mongrel.rb:774:in `run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4/lib/mongrel.rb:772:in `run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4/bin/mongrel_rails:97:in `run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4/lib/mongrel/command.rb:163:in `run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4/bin/mongrel_rails:194 /usr/local/bin/mongrel_rails:18
How I Fixed It
At first, I thought it was a problem with my installation, so I tried several different web servers, some using FCGI, some that did not, eventually settling on mongrel (which is great by the way). Once I was pretty sure that the application server was not the problem, that pretty much leaves the ruby installation.
In my instance, I had installed ruby from source, so I had to remove all things ruby manually (including all gems). Your filesystem locations may vary.
rm -Rf /usr/lib/ruby /usr/local/lib/ruby /usr/lib/site_ruby
Once my ruby was gone, I re-installed ruby, gem, then all of my gems. I wish I had a better solution, but I don’t right now.