MySQL connection problems on Dreamhost


#1

To all fellow Dreamhosters out there…

Sometimes my app mysteriously loses its connection to the database,
resulting in a big ugly “Application Error (Rails)” page. Usually
refreshing the page makes it go away, but not today. :frowning:

In production.log I see this:

MysqlError (Lost connection to MySQL server during query):

Any idea why this happens? It’s rather intermittent and random, but I
get this a few times a week.

I’ve pasted a large section of the call stack below in case it helps.

Thanks!
Jeff

/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/mysql_adapter.rb:316:in 

real_connect' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/mysql_adapter.rb:316:inconnect’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/mysql_adapter.rb:87:in
initialize' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/mysql_adapter.rb:37:innew’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/mysql_adapter.rb:37:in
mysql_connection' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:insend’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in
connection_without_query_cache=' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/query_cache.rb:54:inconnection=’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:106:in
retrieve_connection' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:20:inconnection’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:734:in
columns' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:746:incolumn_names’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:759:in
column_methods_hash' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:1016:inall_attributes_exists?’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:1016:in
all?' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:1016:ineach’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:1016:in
all?' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:1016:inall_attributes_exists?’
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:975:in
method_missing' /app/models/trivia_question.rb:6:infor_today’


#2

I have been running a Rails app on Dreamhost for a couple of weeks now
(just launched official beta Sat) and I have not yet run into any issues
like this. If I do notice them I will let you know, though.

Frank
http://www.lobbr.com


#3

On Apr 30, 2006, at 2:25 PM, Jeff C. wrote:

Any idea why this happens? It’s rather intermittent and random, but I
get this a few times a week.

You might ask your hosting provider. Their database might be
restarting and causing your connection to disappear.

…or perhaps your application is attempting to run queries that are
above their memory allocation limits and it kills the query during
the process of fetching data.

Good luck tracking down the solution.

Cheers,

Robby

Robby R.
Founder & Executive Director

PLANET ARGON, LLC
Ruby on Rails Development, Consulting & Hosting


www.robbyonrails.com

+1 503 445 2457
+1 877 55 ARGON [toll free]
+1 815 642 4968 [fax]


#4

i’ve talked to dreamhost a couple of times about this. it happens on
occasion, which is really annoying. all the static pages come up
fine, but mysql connections die. they told me it’s because another
account on the same server is hogging all the bandwidth and that
mysql is the first to die in that situation.

i would just email them about it. they always replied to me within a
day.

good luck.

-tak.