Comments (11)
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.
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.
Your rails app is probably still using it's connections?
from dokku-postgres.
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.
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.
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.
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.
word thankyou @josegonzalez - will report back 🍔
from dokku-postgres.
🔥 🐕
from dokku-postgres.
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.
@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)
- Connecting to the db remotely HOT 10
- Database not created on Ubuntu 20.04 ARM64 HOT 7
- Docker hostname is invalid HOT 13
- Postgres is constantly in restarting state HOT 6
- The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested HOT 4
- postgres:upgrade should not allow major version upgrade attempts HOT 1
- Uploads to Minio fail with 'connection closed' error HOT 6
- no JDBC url provided
- Read-only file system on postgres:create HOT 8
- Cannot export databases with hyphens HOT 7
- dokku postgres:export error HOT 6
- Table ownership all changed to "postgres" after restoring from dump HOT 2
- Question: How to encrypt traffic with SSL (self signed ok) HOT 1
- Cannot set data_directory with new postgres service HOT 3
- dokku-postgres fails to start on a fresh dokku installation using docker ( HOT 4
- pgvector for Vector Similarity Search HOT 2
- Bump to postgres 16 HOT 1
- Question: Best Practices for Configuring Health Checks on DB Backups HOT 3
- `destroy` and `unlink` disagree on whether or not a database is linked to an app HOT 2
- Postgresql configuration HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dokku-postgres.