'There is 1 other session using the database.'
See original GitHub issueWhen I run:
python manage.py behave
Django begins preparing for tests, but throws this error. behave-django
appears to be complaining about it’s own connection to the database (or Django is complaining about behave-django
s use of the database). Have any ideas what’s going on here?
Python 2.7 Django 1.9.8
Thanks.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
[Solved] PostgreSQL ERROR: There is 1 other session using ...
Quit all the applications connecting to the database. Step 2: Execute the following query from on PostgreSQL to terminate all active connections ...
Read more >PostgreSQL DROP Database DETAIL: There is 1 other ...
So the short answer is there is 1 active connection opened to target db, so it cannot delete the selected database until the...
Read more >Kill a postgresql session/connection - database - Stack Overflow
ERROR: database "database_name" is being accessed by other users DETAIL: There are 1 other session(s) using the database.
Read more >There is 1 other session using the database #327 - GitHub
This works LOCALLY fine when using RAILS_ENV=development but fails on the build server. The reason it fails on the build server is that...
Read more >there is 1 other session using the database - You.com | The AI ...
The solution for “There is 1 other session using the database, postgres” can be found here. The following code will assist you in...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I can’t remember if this is the solution to the problem I had when I originally commented on this issue, but I came across this issue again in my Googlin’ and this time I have a solution to a very similar issue…or maybe even the same issue.
Add
conn_max_age=0
to your database configuration in tests. I figured this out from this answer on SO.I decided to look into this issue after just dealing with it for what seems like years.
What happens is that the tests run fine, but fail to delete the test database because of the other session(s) using database error. If you run the tests again, django prompts you to delete the test database before continuing. This is how I’ve always just dealt with it in the past.
All of my regular Django tests work fine, it is only tests run with behave-django that exhibit this issue.
I’ll try and remember to come up with a minimal reproducing project soon.