NetBSD Problem Report #28729

From bsd@allegory.demon.co.uk  Tue Dec 21 01:27:59 2004
Return-Path: <bsd@allegory.demon.co.uk>
Received: from allegory.demon.co.uk (spr1-pool2-5-0-cust30.cosh.broadband.ntl.com [80.5.235.30])
	by narn.netbsd.org (Postfix) with ESMTP id 7CB2863B843
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 21 Dec 2004 01:27:58 +0000 (UTC)
Message-Id: <20041221012756.D3A634C90@allegory.demon.co.uk>
Date: Tue, 21 Dec 2004 01:27:56 +0000 (GMT)
From: bsd@allegory.demon.co.uk
Reply-To: bsd@allegory.demon.co.uk
To: gnats-bugs@netbsd.org
Subject: PostgreSQL consumes 100% CPU after brief heavy loading
X-Send-Pr-Version: 3.95

>Number:         28729
>Category:       pkg
>Synopsis:       PostgreSQL consumes 100% CPU after brief heavy loading
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    recht
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Dec 21 01:30:01 +0000 2004
>Closed-Date:    Fri Feb 04 01:57:31 +0000 2005
>Last-Modified:  Sat Feb 05 14:48:01 +0000 2005
>Originator:     Bob Kemp
>Release:        NetBSD 2.99.10
>Organization:

>Environment:


System: NetBSD tenebres.loc 2.99.10 NetBSD 2.99.10 (TENEBRES) #0: Sun Nov 28 01:08:29 GMT 2004 rob@tenebres.loc:/usr/src/sys/arch/i386/compile/TENEBRES i386
Architecture: i386
Machine: i386
>Description:

    I supped on Sunday (Dec 19th) and rebuilt my postgresql
    installation.  The new installation loops indefinitely after
    receiving brief high load and consumes all available CPU.  It seems to
    be triggered by having several simultaneous requests.

    On versions of postgresql built from pkgsrc as at 2004-11-1 all is fine.
    On versions built from pkgsrc as at 2004-12-19 it loops.
    These both seem to be derived from the same version of postgresql however.

    All new connections block and waiting a few minutes doesn't help.
    The only way to stop postgresql is to kill the process.
    It doesn't respond to "/etc/rc.d/pgsql stop" and doesn't touch the disk.

    Neither rebuilding indexes nor restoring a trusted dump fix it.

    If you have problems reproducing it, let me know.  I need to
    be able to use the dbase most of the time but should be able
    to swap between the package versions.

    You're welcome to the dbase schema but the tables contain proprietary data.
    The schema has a lot of foreign keys but isn't otherwise particularly odd, IMHO.

    NOTE:   In email messages, please retain the subject line or reply from
	    a netbsd.org address in order to avoid being entangled in my
	    spam filters.

>How-To-Repeat:

    The command

	repeat 20 sh -c "MyCommand >/dev/null&"

    will do it consistently where MyCommand is a shell script that calls the
    PostgreSQL "psql" command to do an SQL "select" of a table.

    With the older package version, even "repeat 50" causes only a minor blip.
    With the current version, "repeat 20" is enough to (literally) put postgresql
    in a permanent spin.

>Fix:

    cd /usr/pkgsrc/databases
    cvs up -D 2004-11-1

    Not a very good long-term solution but it works for me :-)

>Release-Note:

>Audit-Trail:
From: Ben Collver <ben@NetBSD.org>
To: bsd@allegory.demon.co.uk
Cc: gnats-bugs@netbsd.org
Subject: Re: pkg/28729: PostgreSQL consumes 100% CPU after brief heavy loading
Date: Tue, 21 Dec 2004 05:48:10 -0800

 Is this databases/postgresql73 or databases/postgresql74?

 Ben

