Git Product home page Git Product logo

Comments (18)

CrazyPython avatar CrazyPython commented on July 29, 2024 2

@andrelramos You're "fixing it" by not using postgrespool anymore.

from django-postgrespool.

otanner avatar otanner commented on July 29, 2024 1

I ran into this problem also. I debugged the issue a little bit and I think the problem is using the Django's postgresql_psycopg2.base.DatabaseWrapper's is_usable() method.

If there is an error in the query a rollback is to be performed. Django-postgrespool's rollback method uses DatabaseWrapper class' is_usable() method to check if the connection is usable and the rollback can be performed. How ever, the is_usable() method is internally using "SELECT 1" to check if the connection is usable but after the query error "SELECT 1" cannot be executed (postgres prints "ERROR: current transaction is aborted, commands ignored until end of transaction block"), so in this case is_usable() always returns False. And that's the reason the django-postgrespool's rollback is never executed either, and autocommit is tried to set True even when the connection is actually still in a transaction.

This can be tested by removing is_usable() check from _rollback method in django-postgrespool's DatabaseWrapper class. After that you see the real error message.

To fix this we would need to change the way rollback is checking database connection status. Either by overriding the is_usable() method or changing rollback to use some other style.

from django-postgrespool.

TheJKFever avatar TheJKFever commented on July 29, 2024 1

@kennethreitz Does https://github.com/kennethreitz/django-postgrespool/pull/29 solve the issue? Our organization has disabled postgrespool because of this issue. It would be great if this solved it and we could merge this in. Thanks!

from django-postgrespool.

YAmikep avatar YAmikep commented on July 29, 2024

Is there still anybody maintaining this app?

from django-postgrespool.

admosity avatar admosity commented on July 29, 2024

Ran into the same problem. Been scratching my head for hours wondering what went wrong.

from django-postgrespool.

tbpalsulich avatar tbpalsulich commented on July 29, 2024

+1. Having the same issue when incorrectly attempting to create a model with a null field value.

from django-postgrespool.

mlynch avatar mlynch commented on July 29, 2024

@tpalsulich you nailed it. For anyone else having the same issuing when using django-postgrespool, this error is hiding a different DB error. For me, I had a table that had some NOT NULL constraints on it incorrectly, and that was bubbling up and causing this issue.

from django-postgrespool.

thewayiam avatar thewayiam commented on July 29, 2024

Same here, while insert duplicate
IntegrityError: duplicate key value violates unique constraint

from django-postgrespool.

grvhi avatar grvhi commented on July 29, 2024

+1 - also getting this issue, except that in my case, changing the db settings back to django.db.backends.postgresql_psycopg2 removes the error altogether (i.e. there is no underlying issue)

EDIT: Turns out that django_postgrespool seems to squash almost all DB-level exceptions and return this exception instead. Sadly, I don't have time right now to see if there's a fix.....

from django-postgrespool.

 avatar commented on July 29, 2024

It looks like the handling of IntegrityErrors is broken in django-postgrespool after Django 1.6. The symptoms match the descriptions above, and the DB connection ends up in a bad state. All queries after an IntegrityError fail.

However, since 1.6 has connection pooling built in, just don't use django-postgrespool.

from django-postgrespool.

brockhaywood avatar brockhaywood commented on July 29, 2024

+1

from django-postgrespool.

CrazyPython avatar CrazyPython commented on July 29, 2024

+1 Anybody still monitoring this?

from django-postgrespool.

kennygoff avatar kennygoff commented on July 29, 2024

+1 Bueller?

from django-postgrespool.

avorio avatar avorio commented on July 29, 2024

I just ran into the same issue right now which was solved by removing

DATABASES['default']['ENGINE'] = 'django_postgrespool'

from my settings.py file.

from django-postgrespool.

andrelramos avatar andrelramos commented on July 29, 2024

Ty avorio, solved my problem =D

from django-postgrespool.

kennethreitz avatar kennethreitz commented on July 29, 2024

If anyone sends a pull request that fixes this ( https://github.com/kennethreitz/django-postgrespool/issues/24#issuecomment-75400109 ), I will be more than happy to merge.

from django-postgrespool.

ewilazarus avatar ewilazarus commented on July 29, 2024

Bump

from django-postgrespool.

andrelramos avatar andrelramos commented on July 29, 2024

@CrazyPython sarcasm

from django-postgrespool.

Related Issues (17)

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.