Giter Club home page Giter Club logo

Comments (11)

josegonzalez avatar josegonzalez commented on July 30, 2024 1

Stop your rails app and then run db:drop?

Old dokku containers are retired after a minute or so, but you can check on whats running via docker ps -a. You should also check the postgres processlist to see what the actual clients are that have running connections, and then trace them back to the containers that are running. I'm 100% sure it's just rails being stupid, and will buy you a hot dog if thats not the case.

from dokku-postgres.

hhff avatar hhff commented on July 30, 2024

It's also kinna whack because there's 18 sessions using the db - but this is a staging box, and there's almost definitely no traffic there 😕

from dokku-postgres.

josegonzalez avatar josegonzalez commented on July 30, 2024

Your rails app is probably still using it's connections?

from dokku-postgres.

hhff avatar hhff commented on July 30, 2024

18 "sessions" seems like a lot for a staging box that is not being hit at all though right?

Like i would image if there's no traffic at all, there should be zero sessions

from dokku-postgres.

josegonzalez avatar josegonzalez commented on July 30, 2024

Your rails app is probably still using it's connections?

Rails will hold connections open since the processes just sit around, no? I don't know how many sessions it holds open. The plugin certainly doesn't do anything weird here, its definitely your application (or you exposing those connections to something).

from dokku-postgres.

hhff avatar hhff commented on July 30, 2024

hmm ok. I'm just using the most boilerplate rails / postgres / dokku setup. How would you recommend doing db:drop wtih rails holding open these connections?

from dokku-postgres.

hhff avatar hhff commented on July 30, 2024

I guess something like this? https://www.krautcomputing.com/blog/2014/01/10/how-to-drop-your-postgres-database-with-rails-4/

Just seems strange that there's these 18 dangling sessions. Is it possible old dokku containers (versions of the app) are holding open their connections to the DB ?

from dokku-postgres.

hhff avatar hhff commented on July 30, 2024

word thankyou @josegonzalez - will report back 🍔

from dokku-postgres.

josegonzalez avatar josegonzalez commented on July 30, 2024

🔥 🐕

from dokku-postgres.

arielscherman avatar arielscherman commented on July 30, 2024

I am having a related issue (using Rails 5.1.). Any news?

I am running:

ActiveRecord::Tasks::DatabaseTasks.purge("my_app_test")

And I get this:

/my-folder/.rvm/gems/ruby-2.5.0/gems/activerecord-5.1.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:73:in `async_exec': PG::ObjectInUse: ERROR: database "my_app_test" is being accessed by other users (ActiveRecord::StatementInvalid)
DETAIL: There is 1 other session using the database.
: DROP DATABASE IF EXISTS "my_app_test"

from dokku-postgres.

josegonzalez avatar josegonzalez commented on July 30, 2024

@arielscherman this isn't a Dokku-related issue, but something to do with your application running. Rails keeps a persistent connection. You'll need to scale your app down if you want to drop the database it seems.

A simple google of your error (without referencing your database name) resulted in the following: https://stackoverflow.com/questions/2369744/rails-postgres-drop-error-database-is-being-accessed-by-other-users

Also, please avoid commenting on 2+ year old issues. It notifies folks who may no longer even be using the project. In the future, please open a new issue instead and reference this one.

from dokku-postgres.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.