From owner-freebsd-isp Mon Jul 31 11: 9:27 2000 Delivered-To: freebsd-isp@freebsd.org Received: from elbas.partitur.se (elbas.partitur.se [193.219.246.222]) by hub.freebsd.org (Postfix) with ESMTP id 721CD37B9CA for ; Mon, 31 Jul 2000 11:09:10 -0700 (PDT) (envelope-from girgen@partitur.se) Received: from partitur.se (localhost.partitur.se [127.0.0.1]) by elbas.partitur.se (8.9.3/8.9.3) with ESMTP id UAA62866; Mon, 31 Jul 2000 20:09:28 +0200 (CEST) (envelope-from girgen@partitur.se) Message-ID: <3985C0D8.602224BC@partitur.se> Date: Mon, 31 Jul 2000 20:09:28 +0200 From: Palle Girgensohn Organization: Partitur X-Mailer: Mozilla 4.74 [en] (X11; U; FreeBSD 4.0-STABLE i386) X-Accept-Language: sv, en MIME-Version: 1.0 To: php-db@lists.php.net, freebsd-isp@freebsd.org, pgsql-admin@postgresql.org Subject: php/postgres persistent connections fail Content-Type: multipart/mixed; boundary="------------CDF7690A832A8CA70B1CC97B" Sender: owner-freebsd-isp@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org This is a multi-part message in MIME format. --------------CDF7690A832A8CA70B1CC97B Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 --------------CDF7690A832A8CA70B1CC97B Content-Type: text/plain; charset=us-ascii; name="bastuba-php-dump.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="bastuba-php-dump.txt" $ tcpdump -s 1532 -Xx -i lo0 tcp port 5432 ... 19:24:27.626723 localhost.4750 > localhost.5432: S 5242155:5242155(0) win 16384 (DF) 0x0000 4500 003c 3c53 4000 4006 0067 7f00 0001 E..< localhost.4750: S 5323579:5323579(0) ack 5242156 win 57344 (DF) 0x0000 4500 003c 3c54 4000 4006 0066 7f00 0001 E..< localhost.5432: . ack 1 win 57344 (DF) 0x0000 4500 0034 3c55 4000 4006 006d 7f00 0001 E..4 localhost.5432: P 1:297(296) ack 1 win 57344 (DF) 0x0000 4500 015c 3c56 4000 4006 ff43 7f00 0001 E..\ localhost.4750: P 1:6(5) ack 297 win 57344 (DF) 0x0000 4500 0039 3c57 4000 4006 0066 7f00 0001 E..9 localhost.4750: P 6:16(10) ack 297 win 57344 (DF) 0x0000 4500 003e 3c58 4000 4006 0060 7f00 0001 E..> localhost.5432: P 297:327(30) ack 16 win 57344 (DF) 0x0000 4500 0052 3c59 4000 4006 004b 7f00 0001 E..R localhost.4750: P 16:77(61) ack 327 win 57344 (DF) 0x0000 4500 0071 3c5a 4000 4006 002b 7f00 0001 E..q localhost.5432: P 327:386(59) ack 77 win 57344 (DF) 0x0000 4500 006f 3c70 4000 4006 0017 7f00 0001 E..o localhost.4750: P 77:128(51) ack 386 win 57344 (DF) 0x0000 4500 0067 3c7a 4000 4006 0015 7f00 0001 E..g localhost.5432: F 386:386(0) ack 128 win 57344 (DF) 0x0000 4500 0034 3c7b 4000 4006 0047 7f00 0001 E..4<{@.@..G.... 0x0010 7f00 0001 128e 1538 004f fead 0051 3bbb .......8.O...Q;. 0x0020 8011 e000 03e5 0000 0101 080a 0ee4 8a1e ................ 0x0030 0ee4 8a1e .... 19:24:27.769462 localhost.5432 > localhost.4750: . ack 387 win 57344 (DF) 0x0000 4500 0034 3c7c 4000 4006 0046 7f00 0001 E..4<|@.@..F.... 0x0010 7f00 0001 1538 128e 0051 3bbb 004f feae .....8...Q;..O.. 0x0020 8010 e000 03e5 0000 0101 080a 0ee4 8a1e ................ 0x0030 0ee4 8a1e .... 19:24:27.769691 localhost.5432 > localhost.4750: F 128:128(0) ack 387 win 57344 (DF) 0x0000 4500 0034 3c7d 4000 4006 0045 7f00 0001 E..4<}@.@..E.... 0x0010 7f00 0001 1538 128e 0051 3bbb 004f feae .....8...Q;..O.. 0x0020 8011 e000 03e4 0000 0101 080a 0ee4 8a1e ................ 0x0030 0ee4 8a1e .... 19:24:27.769746 localhost.4750 > localhost.5432: . ack 129 win 57344 (DF) 0x0000 4500 0034 3c7e 4000 4006 0044 7f00 0001 E..4<~@.@..D.... 0x0010 7f00 0001 128e 1538 004f feae 0051 3bbc .......8.O...Q;. 0x0020 8010 e000 03e4 0000 0101 080a 0ee4 8a1e ................ 0x0030 0ee4 8a1e .... --------------CDF7690A832A8CA70B1CC97B Content-Type: text/plain; charset=us-ascii; name="elbas-php-dump.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="elbas-php-dump.txt" $ tcpdump -s 1532 -Xx -i lo0 tcp port 5432 ... 19:23:06.691601 localhost.partitur.se.1903 > localhost.partitur.se.5432: S 3689158218:3689158218(0) win 16384 (DF) 0x0000 4500 002c 659b 4000 4006 d72e 7f00 0001 E..,e.@.@....... 0x0010 7f00 0001 076f 1538 dbe4 164a 0000 0000 .....o.8...J.... 0x0020 6002 4000 112a 0000 0204 3fd8 `.@..*....?. 19:23:06.691660 localhost.partitur.se.5432 > localhost.partitur.se.1903: S 3689275855:3689275855(0) ack 3689158219 win 57344 (DF) 0x0000 4500 002c 659c 4000 4006 d72d 7f00 0001 E..,e.@.@..-.... 0x0010 7f00 0001 1538 076f dbe5 e1cf dbe4 164b .....8.o.......K 0x0020 6012 e000 b362 0000 0204 3fd8 `....b....?. 19:23:06.691687 localhost.partitur.se.1903 > localhost.partitur.se.5432: . ack 1 win 57344 (DF) 0x0000 4500 0028 659d 4000 4006 d730 7f00 0001 E..(e.@.@..0.... 0x0010 7f00 0001 076f 1538 dbe4 164b dbe5 e1d0 .....o.8...K.... 0x0020 5010 e000 0544 0000 P....D.. 19:23:06.691961 localhost.partitur.se.1903 > localhost.partitur.se.5432: P 1:297(296) ack 1 win 57344 (DF) 0x0000 4500 0150 659e 4000 4006 d607 7f00 0001 E..Pe.@.@....... 0x0010 7f00 0001 076f 1538 dbe4 164b dbe5 e1d0 .....o.8...K.... 0x0020 5018 e000 e6b7 0000 0000 0128 0002 0000 P..........(.... 0x0030 7373 7366 0000 0000 0000 0000 0000 0000 sssf............ 0x0040 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0050 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0060 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0070 6e6f 626f 6479 0000 0000 0000 0000 0000 nobody.......... 0x0080 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0090 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x00a0 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x00b0 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x00c0 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x00d0 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x00e0 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x00f0 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0100 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0110 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0120 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0130 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0x0140 0000 0000 0000 0000 0000 0000 0000 0000 ................ 19:23:06.693384 localhost.partitur.se.5432 > localhost.partitur.se.1903: P 1:6(5) ack 297 win 57344 (DF) 0x0000 4500 002d 659f 4000 4006 d729 7f00 0001 E..-e.@.@..).... 0x0010 7f00 0001 1538 076f dbe5 e1d0 dbe4 1773 .....8.o.......s 0x0020 5018 e000 b20e 0000 5200 0000 00 P.......R.... 19:23:06.716696 localhost.partitur.se.5432 > localhost.partitur.se.1903: P 6:16(10) ack 297 win 57344 (DF) 0x0000 4500 0032 65a6 4000 4006 d71d 7f00 0001 E..2e.@.@....... 0x0010 7f00 0001 1538 076f dbe5 e1d5 dbe4 1773 .....8.o.......s 0x0020 5018 e000 29bc 0000 4b00 00f5 2d6c 4b8d P...)...K...-lK. 0x0030 155a .Z 19:23:06.716928 localhost.partitur.se.1903 > localhost.partitur.se.5432: P 297:327(30) ack 16 win 57344 (DF) 0x0000 4500 0046 65a7 4000 4006 d708 7f00 0001 E..Fe.@.@....... 0x0010 7f00 0001 076f 1538 dbe4 1773 dbe5 e1df .....o.8...s.... 0x0020 5018 e000 36ab 0000 5173 656c 6563 7420 P...6...Qselect. 0x0030 6765 7464 6174 6162 6173 6565 6e63 6f64 getdatabaseencod 0x0040 696e 6728 2900 ing(). 19:23:06.722171 localhost.partitur.se.5432 > localhost.partitur.se.1903: P 16:77(61) ack 327 win 57344 (DF) 0x0000 4500 0065 65a8 4000 4006 d6e8 7f00 0001 E..ee.@.@....... 0x0010 7f00 0001 1538 076f dbe5 e1df dbe4 1791 .....8.o........ 0x0020 5018 e000 1519 0000 5062 6c61 6e6b 0054 P.......Pblank.T 0x0030 0001 6765 7464 6174 6162 6173 6565 6e63 ..getdatabaseenc 0x0040 6f64 696e 6700 0000 0013 0020 ffff ffff oding........... 0x0050 4480 0000 000a 4c41 5449 4e31 4353 454c D.....LATIN1CSEL 0x0060 4543 5400 5a ECT.Z 19:23:06.796484 localhost.partitur.se.1903 > localhost.partitur.se.5432: P 327:386(59) ack 77 win 57344 (DF) 0x0000 4500 0063 65c2 4000 4006 d6d0 7f00 0001 E..ce.@.@....... 0x0010 7f00 0001 076f 1538 dbe4 1791 dbe5 e21c .....o.8........ 0x0020 5018 e000 3662 0000 5153 454c 4543 5420 P...6b..QSELECT. 0x0030 656e 616d 6e20 6672 6f6d 206d 6174 7269 enamn.from.matri 0x0040 6b65 6c20 7768 6572 6520 7573 6572 6964 kel.where.userid 0x0050 3d27 5061 756c 2047 6972 6765 6e73 6f68 ='Paul.Girgensoh 0x0060 6e27 00 n'. 19:23:06.813505 localhost.partitur.se.5432 > localhost.partitur.se.1903: P 77:128(51) ack 386 win 57344 (DF) 0x0000 4500 005b 65d1 4000 4006 d6c9 7f00 0001 E..[e.@.@....... 0x0010 7f00 0001 1538 076f dbe5 e21c dbe4 17cc .....8.o........ 0x0020 5018 e000 e733 0000 5062 6c61 6e6b 0054 P....3..Pblank.T 0x0030 0001 656e 616d 6e00 0000 0019 ffff ffff ..enamn......... 0x0040 ffff 4480 0000 000e 4769 7267 656e 736f ..D.....Girgenso 0x0050 686e 4353 454c 4543 5400 5a hnCSELECT.Z 19:23:06.908042 localhost.partitur.se.1903 > localhost.partitur.se.5432: . ack 128 win 57344 (DF) 0x0000 4500 0028 6625 4000 4006 d6a8 7f00 0001 E..(f%@.@....... 0x0010 7f00 0001 076f 1538 dbe4 17cc dbe5 e24f .....o.8.......O 0x0020 5010 e000 0344 0000 P....D.. --------------CDF7690A832A8CA70B1CC97B-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-isp" in the body of the message