asyncpg: Fetching from pgpool-II hangs indefinitely

  • asyncpg version: 0.20.1
  • PostgreSQL version: 12.2
  • Do you use a PostgreSQL SaaS? If so, which? Can you reproduce the issue with a local PostgreSQL install?: No.
  • Python version: Python 3.7.7 (default, Apr 23 2020, 14:43:26)
  • Platform: [GCC 8.3.0] on linux
  • Do you use pgbouncer?: No, I use pgpool-II 4.1.1
  • Did you install asyncpg with pip?: No, with poetry
  • If you built asyncpg locally, which version of Cython did you use?: No
  • Can the issue be reproduced under both asyncio and uvloop?: Yes

When querying the database through pgpool-II it hangs indefinitely, without raising any kind of exception. Connecting to database seems to be working, since for instance invalid password raises an exception:

asyncpg.exceptions.InternalServerError: md5 authentication failed
DETAIL:  password does not match

Steps to reproduce:

import asyncio
import asyncpg

async def run():
    conn = await asyncpg.connect(user='user', password='password',
                                 database='database', host='127.0.0.1') # connect to pgpool-II
    values = await conn.fetch('''SELECT 1''') # hangs here indefinitely
    await conn.close()

loop = asyncio.get_event_loop()
loop.run_until_complete(run())

When connecting to the PostgreSQL directly, the example above works flawlessly.

Log from pgpool-II:

May 13 20:56:00 pg01 pgpool[11982]: 2020-05-13 20:56:00: pid 13189: ERROR:  unable to read data from frontend
May 13 20:56:00 pg01 pgpool[11982]: 2020-05-13 20:56:00: pid 13189: DETAIL:  EOF encountered with frontend

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Comments: 34 (5 by maintainers)

Most upvoted comments

I have been exchanging with the pgpool devs and it appears we have a fix that will be part of 4.2.3

https://git.postgresql.org/gitweb/?p=pgpool2.git;a=commit;h=743a69b92d99020e3d1e479ad553a05c68b3b3cd

There may be other issues but this is a great start!

I can confirm the same - Using K8S with PG Pool and bitanmi charts.

Yes, it appears the extended query protocol is completely broken with PgPool somehow.

working with PGPool-II is not something high on the priority list

I don’t use PGPool personally, so if anyone needs this sorted out, feel free to investigate and contribute fixes (either here, or to PGPool, which is a more likely culprit here).

@damjankuznar lol, that’s weird. I just came here to report this issue too after realising where the problem probably was: https://github.com/bitnami/charts/issues/2568