From: Bob Kemp <bsd@allegory.demon.co.uk>
To: Ben Collver <ben@NetBSD.org>
Cc: gnats-bugs@netbsd.org
Subject: Re: pkg/28729: PostgreSQL consumes 100% CPU after brief heavy loading
Date: Wed, 22 Dec 2004 23:33:05 +0000

 On Tue, Dec 21, 2004 at 05:48:10AM -0800, Ben Collver wrote:
 > Is this databases/postgresql73 or databases/postgresql74?
 > 
 > Ben

 Hi,
 Sorry for the delay in replying.
 The answer to your qn is

     databases/postgresql74

 I upgraded from 73 some time ago and everything was fine.

 After rolling back, via my "fix", the pkgs now installed are

     jdbc-postgresql-7.4.6	    	Pure Java JDBC driver for PostgreSQL 7.4.x
     postgresql74-7.4.6              	Robust, next generation, object-relational DBMS
     postgresql74-client-7.4.6		PostgreSQL database client programs
     postgresql74-contrib-7.4.6		PostgreSQL database contrib programs
     postgresql74-docs-7.4.6	    	PostgreSQL database system documentation
     postgresql74-lib-7.4.6	    	PostgreSQL database headers and libraries
     postgresql74-server-7.4.6		PostgreSQL database server programs

 as they were from pkgsrc dated 2004-11-01 and these work just fine.
 The versions installed by the current pkgsrc cause the bug.

 If you have problems recreating the bug, I'd be happy to try to create
 a small test dbase to show the problem.

 Cheers,

 Bob

Responsible-Changed-From-To: pkg-manager->recht
Responsible-Changed-By: ben@netbsd.org
Responsible-Changed-When: Wed, 22 Dec 2004 23:43:43 +0000
Responsible-Changed-Why:
Assigned to package maintainer, recht.


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


From: Jaromir Dolecek <jdolecek@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: PR/28729 CVS commit: pkgsrc/databases/postgresql74-server
Date: Wed,  2 Feb 2005 08:15:09 +0000 (UTC)

 Module Name:	pkgsrc
 Committed By:	jdolecek
 Date:		Wed Feb  2 08:15:09 UTC 2005

 Modified Files:
 	pkgsrc/databases/postgresql74-server: Makefile

 Log Message:
 disable dlopen.buildlink - it causes postgresql looping

 fixes PR pkg/28729 by Bob Kemp


 To generate a diff of this commit:
 cvs rdiff -r1.9 -r1.10 pkgsrc/databases/postgresql74-server/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->feedback
State-Changed-By: jdolecek@netbsd.org
State-Changed-When: Wed, 02 Feb 2005 08:21:26 +0000
State-Changed-Why:
Please update pkgsrc/databases to most-up-to-date version, particularily
rev. 1.10 of databases/postgresql74-server/Makefile, and report if it
fixes the problem for you too.


From: Bob Kemp <bsd@allegory.demon.co.uk>
To: jdolecek@netbsd.org
Cc: recht@netbsd.org, pkgsrc-bugs@netbsd.org, gnats-admin@netbsd.org
Subject: Re: pkg/28729
Date: Thu, 3 Feb 2005 13:25:27 +0000

 On Wed, Feb 02, 2005 at 08:21:27AM +0000, jdolecek@netbsd.org wrote:
 > Synopsis: PostgreSQL consumes 100% CPU after brief heavy loading
 > 
 > State-Changed-From-To: open->feedback
 > State-Changed-By: jdolecek@netbsd.org
 > State-Changed-When: Wed, 02 Feb 2005 08:21:26 +0000
 > State-Changed-Why:
 > Please update pkgsrc/databases to most-up-to-date version, particularily
 > rev. 1.10 of databases/postgresql74-server/Makefile, and report if it
 > fixes the problem for you too.
 > 

 I have retrieved the latest versions by CVS, including version

     # $NetBSD: Makefile,v 1.11 2005/02/02 08:23:14 jdolecek Exp $

 of pkgsrc/databases/postgresql74-server/Makefile and reinstalled them.

 All seems well.  I have only briefly tested it but have nonetheless
 stressed it far more than was previously necessary to provoke the bug.

 You can close the PR.

 Thanks for your help!

 Bob

State-Changed-From-To: feedback->closed
State-Changed-By: wiz@netbsd.org
State-Changed-When: Fri, 04 Feb 2005 01:57:31 +0000
State-Changed-Why:
Submitter reports problem is fixed, thanks for the PR!


From: Jaromir Dolecek <jdolecek@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: PR/28729 CVS commit: pkgsrc/databases/postgresql73-server
Date: Sat,  5 Feb 2005 14:47:02 +0000 (UTC)

 Module Name:	pkgsrc
 Committed By:	jdolecek
 Date:		Sat Feb  5 14:47:02 UTC 2005

 Modified Files:
 	pkgsrc/databases/postgresql73-server: Makefile

 Log Message:
 disable inclusiong dlopen.bl3.mk (and hence link agains pthread), for
 same reasons as the postgresql74-server
 adresses PR pkg/28729


 To generate a diff of this commit:
 cvs rdiff -r1.7 -r1.8 pkgsrc/databases/postgresql73-server/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.