Closed cielf closed 3 weeks ago
@cielf "Object in use" means there might be another process that's accessing the DB. I got that as well, but it was because I had the server running. Once I stopped it, the rake task seemed to work fine (albeit with a lot of errors reported, like usual). Did you try that?
I did a hard reboot, navigated to the directory, and ran it (just in case something in RubyMine was interfering)-- still got the ObjectInUse. It is strange.
The kill_postgres_connections tactic works with a little application of the accompanying comments. I can submit a second PR with that in place, unless it working tells you something!
Closing in favor of #4389 .
Description
fetch_latest_db started failing on the drop database after a recent upgrade, or possibly as a result of changes that were made to fix bin/setup after that upgrade -- though it is not failing for everyone, it is failing for the person who uses it the most!
Here is what was happening:
... Recreating databases... PG::ObjectInUse: ERROR: database "diaper_dev" is being accessed by other users DETAIL: There is 1 other session using the database. Couldn't drop database 'diaper_dev' bin/rails aborted! ActiveRecord::StatementInvalid: PG::ObjectInUse: ERROR: database "diaper_dev" is being accessed by other users (ActiveRecord::StatementInvalid) DETAIL: There is 1 other session using the database.
Caused by: PG::ObjectInUse: ERROR: database "diaper_dev" is being accessed by other users (PG::ObjectInUse) DETAIL: There is 1 other session using the database.
Tasks: TOP => db:drop:_unsafe (See full trace by running task with --trace)
We worked through the issue in the Sunday office hours. Removing the => :environment got by the initial issue, but we also had to split the password setup into its own rake. If there is a way to keep them in one task, that would be grand - but this at least allows it to be used.
A quick check of the project does not indicate any mention of fetch_latest_db, but we should check any external docs.
Type of change
How Has This Been Tested?
ran fetch_latest_db and rest_passwords on my local, then signed in. Seems ok.