question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'There is 1 other session using the database.'

See original GitHub issue

When 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-djangos use of the database). Have any ideas what’s going on here?

Python 2.7 Django 1.9.8

Thanks.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
dmwyattcommented, Jul 25, 2019

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.

2reactions
dmwyattcommented, Dec 18, 2018

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.

  • Django 2.1.4
  • behave-django 1.1.0
  • PostgreSQL 10.1

I’ll try and remember to come up with a minimal reproducing project soon.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found