pgbouncer error in test suite, psycopg went psycotic

Bug #900702 reported by Andreas Hasenack
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Storm
Fix Released
Medium
Gavin Panella
psycopg
New
Undecided
Unassigned

Bug Description

I'm getting this error in the storm test suite in oneiric, using python 2.6:

======================================================================
ERROR: test_pgbouncer_stopped (tests.databases.postgres.PostgresDisconnectionTestWithPGBouncer)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/andreas/canonical/source/storm/trunk/tests/mocker.py", line 102, in test_method_wrapper
    result = test_method()
  File "/home/andreas/canonical/source/storm/trunk/tests/databases/postgres.py", line 667, in test_pgbouncer_stopped
    "SELECT current_database()")
  File "/usr/lib/python2.6/unittest.py", line 336, in failUnlessRaises
    callableObj(*args, **kwargs)
  File "/home/andreas/canonical/source/storm/trunk/storm/databases/postgres.py", line 261, in execute
    return Connection.execute(self, statement, params, noresult)
  File "/home/andreas/canonical/source/storm/trunk/storm/database.py", line 238, in execute
    raw_cursor = self.raw_execute(statement, params)
  File "/home/andreas/canonical/source/storm/trunk/storm/databases/postgres.py", line 271, in raw_execute
    return Connection.raw_execute(self, statement, params)
  File "/home/andreas/canonical/source/storm/trunk/storm/database.py", line 322, in raw_execute
    self._check_disconnect(raw_cursor.execute, *args)
  File "/home/andreas/canonical/source/storm/trunk/storm/database.py", line 371, in _check_disconnect
    return function(*args, **kwargs)
Error: psycopg went psycotic without error set

Related branches

Gavin Panella (allenap)
Changed in storm:
status: New → Triaged
importance: Undecided → Medium
assignee: nobody → Gavin Panella (allenap)
Revision history for this message
Gavin Panella (allenap) wrote :

On Oneric I can reproduce this with psycopg2 2.4.1 and 2.4.2. Versions
2.0.14 and 2.2.2 are okay.

I tracked down the problem once before using a debug build of psycopg2
2.4.2 [1]. The problem lies in pg_raise in psycopg/pqpath.c:

    if (pgres) {
        err = PQresultErrorMessage(pgres);

PQresultErrorMessage() is returning an empty string. This appears to
be a problem in psycopg2 then. I will forward this upstream. In the
meantime I will add a skip to that test when psygopg2 is >= 2.4 and <=
2.4.2.

[1] https://code.launchpad.net/~allenap/storm/django-disconnection-errors/+merge/80717

Revision history for this message
Gavin Panella (allenap) wrote :
Gavin Panella (allenap)
description: updated
Gavin Panella (allenap)
Changed in storm:
status: Triaged → Fix Committed
milestone: none → 0.20
Revision history for this message
Daniele Varrazzo (daniele-varrazzo) wrote :

Hi Gavin,

thank you for the report: I've tried to get some feedback on the psycopg tracker but got no answer.

However, looking at storm code, I see you were expecting a DatabaseError in case of disconnection, which is the usual fallback error. We'd started intercepting the empty pgres string and avoid to go further to avoid a system error downstream (commit f1d69f6d). However the fallback error raised has type Error instead of DatabaseError, and this caused your bug).

I've fixed the code to raise DatabaseError instead of Error in the case triggered by your test case, which is consistent with the other fallback cases. It will be released in version 2.4.4, that should happen very soon I think. So if you could quickly test the devel branch from my repos (https://github.com/dvarrazzo/psycopg) it would be great.

Cheers

Changed in storm:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.