Re: [BUGS] BUG #5412: test case produced, possible race condition.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Rusty Conover <rconover(at)infogears(dot)com>
Cc: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [BUGS] BUG #5412: test case produced, possible race condition.
Date: 2010-04-14 21:24:14
Message-ID: 14745.1271280254@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Rusty Conover <rconover(at)infogears(dot)com> writes:
> [ same stack trace for the simplified test case ]

Ah, got it finally. There *is* a relcache flush happening during INSERT
in the 8.4 code, because of FSM extension:

(gdb) bt
#0 RegisterRelcacheInvalidation (dbId=40264, relId=848094) at inval.c:439
#1 0x000000000067a30d in CacheInvalidateRelcache (relation=0x7f39b88403f0)
at inval.c:1141
#2 0x00000000005c9c45 in fsm_extend (fsm_nblocks=<value optimized out>,
rel=<value optimized out>) at freespace.c:589
#3 fsm_readbuf (fsm_nblocks=<value optimized out>, rel=<value optimized out>)
at freespace.c:522
#4 0x00000000005ca2e4 in fsm_set_and_search (rel=0x9d48,
addr=<value optimized out>, slot=0, newValue=220 '\334',
minValue=200 '\310') at freespace.c:608
#5 0x00000000005ca675 in RecordAndGetPageWithFreeSpace (rel=0x7f39b88403f0,
oldPage=<value optimized out>, oldSpaceAvail=<value optimized out>,
spaceNeeded=<value optimized out>) at freespace.c:163
#6 0x0000000000464149 in RelationGetBufferForTuple (relation=0x7f39b88403f0,
len=<value optimized out>, otherBuffer=0, options=<value optimized out>,
bistate=<value optimized out>) at hio.c:303
#7 0x0000000000462e77 in heap_insert (relation=0x7f39b88403f0, tup=0x14aa580,
cid=<value optimized out>, options=0, bistate=0x0) at heapam.c:1890

This code path doesn't exist in CVS HEAD, which means (I think) that the
given test case can't fail in HEAD. I think I got myself confused by
experimenting variously with HEAD and 8.4 in regular and
CLOBBER_CACHE_ALWAYS modes --- only one of those four combinations will
exhibit a failure with this test case.

Although the particular case apparently can't arise in HEAD, I'm going
to apply Heikki's patch there anyway, since there's clearly a risk of
related problems.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2010-04-14 21:37:39 Re: [BUGS] BUG #5412: test case produced, possible race condition.
Previous Message Rusty Conover 2010-04-14 20:07:28 Re: [BUGS] BUG #5412: test case produced, possible race condition.

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2010-04-14 21:36:32 Re: gist README typo
Previous Message Robert Haas 2010-04-14 20:28:44 Re: Thoughts on pg_hba.conf rejection