Re: BUG #5044: error: message type 0x5a arrived from server while idle

Lists: pgsql-bugs
From: "vyouzhi" <vyouzhi(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #5044: error: message type 0x5a arrived from server while idle
Date: 2009-09-09 03:44:38
Message-ID: 200909090344.n893icow085814@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 5044
Logged by: vyouzhi
Email address: vyouzhi(at)gmail(dot)com
PostgreSQL version: 8.4.0
Operating system: linux 2.6.25
Description: error: message type 0x5a arrived from server while idle
Details:

hi all:

i use Python and PyGreSQL to link PostgreSQL
but the Python give me the error

the error here :
--------------------------------------------
...
95
93
95
97
94
96
94
message type 0x43 arrived from server while idle
message type 0x5a arrived from server while idle
INSERT INTO code (stock_name ,stock_code)values('bbbbb','bbbbb')

95
93
92
93
99
--------------------------------------------

and the PostgreSQL log error like here

-------------------------------------------
...
LOG: unexpected EOF on client connection
...
------------------------------------------

me python code_me.py

--------------------------------------------
#!/usr/bin/env python
#coding=utf-8
import _pg
import threading

con =
_pg.connect(host='127.0.0.1',user='work',dbname='work',passwd='123',port=543
2)

def link_url():
global con
for i in range(100):
print i
stock_sql = "INSERT INTO code (stock_name
,stock_code)values('bbbbb','bbbbb')"
try:
con.query(stock_sql)
except:
print stock_sql

if __name__=='__main__':
for i in range(0,32):
print i
i = threading.Thread(target = link_url)
i.start()

-----------------------------------------------

who can help me ? thanks


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: vyouzhi <vyouzhi(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5044: error: message type 0x5a arrived from server while idle
Date: 2009-09-09 11:49:49
Message-ID: 20090909114949.GB4132@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

vyouzhi escribió:

> #!/usr/bin/env python
> #coding=utf-8
> import _pg
> import threading
>
> con =
> _pg.connect(host='127.0.0.1',user='work',dbname='work',passwd='123',port=543
> 2)
>
> def link_url():
> global con
> for i in range(100):
> print i
> stock_sql = "INSERT INTO code (stock_name
> ,stock_code)values('bbbbb','bbbbb')"
> try:
> con.query(stock_sql)
> except:
> print stock_sql
>
> if __name__=='__main__':
> for i in range(0,32):
> print i
> i = threading.Thread(target = link_url)
> i.start()
>
> -----------------------------------------------

Not a bug. Using a connection from more than one thread is not allowed.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support