assertion failure w/ valgrind

From: Neil Conway <neilc(at)samurai(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: assertion failure w/ valgrind
Date: 2004-09-15 11:49:15
Message-ID: 1095248955.4915.51.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I ran the postmaster under valgrind, and ran the regression tests ("make
installcheck") against it. Curiously, this resulted in an assertion
failure:

TRAP: FailedAssertion("!(lock->shared > 0)", File:
"/home/neilc/pgsql/src/backend/storage/lmgr/lwlock.c", Line: 443)

The error is pretty reproducible (it has occurred three times in a row,
with two different versions of valgrind; the first two times at
approximately the "create_index" regression test, the third time at
around the "cluster" test). One backtrace from the core file produced by
the assertion failure on the second run is:

#44 0x081b943f in LWLockRelease (lockid=LockMgrLock)
at /home/neilc/pgsql/src/backend/storage/lmgr/lwlock.c:444
#45 0x081a771d in FlushBuffer (buf=0x1bce1b28, reln=0x0)
at /home/neilc/pgsql/src/backend/storage/buffer/bufmgr.c:985
#46 0x081a7262 in BufferSync (percent=0, maxpages=466492200)
at /home/neilc/pgsql/src/backend/storage/buffer/bufmgr.c:756
#47 0x08191c92 in BackgroundWriterMain () at
/home/neilc/pgsql/src/backend/postmaster/bgwriter.c:375
#48 0x080ba7ef in BootstrapMain (argc=4, argv=0x52bfdfac)
at /home/neilc/pgsql/src/backend/bootstrap/bootstrap.c:433
#49 0x081917af in StartChildProcess (xlop=3) at
/home/neilc/pgsql/src/backend/postmaster/postmaster.c:3302
#50 0x0819007c in reaper (postgres_signal_arg=17)
at /home/neilc/pgsql/src/backend/postmaster/postmaster.c:2032

Another backtrace (from the third run):

#44 0x081b943f in LWLockRelease (lockid=BufMgrLock)
at /home/neilc/pgsql/src/backend/storage/lmgr/lwlock.c:444
#45 0x081a682c in BufferAlloc (reln=0x1b8ffdfc, blockNum=0,
foundPtr=0x52bfd45b "\001L÷Ã\033 ÷Ã\033X\006À\033\230Ô¿R¤z\b\bø")
at /home/neilc/pgsql/src/backend/storage/buffer/bufmgr.c:466
#46 0x081a6719 in ReadBufferInternal (reln=0x1bc000f8, blockNum=21,
bufferLockHeld=0 '\0')
at /home/neilc/pgsql/src/backend/storage/buffer/bufmgr.c:153
#47 0x08087aa4 in heap_release_fetch (relation=0x1bc000f8, snapshot=0x1,
tuple=0x1bc3f748,
userbuf=0x1bc3f760, keep_buf=1 '\001', pgstat_info=0x1bc3f784)
at /home/neilc/pgsql/src/backend/access/heap/heapam.c:927
#48 0x08090c2e in index_getnext (scan=0x1bc3f720,
direction=ForwardScanDirection)
at /home/neilc/pgsql/src/backend/access/index/indexam.c:524
#49 0x0808ffb4 in systable_getnext (sysscan=0x0) at
/home/neilc/pgsql/src/backend/access/index/genam.c:253
#50 0x080cc435 in isObjectPinned (object=0x1bc3db04, rel=0x0)
at /home/neilc/pgsql/src/backend/catalog/pg_depend.c:202
#51 0x080cc1cf in recordMultipleDependencies (depender=0x52bfd680,
referenced=0x52bfd670, nreferenced=1,
behavior=DEPENDENCY_NORMAL) at
/home/neilc/pgsql/src/backend/catalog/pg_depend.c:86
#52 0x080cc148 in recordDependencyOn (depender=0x0, referenced=0x0,
behavior=0)
at /home/neilc/pgsql/src/backend/catalog/pg_depend.c:42
#53 0x080c210c in index_create (heapRelationId=366057,
indexRelationName=0x1bc3cf30 "clstr_tst_s_pkey",
indexInfo=0x1bc3d70c, accessMethodObjectId=0, tableSpaceId=0,
classObjectId=0x1bc3db20,
primary=1 '\001', isconstraint=1 '\001', allow_system_table_mods=0
'\0', skip_build=0 '\0')
at /home/neilc/pgsql/src/backend/catalog/index.c:691
#54 0x0810bb84 in DefineIndex (heapRelation=0x1bc3db20,
indexRelationName=0x1bc3cf30 "clstr_tst_s_pkey",
accessMethodName=0x8256287 "btree", tableSpaceName=0x1bc3d70c "\n",
attributeList=0x1bbef93c,
predicate=0x0, rangetable=0x0, unique=1 '\001', primary=1 '\001',
isconstraint=1 '\001',
is_alter_table=0 '\0', check_rights=1 '\001', skip_build=0 '\0',
quiet=0 '\0')
at /home/neilc/pgsql/src/backend/commands/indexcmds.c:368
#55 0x081c3fc4 in ProcessUtility (parsetree=0x1bbef354, params=0x0,
dest=0x1bbeee84, completionTag=0x0)
at /home/neilc/pgsql/src/backend/tcop/utility.c:720
#56 0x081c298c in PortalRunUtility (portal=0x1bbf2d64, query=0x1bbef5c4,
dest=0x1bbeee84,
completionTag=0x52bfd940 "CREATE TABLE") at
/home/neilc/pgsql/src/backend/tcop/pquery.c:913

I started valgrind like so: valgrind --leak-check=yes
--log-file=/tmp/pg-valgrind --suppressions=/home/neilc/pg-suppressions
--trace-children=yes postmaster (I've seen this using both valgrind
2.1.2 and 2.2.0, glibc 2.3.2, gcc 3.3.4).

I'm happy to write this off as a valgrind bug and not worry about it
further, but I thought I should post it here in case anyone thinks this
might be exposing a legitimate problem.

-Neil

Browse pgsql-hackers by date

  From Date Subject
Next Message Merlin Moncure 2004-09-15 12:48:58 Re: libpq and prepared statements progress for 8.0
Previous Message Michael Paesold 2004-09-15 11:06:25 Re: Rollback on Error