php/postgres persistent connections fail

From: Date: Mon, 31 Jul 2000 18:09:28 +0000
Subject: php/postgres persistent connections fail
Groups: php.db 
Request: Send a blank email to php-db+get-1646@lists.php.net to get a copy of this message
Hi! I am experiencing a very strange error usign this combination: FreeBSD 4.0-STABLE postgres 7.0.2 apache 1.3.12 php 4.0.1p2 Here's the problem: PHP's pg_pconnect (persistent connect) will not keep the connection open. What happens is, that after executing the page just fine, upon pg_close (I guess), something happens and I get this (when running postgres with -d 2): ProcessQuery CommitTransactionCommand pq_recvbuf: unexpected EOF on client connection proc_exit(0) shmem_exit(0) exit(0) /usr/local/pgsql/bin/postmaster: reaping dead processes... /usr/local/pgsql/bin/postmaster: CleanupProc: pid 32628 exited with status 0 ... What happens here is, that the connection gets broken. Hence, next time I try to connect to the same "persistent" connection (i.e. next time i hit the same apache process from the process pool) it fails, spitting this to the apache error log: [Mon Jul 31 19:24:26 2000] [error] PHP Warning: PostgreSQL query failed: pqReadData() -- read() failed: errno=9 Bad file descriptor in /usr/local/www/www.sssf.se/data/internt/matrikel/foo.php on line 20 What is happening here? I have ran tcpdump to try to see what is going on between apache and postgres. I've attached two dumps, one on the failing system, which will lead to the "pq_recvbuf: unexpected EOF on client connection", and antoher dump, doing exactly the same thing on another machine. The machines both have php 4.0.1p2 and apache 1.3.12. Both run FreeBSD. The failing machine has a slightly newer version of the FreeBSD system, but both are 4.0-STABLE. uname -a: FreeBSD bastuba.partitur.se 4.0-STABLE FreeBSD 4.0-STABLE #0: Sat Jul 1 15:56:11 CEST 2000 girgen@tuba.partitur.se:/usr/local/obj/usr/src/sys/TUBA i386 FreeBSD elbas.partitur.se 4.0-STABLE FreeBSD 4.0-STABLE #0: Wed Jun 14 20:55:20 CEST 2000 girgen@tb303.partitur.se:/usr/obj/usr/src/sys/WORKSTATION i386 The two files attached show tcpdumps of the communication between apache(php) and postgres. The failing machine is bastuba while elbas is OK. Same php program, of course. This might well be a configuration error. The bastuba is runs around 50 virtual hosts (but not many use php), elbas is a simple workstation running only a test setup. The problem is finding the config error, in one exists, since I can't really tamper too much with the bastuba setup, and I can't reporduce the error elsewhere. php.ini files are identical, as are phpinfo() outputs. I'm out of ideas. Best regards, Palle Girgensohn Partitur

« previous php.db (#1646) next »