tags:

views:

1838

answers:

5

Hi,

I have very strange problem with my application, upon occasions I get following error when connecting to postgres. This happens without any pattern, often happens when I run some extensive selenium tests.

Warning: pg_connect() [function.pg-connect]: Unable to connect to PostgreSQL server: server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request.

Postgres logs shows no abnormalities, also other applications that run on same postgres instance have no problems at all.

My Postgres is 8.2.9, running on windows 2008 server

Any hints ?

A: 

A random guess. Do you use persistent connections?

Ivan Krechetov
Problem seems to be random ;), I use 'pg_connect', not pg_pconnect so I belive connection is not persistent
CountZero
What's the connection timeout set to? Are your requests longer-running operations than the apps that have no problems?
duffymo
My requests are no different to other application's request, standard web page requests. As for connection timeout I dont set it explicitly. I looked in postgres conf file and see no timeout settings there, not sure where to look for it
CountZero
+1  A: 

"server closed the connection unexpectedly" most of the time means the backend crashed. If that's the case there should be some lines about it in the server log.

And by the way the latest version in the 8.2 branch is 8.2.12. Upgrade, test, report.

Milen A. Radev
Server's not crashing. It runs another applications and they don't report crashes, logs are also clean. I'm absolutely clueless.
CountZero
A: 

Has this issue been resolved? If so, what was the fix?

I am receiving the exact same error, and it also seems to be occurring randomly.

DB: PostgreSQL 8.3.7 OS: Windows Vista Home Premium

A: 

Yes, I do have the same problem. Don't really know where to look.

I have vista Ultimate edition

Alexandre
A: 

You're only showing the client error. Since it means that something happened on the backend, you will need to look in your server logs for information about what actually happened. (The postgres logs and/or the eventlog - check both)

A typical reason for these things to happen is if you are running some antivirus software on the server. If you do, try uninstalling it (not just disabling it) and see if the problem goes away.

Magnus Hagander