Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Deprecation warning: Database connections will not be closed automatically" #59

Closed
rxbynerd opened this issue Apr 7, 2012 · 7 comments

Comments

@rxbynerd
Copy link

rxbynerd commented Apr 7, 2012

I'm using Puma with Sinatra and ActiveRecord, and I've noticed a few lines being written to STDERR which I'm stuck with:

DEPRECATION WARNING: Database connections will not be closed automatically, please close your
database connection at the end of the thread by calling `close` on your
connection.  For example: ActiveRecord::Base.connection.close
. (called from mon_synchronize at /usr/local/lib/ruby/1.9.1/monitor.rb:211)

I'm using MRI, I can't test this on jRuby because less.rb demands therubyracer, which won't compile ⚡ 😞 ⚡

Is there a fix for this?

@evanphx
Copy link
Member

evanphx commented Apr 10, 2012

What version of ActiveRecord are you using?

@evanphx
Copy link
Member

evanphx commented Apr 11, 2012

You need to use the ActiveRecord rack middleware ActiveRecord:: ConnectionAdapters::ConnectionManagement so that the connections are closed down properly.

@evanphx evanphx closed this as completed Apr 11, 2012
@rxbynerd
Copy link
Author

OK, thank you

Sorry, it looks like GitHub didn't get my reply email

@evanphx
Copy link
Member

evanphx commented Apr 11, 2012

No problem!

Evan Phoenix // evan@phx.io

On Wednesday, April 11, 2012 at 11:08 AM, Luke Carpenter wrote:

OK, thank you

Sorry, it looks like GitHub didn't get my reply email


Reply to this email directly or view it on GitHub:
#59 (comment)

@philostler
Copy link

For the record I get the same in JRuby (1.7.0.preview2)

Fixed by adding use ActiveRecord::ConnectionAdapters::ConnectionManagement before all my Sinatra apps in my config.ru file

@davesag
Copy link

davesag commented Sep 3, 2012

Thanks! I was getting this too but only occasionally.

@cyrusg
Copy link

cyrusg commented Jul 21, 2013

"use ActiveRecord::ConnectionAdapters::ConnectionManagement" solved my issues with ClearDB on Heroku.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants