Forum: Ruby on Rails MySQL connection problems on Dreamhost

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
8217faf2bfdfa7daf10135d41ddd421e?d=identicon&s=25 Jeff Cohen (jeff)
on 2006-04-30 23:25
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. :-(

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:in
`connect'
    /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:in
`new'
    /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:in
`send'
    /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:in
`connection='
    /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:in
`connection'
    /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:in
`column_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:in
`all_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:in
`each'
    /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:in
`all_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:in `for_today'
F95b7866513ca8c9a86a43b25cad9df2?d=identicon&s=25 Frank Frank (lobbr)
on 2006-05-01 01:20
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
B84d42a3a5c343f8fc6ab7d7f47fd3f5?d=identicon&s=25 Robby Russell (Guest)
on 2006-05-03 18:56
(Received via mailing list)
On Apr 30, 2006, at 2:25 PM, Jeff Cohen 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 Russell
Founder & Executive Director

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

www.planetargon.com
www.robbyonrails.com

+1 503 445 2457
+1 877 55 ARGON [toll free]
+1 815 642 4968 [fax]
Aa880989a2c401666945d32027522ca0?d=identicon&s=25 Takashi Okamoto (Guest)
on 2006-05-03 18:56
(Received via mailing list)
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.
This topic is locked and can not be replied to.