Subject: Re: pkg/28729: PostgreSQL consumes 100% CPU after brief heavy loading
To: None <recht@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org>
From: Bob Kemp <bsd@allegory.demon.co.uk>
List: pkgsrc-bugs
Date: 01/23/2005 14:44:01
The following reply was made to PR pkg/28729; it has been noted by GNATS.

From: Bob Kemp <bsd@allegory.demon.co.uk>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/28729: PostgreSQL consumes 100% CPU after brief heavy loading
Date: Sun, 23 Jan 2005 14:43:10 +0000

 Hi,
 I ran some tests using the script below and the bug seems to appear after
 changes on the 18th Dec by jlam.  For me, 2004-12-18 works but 2004-12-19 doesn't.
 Of course, the changes might have just triggered an existing bug.
 
 If anybody wants to double check, the test script will need local customisation.
 See especially MyCommand(), getDate() and pkgclean.
 
 There is also a discussion on port-i386 (and was on netbsd-help) about this bug.
 
 Bob
 
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 #!/bin/ksh
 
 MyCommand() {
     psql -d MyDbase -U MyUser \
 	-c "
 	    select dDate,dOpen,dHigh,dLow,dClose,dVolume
 	    from amex_prices_daily
 	    where stockId = ( SELECT stockId FROM symbols natural join
 				exchanges WHERE ticker = 'qqqq' and exchange = 'amex' )
 	    order by dDate
 	" > /dev/null &
 
 }
 
 getDate() {
     cd /usr/pkgsrc
     root=:pserver:anoncvs@anoncvs.fr.NetBSD.org:/pub/NetBSD-CVS 
 
     ## Quick tests
     ## cvs -d $root up -D $1 -Pd databases/*postgresql74* mk pkgtools
 
     ## Final tests
     cvs -d $root up -D $1 -Pd
 }
 
 pgsql() {
     /etc/rc.d/pgsql $1
 }
 
 deletePkgs() {
     pkg_delete $(echo $pkgs)
 }
 
 
 pkgs='
     postgresql74
     postgresql74-docs
     postgresql74-server
     postgresql74-client
     postgresql74-lib
 '
 
 date=2004-11-1			## OK
 date=2004-11-10			## OK
 date=2004-11-30			## OK
 date=2004-12-10			## OK
 date=2004-12-18			## OK
 ## date=2004-12-19			## FAILS
 
 
 echo ''
 echo Deleting pkgsrc work dirs
     ## From pkgsrc/pkgtools/pkgclean -- deletes all work dirs
 pkgclean
 ## If you don't have pkgclean, uncomment the following
 ## rm -rf /usr/pkgsrc/*/*/work
 
 echo ''
 echo Updating from CVS
 getDate $date
 
 echo ''
 pgsql stop
 deletePkgs
 
 echo ''
 echo Before building: pkgs are
 pkg_info | egrep -i postgresql
 echo '.'
 
 cd /usr/pkgsrc/databases/postgresql74
 make install >/dev/null
 
 echo ''
 echo After building: pkgs are
 pkg_info | egrep -i postgresql
 echo '.'
 
 pgsql start
 
 j=1
 while [[ $j -le 30 ]]; do
     MyCommand > /dev/null &
     j=$(( $j + 1 ))
 done
 
 ps t
 sleep 5
 print '\n\n'
 ps t