pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #6249: Segmentation fault in VirtualXactLock()
3+ messages / 2 participants
[nested] [flat]

* BUG #6249: Segmentation fault in VirtualXactLock()
@ 2011-10-11 01:44 Fujii Masao <masao.fujii@gmail.com>
  2011-10-11 07:14 ` Re: BUG #6249: Segmentation fault in VirtualXactLock() Fujii Masao <masao.fujii@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Fujii Masao @ 2011-10-11 01:44 UTC (permalink / raw)
  To: pgsql-bugs


The following bug has been logged online:

Bug reference:      6249
Logged by:          Fujii Masao
Email address:      masao.fujii@gmail.com
PostgreSQL version: 9.2dev
Operating system:   Linux hermes 2.6.38-11-generic #50-Ubuntu SMP Mon Sep 12
21:18:14 UTC 2011 i686 i686 i386 GNU/Linux
Description:        Segmentation fault in VirtualXactLock()
Details: 

When I built Streaming Replication and Hot Standby environment, set
max_standby_streaming_delay to 1s and ran the following shell script which
creates the conflict between read-only query and recovery, SEGV occurred on
the standby.

----------------------
#!/bin/sh

# Master's port: 5432
# Standby's port: 9999

psql -c "CREATE TABLE tbl (id int)" -p 5432
psql -c "INSERT INTO tbl VALUES(1)" -p 5432

sleep 1

psql -c "SELECT pg_sleep(60) FROM tbl" -p 9999 &

sleep 1

psql -c "DELETE FROM tbl" -p 5432
psql -c "VACUUM tbl" -p 5432
----------------------

backtrace is:
Core was generated by `postgres: startup process   recovering 000000'.
Program terminated with signal 11, Segmentation fault.
#0  0x083114db in VirtualXactLock ()
(gdb) bt
#0  0x083114db in VirtualXactLock ()
#1  0x083072d1 in ResolveRecoveryConflictWithVirtualXIDs ()
#2  0x08307355 in ResolveRecoveryConflictWithSnapshot ()
#3  0x080b8abc in heap_xlog_clean ()
#4  0x080bc31a in heap2_redo ()
#5  0x080f02fd in StartupXLOG ()
#6  0x080f6c70 in StartupProcessMain ()
#7  0x0811d5f9 in AuxiliaryProcessMain ()
#8  0x082d17e4 in StartChildProcess ()
#9  0x082cd151 in PostmasterMain ()
#10 0x0824d6b4 in main ()

I was not able to reproduce this issue on 9.1.1. So the bug would exist only
on 9.2dev.



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #6249: Segmentation fault in VirtualXactLock()
  2011-10-11 01:44 BUG #6249: Segmentation fault in VirtualXactLock() Fujii Masao <masao.fujii@gmail.com>
@ 2011-10-11 07:14 ` Fujii Masao <masao.fujii@gmail.com>
  2011-10-11 11:40   ` Re: BUG #6249: Segmentation fault in VirtualXactLock() Robert Haas <robertmhaas@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Fujii Masao @ 2011-10-11 07:14 UTC (permalink / raw)
  To: pgsql-bugs

On Tue, Oct 11, 2011 at 10:44 AM, Fujii Masao <masao.fujii@gmail.com> wrote:
> When I built Streaming Replication and Hot Standby environment, set
> max_standby_streaming_delay to 1s and ran the following shell script which
> creates the conflict between read-only query and recovery, SEGV occurred on
> the standby.

In my investigation, the cause is that VirtualXactLock() doesn't
handle correctly
the case where BackendIdGetProc() returns NULL when the target backend has
already ended. Attached patch will fix this issue.

Regards,

-- 
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

Attachments:

fix_segv_virtualxactlock_v1.patch (text/x-patch, 461B) download diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c index a1ce5d8..905502f 100644 --- a/src/backend/storage/lmgr/lock.c +++ b/src/backend/storage/lmgr/lock.c @@ -3675,6 +3675,8 @@ VirtualXactLock(VirtualTransactionId vxid, bool wait) * it's no longer running anywhere. */ proc = BackendIdGetProc(vxid.backendId); + if (proc == NULL) + return true; /* * We must acquire this lock before checking the backendId and lxid
^ permalink raw reply [nested|flat] 3+ messages in thread

* Re: BUG #6249: Segmentation fault in VirtualXactLock()
  2011-10-11 01:44 BUG #6249: Segmentation fault in VirtualXactLock() Fujii Masao <masao.fujii@gmail.com>
  2011-10-11 07:14 ` Re: BUG #6249: Segmentation fault in VirtualXactLock() Fujii Masao <masao.fujii@gmail.com>
@ 2011-10-11 11:40   ` Robert Haas <robertmhaas@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Robert Haas @ 2011-10-11 11:40 UTC (permalink / raw)
  To: Fujii Masao <masao.fujii@gmail.com>; +Cc: pgsql-bugs

On Tue, Oct 11, 2011 at 3:14 AM, Fujii Masao <masao.fujii@gmail.com> wrote:
> On Tue, Oct 11, 2011 at 10:44 AM, Fujii Masao <masao.fujii@gmail.com> wrote:
>> When I built Streaming Replication and Hot Standby environment, set
>> max_standby_streaming_delay to 1s and ran the following shell script which
>> creates the conflict between read-only query and recovery, SEGV occurred on
>> the standby.
>
> In my investigation, the cause is that VirtualXactLock() doesn't
> handle correctly
> the case where BackendIdGetProc() returns NULL when the target backend has
> already ended. Attached patch will fix this issue.

Thanks, committed.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2011-10-11 11:40 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-10-11 01:44 BUG #6249: Segmentation fault in VirtualXactLock() Fujii Masao <masao.fujii@gmail.com>
2011-10-11 07:14 ` Fujii Masao <masao.fujii@gmail.com>
2011-10-11 11:40   ` Robert Haas <robertmhaas@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox