View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0000057 | Pgpool-II | Bug | public | 2013-04-29 10:07 | 2013-04-29 16:44 |
| Reporter | Sergey | Assigned To | t-ishii | ||
| Priority | normal | Severity | block | Reproducibility | always |
| Status | assigned | Resolution | open | ||
| Platform | x86_64 | OS | 2.6.32.36 | OS Version | Ubuntu 10.04.4 L |
| Summary | 0000057: "cannot get parse message" error when using py-postgresql | ||||
| Description | Hello! I tried to connect to my pgpool-II 3.2.3 instance using py-postgresql library (it uses extended protocol) and failed with the following error: ------------------------------- >>> c = postgresql.open('pq://postgres:***@dev01:5434/hr') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/kb_iface/env/lib/python3.2/site-packages/postgresql/__init__.py", line 94, in open c.connect() File "/home/kb_iface/env/lib/python3.2/site-packages/postgresql/driver/pq3.py", line 2438, in connect self._establish() File "/home/kb_iface/env/lib/python3.2/site-packages/postgresql/driver/pq3.py", line 2578, in _establish sd = self.sys.startup_data() File "/home/kb_iface/env/lib/python3.2/site-packages/postgresql/lib/__init__.py", line 398, in __getattr__ bs = BoundSymbol(sym, db) File "/home/kb_iface/env/lib/python3.2/site-packages/postgresql/lib/__init__.py", line 288, in __init__ ps = database.prepare(symbol) File "/home/kb_iface/env/lib/python3.2/site-packages/postgresql/driver/pq3.py", line 2346, in prepare ps._fini() File "/home/kb_iface/env/lib/python3.2/site-packages/postgresql/driver/pq3.py", line 1454, in _fini self.database._pq_complete() File "/home/kb_iface/env/lib/python3.2/site-packages/postgresql/driver/pq3.py", line 2618, in _pq_complete self.typio.raise_error(x.error_message, cause = getattr(x, 'exception', None)) File "/home/kb_iface/env/lib/python3.2/site-packages/postgresql/driver/pq3.py", line 509, in raise_error self.raise_client_error(error_message, **kw) File "/home/kb_iface/env/lib/python3.2/site-packages/postgresql/driver/pq3.py", line 484, in raise_client_error raise client_error postgresql.exceptions.ConnectionFailureError: unexpected EOF from server CODE: 08006 LOCATION: CLIENT DETAIL: Zero-length read from the connection's socket. STATEMENT: [parsing] statement_id: py:0xcffa90 string: SYMBOL: startup_data source: SELECT pg_catalog.version()::text AS version, backend_start::text, client_addr::text, client_port::int FROM pg_catalog.pg_stat_activity WHERE pid = pg_catalog.pg_backend_pid() UNION ALL SELECT pg_catalog.version()::text AS version, NULL::text AS backend_start, NULL::text AS client_addr, NULL::int AS client_port LIMIT 1; LIBRARY: /home/kb_iface/env/lib/python3.2/site-packages/postgresql/lib/libsys.sql CONNECTION: [closed] CONNECTOR: [Host] pq://postgres:***@dev01:5434/hr category: None DRIVER: postgresql.driver.pq3.Driver ------------------------------------------- Corresponding log from pgpool contains "Close: cannot get parse message", which lead me to this bugreport http://www.sraoss.jp/pipermail/pgpool-general/2012-August/000898.html I looked through 3.2.3 code, and it seems that patch, that should have fixed this is there http://git.postgresql.org/gitweb/?p=pgpool2.git;a=commitdiff;h=479e9d1416ff0294519e9155084bc1d60c75c850;hp=8af289e6d02ce29f0f5d0ca04dee6992a2cb258d But error stil reproduces. Pgpool log with debugging enabled is in attached file. | ||||
| Steps To Reproduce | #Start pgpool2, port=5434 #install py-postgresql: $ pip install py-postgresql #Fire up python3 $ python3 #input pyhton code: >>> import postgresql >>> c = postgresql.open('pq://postgres:pass@dev01:5434/hr') #Error! | ||||
| Additional Information | Meanwhile psycopg2 based python app connects and works successfuly, psql and other tools connect and work too. If I change connection string to postgresql.open('pq://postgres:***@localhost:5432/hr') to connect to postgresql directly - all works perfectly. I use py-postgresql 1.1.0, python 3.2.3, pgpool 3.2.3, postgresql 9.2.4 I have 2 postgres instances in streaming replication and pgpool2 configured for load balancing - it works ok if I try from psql or pgadmin. | ||||
| Tags | No tags attached. | ||||
|
|
|
|
|
It seems py-postgresql has a bad habit to send "Close" message for non-existing prepared statements. To fix this, we need to robotize pgpool-II to not error out in this case. As far as I know, py-postgresql is the only PostgreSQL API which behaves like that. If I have spare time, I could robotize pgpool-II. |