pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedSegmentation fault with core dump
32+ messages / 9 participants
[nested] [flat]
* Segmentation fault with core dump
@ 2013-04-10 21:34 Joshua Berry <yoberi@gmail.com>
2013-04-10 21:40 ` Re: Segmentation fault with core dump Alvaro Herrera <alvherre@2ndquadrant.com>
2013-04-10 21:49 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
0 siblings, 2 replies; 32+ messages in thread
From: Joshua Berry @ 2013-04-10 21:34 UTC (permalink / raw)
To: pgsql-general
Hi Group,
I'm using PG 9.1.9 with a client application using various versions of the
pgsqlODBC driver on Windows. Cursors are used heavily, as well as some
pretty heavy trigger queries on db writes which update several materialized
views.
The server has 48GB RAM installed, PG is configured for 12GB shared
buffers, 8MB max_stack_depth, 32MB temp_buffers, and 2MB work_mem. Most of
the other settings are defaults.
The server will seg fault from every few days to up to two weeks. Each time
one of the postgres server processes seg faults, the server gets terminated
by signal 11, restarts in recovery for up to 30 seconds, after which time
it accepts connections as if nothing ever happened. Unfortunately all the
open cursors and connections are lost, so the client apps are left in a bad
state.
Seg faults have also occurred with PG 8.4. However that server's DELL OMSA
(hardware health monitoring system) began to report RAM parity errors, so I
figured that the seg faults were due to hardware issues and I did not
configure the system to save core files in order to debug. I migrated the
database to a server running PG9.1 with the hopes that the problem would
disappear, but it has not. So now I'm starting to debug.
Below are the relevant details. I'm not terribly savvy with gdb, so please
let me know what else I could/should examine from the core dump, as well as
anything else about the system/configuration.
Kind Regards,
-Joshua
#NB: some info in square brackets has been [redacted]
# grep postmaster /var/log/messages
Apr 10 13:18:32 [hostname] kernel: postmaster[17356]: segfault at 40 ip
0000000000710e2e sp 00007fffd193ca70 error 4 in postgres[400000+4ea000]
gdb /usr/pgsql-9.1/bin/postmaster -c core.17356
[...loading/reading symbols...]
Core was generated by `postgres: [username] [databasename]
[client_ipaddress](1500) SELECT '.
Program terminated with signal 11, Segmentation fault.
#0 ResourceOwnerEnlargeCatCacheRefs (owner=0x0) at resowner.c:605
605 if (owner->ncatrefs < owner->maxcatrefs)
(gdb) q
# uname -a
Linux [hostname] 2.6.32-358.2.1.el6.x86_64 #1 SMP Tue Mar 12 14:18:09 CDT
2013 x86_64 x86_64 x86_64 GNU/Linux
# cat /etc/redhat-release
Scientific Linux release 6.3 (Carbon)
# psql -U jberry
psql (9.1.9)
Type "help" for help.
jberry=# select version();
version
--------------------------------------------------------------------------------------------------------------
PostgreSQL 9.1.9 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.4.7
20120313 (Red Hat 4.4.7-3), 64-bit
(1 row)
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: Segmentation fault with core dump
2013-04-10 21:34 Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
@ 2013-04-10 21:40 ` Alvaro Herrera <alvherre@2ndquadrant.com>
1 sibling, 0 replies; 32+ messages in thread
From: Alvaro Herrera @ 2013-04-10 21:40 UTC (permalink / raw)
To: Joshua Berry <yoberi@gmail.com>; +Cc: pgsql-general
Joshua Berry escribió:
> gdb /usr/pgsql-9.1/bin/postmaster -c core.17356
> [...loading/reading symbols...]
> Core was generated by `postgres: [username] [databasename]
> [client_ipaddress](1500) SELECT '.
> Program terminated with signal 11, Segmentation fault.
> #0 ResourceOwnerEnlargeCatCacheRefs (owner=0x0) at resowner.c:605
> 605 if (owner->ncatrefs < owner->maxcatrefs)
> (gdb) q
Run "bt" here please (maybe "bt full" is even more illuminating)
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: Segmentation fault with core dump
2013-04-10 21:34 Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
@ 2013-04-10 21:49 ` Andres Freund <andres@2ndquadrant.com>
2013-04-10 21:53 ` Re: Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
1 sibling, 1 reply; 32+ messages in thread
From: Andres Freund @ 2013-04-10 21:49 UTC (permalink / raw)
To: Joshua Berry <yoberi@gmail.com>; +Cc: pgsql-general
Hi,
On 2013-04-10 16:34:40 -0500, Joshua Berry wrote:
> Below are the relevant details. I'm not terribly savvy with gdb, so please
> let me know what else I could/should examine from the core dump, as well as
> anything else about the system/configuration.
> Kind Regards,
> -Joshua
>
> #NB: some info in square brackets has been [redacted]
> # grep postmaster /var/log/messages
> Apr 10 13:18:32 [hostname] kernel: postmaster[17356]: segfault at 40 ip
> 0000000000710e2e sp 00007fffd193ca70 error 4 in postgres[400000+4ea000]
>
> gdb /usr/pgsql-9.1/bin/postmaster -c core.17356
> [...loading/reading symbols...]
> Core was generated by `postgres: [username] [databasename]
> [client_ipaddress](1500) SELECT '.
> Program terminated with signal 11, Segmentation fault.
> #0 ResourceOwnerEnlargeCatCacheRefs (owner=0x0) at resowner.c:605
> 605 if (owner->ncatrefs < owner->maxcatrefs)
> (gdb) q
Could you show the output of 'bt full'?
Greetings,
Andres Freund
--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: Segmentation fault with core dump
2013-04-10 21:34 Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 21:49 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
@ 2013-04-10 21:53 ` Joshua Berry <yoberi@gmail.com>
2013-04-10 22:22 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
0 siblings, 1 reply; 32+ messages in thread
From: Joshua Berry @ 2013-04-10 21:53 UTC (permalink / raw)
To: Andres Freund <andres@2ndquadrant.com>; +Cc: pgsql-general
Hi Andres!
On Wed, Apr 10, 2013 at 4:49 PM, Andres Freund <andres@2ndquadrant.com>wrote:
> Could you show the output of 'bt full'?
>
Program terminated with signal 11, Segmentation fault.
#0 ResourceOwnerEnlargeCatCacheRefs (owner=0x0) at resowner.c:605
605 if (owner->ncatrefs < owner->maxcatrefs)
(gdb) bt
#0 ResourceOwnerEnlargeCatCacheRefs (owner=0x0) at resowner.c:605
#1 0x00000000006e1382 in SearchCatCache (cache=0x2a1aad0,
v1=<value optimized out>, v2=<value optimized out>,
v3=<value optimized out>, v4=<value optimized out>) at catcache.c:1143
#2 0x00000000006ec69e in getTypeOutputInfo (type=20, typOutput=0x2a8ac30,
typIsVarlena=0x2a8ac38 "") at lsyscache.c:2438
#3 0x0000000000459027 in printtup_prepare_info (myState=0x2a50c40,
typeinfo=0x2e7fc50, numAttrs=42) at printtup.c:263
#4 0x00000000004593c4 in printtup (slot=0x2d14618, self=0x2a50c40)
at printtup.c:297
#5 0x00000000006376ca in RunFromStore (portal=0x2aa9360,
direction=<value optimized out>, count=10, dest=0x2a50c40) at
pquery.c:1121
#6 0x00000000006377b2 in PortalRunSelect (portal=0x2aa9360,
forward=<value optimized out>, count=10, dest=0x2a50c40) at pquery.c:939
#7 0x0000000000638c78 in PortalRun (portal=0x2aa9360, count=10,
isTopLevel=1 '\001', dest=0x2a50c40, altdest=0x2a50c40,
completionTag=0x7fffd193d0f0 "") at pquery.c:787
#8 0x000000000063661e in exec_execute_message (argc=<value optimized out>,
argv=<value optimized out>, dbname=0x298a150 "[dbname]",
username=<value optimized out>) at postgres.c:1965
#9 PostgresMain (argc=<value optimized out>, argv=<value optimized out>,
dbname=0x298a150 "[dbname]", username=<value optimized out>)
at postgres.c:4026
#10 0x00000000005f6c61 in BackendRun () at postmaster.c:3612
#11 BackendStartup () at postmaster.c:3302
#12 ServerLoop () at postmaster.c:1466
#13 0x00000000005f9431 in PostmasterMain (argc=<value optimized out>,
argv=<value optimized out>) at postmaster.c:1127
#14 0x000000000059a9b0 in main (argc=5, argv=0x2988480) at main.c:199
(gdb) bt full
#0 ResourceOwnerEnlargeCatCacheRefs (owner=0x0) at resowner.c:605
newmax = <value optimized out>
#1 0x00000000006e1382 in SearchCatCache (cache=0x2a1aad0,
v1=<value optimized out>, v2=<value optimized out>,
v3=<value optimized out>, v4=<value optimized out>) at catcache.c:1143
res = 1 '\001'
cur_skey = {{sk_flags = 0, sk_attno = -2, sk_strategy = 3,
sk_subtype = 0, sk_collation = 0, sk_func = {
fn_addr = 0x686640 <oideq>, fn_oid = 184, fn_nargs = 2,
fn_strict = 1 '\001', fn_retset = 0 '\000', fn_stats = 2
'\002',
fn_extra = 0x0, fn_mcxt = 0x298b108, fn_expr = 0x0},
sk_argument = 20}, {sk_flags = 0, sk_attno = 0, sk_strategy = 0,
sk_subtype = 0, sk_collation = 0, sk_func = {fn_addr = 0,
fn_oid = 0, fn_nargs = 0, fn_strict = 0 '\000',
fn_retset = 0 '\000', fn_stats = 0 '\000', fn_extra = 0x0,
fn_mcxt = 0x0, fn_expr = 0x0}, sk_argument = 0}, {sk_flags =
0,
sk_attno = 0, sk_strategy = 0, sk_subtype = 0, sk_collation = 0,
sk_func = {fn_addr = 0, fn_oid = 0, fn_nargs = 0,
fn_strict = 0 '\000', fn_retset = 0 '\000', fn_stats = 0
'\000',
fn_extra = 0x0, fn_mcxt = 0x0, fn_expr = 0x0}, sk_argument =
0},
{sk_flags = 0, sk_attno = 0, sk_strategy = 0, sk_subtype = 0,
sk_collation = 0, sk_func = {fn_addr = 0, fn_oid = 0,
fn_nargs = 0, fn_strict = 0 '\000', fn_retset = 0 '\000',
fn_stats = 0 '\000', fn_extra = 0x0, fn_mcxt = 0x0,
fn_expr = 0x0}, sk_argument = 0}}
hashValue = 2280326203
hashIndex = 59
elt = 0x7fc28648fb88
ct = 0x7fc28648fb78
relation = <value optimized out>
scandesc = <value optimized out>
ntp = <value optimized out>
#2 0x00000000006ec69e in getTypeOutputInfo (type=20, typOutput=0x2a8ac30,
typIsVarlena=0x2a8ac38 "") at lsyscache.c:2438
typeTuple = <value optimized out>
pt = <value optimized out>
__func__ = "getTypeOutputInfo"
#3 0x0000000000459027 in printtup_prepare_info (myState=0x2a50c40,
typeinfo=0x2e7fc50, numAttrs=42) at printtup.c:263
thisState = <value optimized out>
format = <value optimized out>
formats = 0x0
i = <value optimized out>
__func__ = "printtup_prepare_info"
#4 0x00000000004593c4 in printtup (slot=0x2d14618, self=0x2a50c40)
at printtup.c:297
typeinfo = <value optimized out>
myState = 0x2a50c40
buf = {data = 0x2aa9360 "x\376\243\002", len = 47269400, maxlen = 0,
cursor = 47269400}
natts = 42
i = <value optimized out>
#5 0x00000000006376ca in RunFromStore (portal=0x2aa9360,
direction=<value optimized out>, count=10, dest=0x2a50c40) at
pquery.c:1121
oldcontext = 0x2aca6f0
ok = <value optimized out>
current_tuple_count = 0
slot = 0x2d14618
#6 0x00000000006377b2 in PortalRunSelect (portal=0x2aa9360,
forward=<value optimized out>, count=10, dest=0x2a50c40) at pquery.c:939
queryDesc = 0x0
direction = ForwardScanDirection
nprocessed = <value optimized out>
__func__ = "PortalRunSelect"
#7 0x0000000000638c78 in PortalRun (portal=0x2aa9360, count=10,
isTopLevel=1 '\001', dest=0x2a50c40, altdest=0x2a50c40,
completionTag=0x7fffd193d0f0 "") at pquery.c:787
save_exception_stack = 0x7fffd193cfe0
save_context_stack = 0x0
local_sigjmp_buf = {{__jmpbuf = {140736709513424,
8412518331319730861,
44733280, 0, 4294967295, 3, -8412469024494566739,
8412517527857939117}, __mask_was_saved = 0, __saved_mask = {
__val = {76, 44316880, 5, 0, 44804496, 767, 5, 0, 4294967295,
3,
5565893, 11495616, 4746857, 140736709513424,
140736709513424,
0}}}}
result = <value optimized out>
nprocessed = <value optimized out>
saveTopTransactionResourceOwner = 0x2a439e0
saveTopTransactionContext = 0x2a438d0
saveActivePortal = 0x0
saveResourceOwner = 0x2a439e0
savePortalContext = 0x0
saveMemoryContext = 0x2a438d0
__func__ = "PortalRun"
#8 0x000000000063661e in exec_execute_message (argc=<value optimized out>,
argv=<value optimized out>, dbname=0x298a150 "[dbname]",
username=<value optimized out>) at postgres.c:1965
completed = <value optimized out>
execute_is_fetch = 1 '\001'
completionTag = "\000ELECT
3\000\000\241\361=\000\000\000pÑ\321\377\177\000\000\300@\231\002", '\000'
<repeats 12 times>"\200,
\355\232\002\000\000\000\000PÑ\321\377\177\000\000U\000`\377\377\377\377\377"
save_log_statement_stats = 0 '\000'
was_logged = <value optimized out>
dest = DestRemoteExecute
receiver = 0x2a50c40
portal = <value optimized out>
sourceText = 0x2d141b8 "declare \"SQL_CUR017CB040\" cursor with
hold for SELECT
anl.LAB,anl.JOB,anl.COMPANYCODE,anl.SAMPLETYPE,anl.COMPANYLAB,anl.CYLNO,anl.CONTAINERCODE,anl.DATEGCANALYSIS,anl.DATEREPORT,anl.SAMPLENAME,anl.FIE"...
prepStmtName = 0x817c44 "<unnamed>"
portalParams = 0x0
is_xact_command = <value optimized out>
msec_str = '\000' <repeats 16 times>, "1500\000\000\000\000\330@
\231\002\000\000\000"
#9 PostgresMain (argc=<value optimized out>, argv=<value optimized out>,
dbname=0x298a150 "[dbname]", username=<value optimized out>)
at postgres.c:4026
portal_name = 0x2a50420 "SQL_CUR017CB040"
max_rows = 10
firstchar = <value optimized out>
input_message = {data = 0x2a50420 "SQL_CUR017CB040", len = 20,
maxlen = 1024, cursor = 20}
local_sigjmp_buf = {{__jmpbuf = {140736709513392,
8412515096121983661,
1, 1, -9187201950435737471, 0, -8412469024567967059,
8412517530690536109}, __mask_was_saved = 1, __saved_mask = {
__val = {0, 0, 0, 18446462598732840960, 18446744073709551615,
0,
0, 0, 0, 0, 0, 266046903056, 140486762587344, 0, 4294967295,
0}}}}
send_ready_for_query = 0 '\000'
__func__ = "PostgresMain"
#10 0x00000000005f6c61 in BackendRun () at postmaster.c:3612
ac = 1
secs = 418739329
usecs = 43047
i = <value optimized out>
av = 0x298a398
maxac = <value optimized out>
#11 BackendStartup () at postmaster.c:3302
bn = 0x29940c0
pid = 0
#12 ServerLoop () at postmaster.c:1466
rmask = {fds_bits = {32, 0 <repeats 15 times>}}
selres = <value optimized out>
readmask = {fds_bits = {224, 0 <repeats 15 times>}}
nSockets = 8
now = <value optimized out>
last_touch_time = 1365422110
__func__ = "ServerLoop"
#13 0x00000000005f9431 in PostmasterMain (argc=<value optimized out>,
argv=<value optimized out>) at postmaster.c:1127
opt = <value optimized out>
status = <value optimized out>
userDoption = <value optimized out>
listen_addr_saved = 1 '\001'
i = <value optimized out>
__func__ = "PostmasterMain"
#14 0x000000000059a9b0 in main (argc=5, argv=0x2988480) at main.c:199
No locals.
(gdb)
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: Segmentation fault with core dump
2013-04-10 21:34 Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 21:49 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-10 21:53 ` Re: Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
@ 2013-04-10 22:22 ` Andres Freund <andres@2ndquadrant.com>
2013-04-10 22:31 ` Re: Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 22:35 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 2 replies; 32+ messages in thread
From: Andres Freund @ 2013-04-10 22:22 UTC (permalink / raw)
To: Joshua Berry <yoberi@gmail.com>; +Cc: pgsql-general
On 2013-04-10 16:53:12 -0500, Joshua Berry wrote:
> #7 0x0000000000638c78 in PortalRun (portal=0x2aa9360, count=10,
> isTopLevel=1 '\001', dest=0x2a50c40, altdest=0x2a50c40,
> completionTag=0x7fffd193d0f0 "") at pquery.c:787
> save_exception_stack = 0x7fffd193cfe0
> save_context_stack = 0x0
> local_sigjmp_buf = {{__jmpbuf = {140736709513424,
> 8412518331319730861,
> 44733280, 0, 4294967295, 3, -8412469024494566739,
> 8412517527857939117}, __mask_was_saved = 0, __saved_mask = {
> __val = {76, 44316880, 5, 0, 44804496, 767, 5, 0, 4294967295,
> 3,
> 5565893, 11495616, 4746857, 140736709513424,
> 140736709513424,
> 0}}}}
> result = <value optimized out>
> nprocessed = <value optimized out>
> saveTopTransactionResourceOwner = 0x2a439e0
> saveTopTransactionContext = 0x2a438d0
> saveActivePortal = 0x0
> saveResourceOwner = 0x2a439e0
> savePortalContext = 0x0
> saveMemoryContext = 0x2a438d0
> __func__ = "PortalRun"
Ok, so while we have a valid resource owner up to here, portal->resonwer
is NULL.
Could you 'up' until youre in this frame and then do 'print *portal'?
Thanks,
Andres Freund
--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: Segmentation fault with core dump
2013-04-10 21:34 Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 21:49 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-10 21:53 ` Re: Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 22:22 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
@ 2013-04-10 22:31 ` Joshua Berry <yoberi@gmail.com>
2013-04-10 23:13 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
1 sibling, 1 reply; 32+ messages in thread
From: Joshua Berry @ 2013-04-10 22:31 UTC (permalink / raw)
To: Andres Freund <andres@2ndquadrant.com>; +Cc: pgsql-general
> Ok, so while we have a valid resource owner up to here, portal->resonwer
> is NULL.
>
> Could you 'up' until youre in this frame and then do 'print *portal'?
>
#7 0x0000000000638c78 in PortalRun (portal=0x2aa9360, count=10,
isTopLevel=1 '\001', dest=0x2a50c40, altdest=0x2a50c40,
completionTag=0x7fffd193d0f0 "") at pquery.c:787
787 nprocessed =
PortalRunSelect(portal, true, count, dest);
(gdb) print *portal
$1 = {name = 0x2a3fe78 "SQL_CUR017CB040", prepStmtName = 0x0,
heap = 0x2aca6f0, resowner = 0x0, cleanup = 0x535d30 <PortalCleanup>,
createSubid = 0,
sourceText = 0x2d141b8 "declare \"SQL_CUR017CB040\" cursor with hold for
SELECT
anl.LAB,anl.JOB,anl.COMPANYCODE,anl.SAMPLETYPE,anl.COMPANYLAB,anl.CYLNO,anl.CONTAINERCODE,anl.DATEGCANALYSIS,anl.DATEREPORT,anl.SAMPLENAME,anl.FIE"...,
commandTag = 0x828f32 "SELECT", stmts = 0x2d145e8, cplan = 0x0,
portalParams = 0x0, strategy = PORTAL_ONE_SELECT, cursorOptions = 52,
status = PORTAL_ACTIVE, portalPinned = 0 '\000', queryDesc = 0x0,
tupDesc = 0x2e7fc50, formats = 0x0, holdStore = 0x2d0d430,
holdContext = 0x2f4e290, atStart = 0 '\000', atEnd = 0 '\000',
posOverflow = 0 '\000', portalPos = 10, creation_time = 418933112934458,
visible = 1 '\001'}
(gdb)
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: Segmentation fault with core dump
2013-04-10 21:34 Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 21:49 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-10 21:53 ` Re: Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 22:22 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-10 22:31 ` Re: Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
@ 2013-04-10 23:13 ` Andres Freund <andres@2ndquadrant.com>
2013-04-10 23:22 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
2013-04-10 23:25 ` Re: Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
0 siblings, 2 replies; 32+ messages in thread
From: Andres Freund @ 2013-04-10 23:13 UTC (permalink / raw)
To: Joshua Berry <yoberi@gmail.com>; +Cc: pgsql-general
On 2013-04-10 17:31:09 -0500, Joshua Berry wrote:
> > Ok, so while we have a valid resource owner up to here, portal->resonwer
> > is NULL.
> >
> > Could you 'up' until youre in this frame and then do 'print *portal'?
> >
>
> #7 0x0000000000638c78 in PortalRun (portal=0x2aa9360, count=10,
> isTopLevel=1 '\001', dest=0x2a50c40, altdest=0x2a50c40,
> completionTag=0x7fffd193d0f0 "") at pquery.c:787
> 787 nprocessed =
> PortalRunSelect(portal, true, count, dest);
> (gdb) print *portal
> $1 = {name = 0x2a3fe78 "SQL_CUR017CB040", prepStmtName = 0x0,
> heap = 0x2aca6f0, resowner = 0x0, cleanup = 0x535d30 <PortalCleanup>,
> createSubid = 0,
> sourceText = 0x2d141b8 "declare \"SQL_CUR017CB040\" cursor with hold for
> SELECT
> anl.LAB,anl.JOB,anl.COMPANYCODE,anl.SAMPLETYPE,anl.COMPANYLAB,anl.CYLNO,anl.CONTAINERCODE,anl.DATEGCANALYSIS,anl.DATEREPORT,anl.SAMPLENAME,anl.FIE"...,
> commandTag = 0x828f32 "SELECT", stmts = 0x2d145e8, cplan = 0x0,
> portalParams = 0x0, strategy = PORTAL_ONE_SELECT, cursorOptions = 52,
> status = PORTAL_ACTIVE, portalPinned = 0 '\000', queryDesc = 0x0,
> tupDesc = 0x2e7fc50, formats = 0x0, holdStore = 0x2d0d430,
> holdContext = 0x2f4e290, atStart = 0 '\000', atEnd = 0 '\000',
> posOverflow = 0 '\000', portalPos = 10, creation_time = 418933112934458,
> visible = 1 '\001'}
> (gdb)
Ok, I might be seeing whats going on here. Could you go to 'printtup'
and print *myState, *myState->attrinfo, *typpeinfo?
Tom: It looks to me like printtup_prepare_info won't normally be called
in an held cursor. But if some concurrent DDL changed the number of
columns in typeinfo vs thaose in the the receiver that could explain the
issue and why its not seen all the time, right?
Greetings,
Andres Freund
--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: Segmentation fault with core dump
2013-04-10 21:34 Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 21:49 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-10 21:53 ` Re: Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 22:22 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-10 22:31 ` Re: Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 23:13 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
@ 2013-04-10 23:22 ` Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 32+ messages in thread
From: Tom Lane @ 2013-04-10 23:22 UTC (permalink / raw)
To: Andres Freund <andres@2ndquadrant.com>; +Cc: Joshua Berry <yoberi@gmail.com>; pgsql-general
Andres Freund <andres@2ndquadrant.com> writes:
> Tom: It looks to me like printtup_prepare_info won't normally be called
> in an held cursor. But if some concurrent DDL changed the number of
> columns in typeinfo vs thaose in the the receiver that could explain the
> issue and why its not seen all the time, right?
It looks to me like there are probably two triggering conditions:
1. Client is doing a direct protocol Execute on a held-cursor portal.
2. Cache flush occurs to drop the syscache entries needed by
getTypeOutputInfo. (Otherwise, they'd still be around from when the
held cursor was created.)
The first of these explains why we don't see it in the
CLOBBER_CACHE_ALWAYS buildfarm runs, and the second one explains why
Joshua is only seeing it intermittently and not every darn time his
application does that.
regards, tom lane
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: Segmentation fault with core dump
2013-04-10 21:34 Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 21:49 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-10 21:53 ` Re: Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 22:22 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-10 22:31 ` Re: Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 23:13 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
@ 2013-04-10 23:25 ` Joshua Berry <yoberi@gmail.com>
2013-04-10 23:28 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
1 sibling, 1 reply; 32+ messages in thread
From: Joshua Berry @ 2013-04-10 23:25 UTC (permalink / raw)
To: Andres Freund <andres@2ndquadrant.com>; +Cc: pgsql-general
> Ok, I might be seeing whats going on here. Could you go to 'printtup'
> and print *myState, *myState->attrinfo, *typpeinfo?
>
#4 0x00000000004593c4 in printtup (slot=0x2d14618, self=0x2a50c40)
at printtup.c:297
297 printtup_prepare_info(myState, typeinfo, natts);
(gdb) print *myState, *myState->attrinfo, *typeinfo
value has been optimized out
(gdb)
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: Segmentation fault with core dump
2013-04-10 21:34 Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 21:49 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-10 21:53 ` Re: Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 22:22 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-10 22:31 ` Re: Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 23:13 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-10 23:25 ` Re: Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
@ 2013-04-10 23:28 ` Andres Freund <andres@2ndquadrant.com>
2013-04-10 23:34 ` Re: Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
0 siblings, 1 reply; 32+ messages in thread
From: Andres Freund @ 2013-04-10 23:28 UTC (permalink / raw)
To: Joshua Berry <yoberi@gmail.com>; +Cc: pgsql-general
On 2013-04-10 18:25:24 -0500, Joshua Berry wrote:
> > Ok, I might be seeing whats going on here. Could you go to 'printtup'
> > and print *myState, *myState->attrinfo, *typpeinfo?
> >
>
> #4 0x00000000004593c4 in printtup (slot=0x2d14618, self=0x2a50c40)
> at printtup.c:297
> 297 printtup_prepare_info(myState, typeinfo, natts);
> (gdb) print *myState, *myState->attrinfo, *typeinfo
> value has been optimized out
Hm. Make that a
print *(DR_printtup *) self
print *((DR_printtup *) self)->attrinfo
print *slot->tts_tupleDescriptor
then.
Thanks,
Andres Freund
--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: Segmentation fault with core dump
2013-04-10 21:34 Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 21:49 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-10 21:53 ` Re: Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 22:22 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-10 22:31 ` Re: Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 23:13 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-10 23:25 ` Re: Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 23:28 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
@ 2013-04-10 23:34 ` Joshua Berry <yoberi@gmail.com>
0 siblings, 0 replies; 32+ messages in thread
From: Joshua Berry @ 2013-04-10 23:34 UTC (permalink / raw)
To: Andres Freund <andres@2ndquadrant.com>; +Cc: pgsql-general
Hm. Make that a
> print *(DR_printtup *) self
> print *((DR_printtup *) self)->attrinfo
> print *slot->tts_tupleDescriptor
(gdb) print *(DR_printtup *) self
$2 = {pub = {receiveSlot = 0x459390 <printtup>,
rStartup = 0x459550 <printtup_startup>,
rShutdown = 0x458a20 <printtup_shutdown>,
rDestroy = 0x458a10 <printtup_destroy>, mydest = DestRemoteExecute},
portal = 0x2aa9360, sendDescrip = 0 '\000', attrinfo = 0x2e7fc50,
nattrs = 42, myinfo = 0x2a8ac30}
(gdb) print *((DR_printtup *) self)->attrinfo
$3 = {natts = 42, attrs = 0x2e7fc78, constr = 0x0, tdtypeid = 2249,
tdtypmod = -1, tdhasoid = 0 '\000', tdrefcount = -1}
(gdb) print *slot->tts_tupleDescriptor
$4 = {natts = 42, attrs = 0x2e7fc78, constr = 0x0, tdtypeid = 2249,
tdtypmod = -1, tdhasoid = 0 '\000', tdrefcount = -1}
(gdb)
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: Segmentation fault with core dump
2013-04-10 21:34 Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 21:49 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-10 21:53 ` Re: Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 22:22 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
@ 2013-04-10 22:35 ` Tom Lane <tgl@sss.pgh.pa.us>
2013-04-10 23:06 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 1 reply; 32+ messages in thread
From: Tom Lane @ 2013-04-10 22:35 UTC (permalink / raw)
To: Andres Freund <andres@2ndquadrant.com>; +Cc: Joshua Berry <yoberi@gmail.com>; pgsql-general
Andres Freund <andres@2ndquadrant.com> writes:
> Ok, so while we have a valid resource owner up to here, portal->resonwer
> is NULL.
Yeah, that's what I'm guessing. Given the exposed reference to a cursor
WITH HOLD, it seems likely that the reason the portal has no resowner
is that PreCommit_Portals() got rid of it when the cursor was held.
However, if that were the explanation, it's not clear how come this
isn't falling over all the time for everybody who uses holdable cursors.
Any cache flush happening just before fetching from a holdable cursor
ought to do it ...
(Wanders away wondering just how much the regression tests exercise
holdable cursors.)
regards, tom lane
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: Segmentation fault with core dump
2013-04-10 21:34 Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 21:49 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-10 21:53 ` Re: Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 22:22 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-10 22:35 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
@ 2013-04-10 23:06 ` Tom Lane <tgl@sss.pgh.pa.us>
2013-04-10 23:21 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-10 23:32 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-12 11:12 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
0 siblings, 3 replies; 32+ messages in thread
From: Tom Lane @ 2013-04-10 23:06 UTC (permalink / raw)
To: Andres Freund <andres@2ndquadrant.com>; +Cc: Joshua Berry <yoberi@gmail.com>; pgsql-general
I wrote:
> (Wanders away wondering just how much the regression tests exercise
> holdable cursors.)
And the answer is they're not testing this code path at all, because if
you do
DECLARE c CURSOR WITH HOLD FOR ...
FETCH ALL FROM c;
then the second query executes with a portal (and resource owner)
created to execute the FETCH command, not directly on the held portal.
After a little bit of thought I'm not sure it's even possible to
reproduce this problem with libpq, because it doesn't expose any way to
issue a bare protocol Execute command against a pre-existing portal.
(I had thought psqlOBC went through libpq, but maybe it's playing some
games here.)
Anyway, I'm thinking the appropriate fix might be like this
- CurrentResourceOwner = portal->resowner;
+ if (portal->resowner)
+ CurrentResourceOwner = portal->resowner;
in several places in pquery.c; that is, keep using
TopTransactionResourceOwner if the portal doesn't have its own.
A more general but probably much more invasive solution would be to fake
up an intermediate portal when pulling data from a held portal, to
more closely approximate the explicit-FETCH case.
regards, tom lane
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: Segmentation fault with core dump
2013-04-10 21:34 Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 21:49 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-10 21:53 ` Re: Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 22:22 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-10 22:35 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
2013-04-10 23:06 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
@ 2013-04-10 23:21 ` Andres Freund <andres@2ndquadrant.com>
2013-04-10 23:29 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
2 siblings, 1 reply; 32+ messages in thread
From: Andres Freund @ 2013-04-10 23:21 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Joshua Berry <yoberi@gmail.com>; pgsql-general
On 2013-04-10 19:06:12 -0400, Tom Lane wrote:
> I wrote:
> > (Wanders away wondering just how much the regression tests exercise
> > holdable cursors.)
>
> And the answer is they're not testing this code path at all, because if
> you do
> DECLARE c CURSOR WITH HOLD FOR ...
> FETCH ALL FROM c;
> then the second query executes with a portal (and resource owner)
> created to execute the FETCH command, not directly on the held portal.
But in that path CurrentResourceOwner gets reset to portal->resowner as
well (see PortalRunFetch())?
Greetings,
Andres Freund
--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: Segmentation fault with core dump
2013-04-10 21:34 Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 21:49 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-10 21:53 ` Re: Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 22:22 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-10 22:35 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
2013-04-10 23:06 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
2013-04-10 23:21 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
@ 2013-04-10 23:29 ` Tom Lane <tgl@sss.pgh.pa.us>
2013-04-10 23:37 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
0 siblings, 1 reply; 32+ messages in thread
From: Tom Lane @ 2013-04-10 23:29 UTC (permalink / raw)
To: Andres Freund <andres@2ndquadrant.com>; +Cc: Joshua Berry <yoberi@gmail.com>; pgsql-general
Andres Freund <andres@2ndquadrant.com> writes:
> On 2013-04-10 19:06:12 -0400, Tom Lane wrote:
>> And the answer is they're not testing this code path at all, because if
>> you do
>> DECLARE c CURSOR WITH HOLD FOR ...
>> FETCH ALL FROM c;
>> then the second query executes with a portal (and resource owner)
>> created to execute the FETCH command, not directly on the held portal.
> But in that path CurrentResourceOwner gets reset to portal->resowner as
> well (see PortalRunFetch())?
Right, but that's the FETCH's portal, which is a regular "live" portal
that has a ResOwner.
regards, tom lane
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: Segmentation fault with core dump
2013-04-10 21:34 Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 21:49 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-10 21:53 ` Re: Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 22:22 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-10 22:35 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
2013-04-10 23:06 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
2013-04-10 23:21 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-10 23:29 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
@ 2013-04-10 23:37 ` Andres Freund <andres@2ndquadrant.com>
0 siblings, 0 replies; 32+ messages in thread
From: Andres Freund @ 2013-04-10 23:37 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Joshua Berry <yoberi@gmail.com>; pgsql-general
On 2013-04-10 19:29:06 -0400, Tom Lane wrote:
> Andres Freund <andres@2ndquadrant.com> writes:
> > On 2013-04-10 19:06:12 -0400, Tom Lane wrote:
> >> And the answer is they're not testing this code path at all, because if
> >> you do
> >> DECLARE c CURSOR WITH HOLD FOR ...
> >> FETCH ALL FROM c;
> >> then the second query executes with a portal (and resource owner)
> >> created to execute the FETCH command, not directly on the held portal.
>
> > But in that path CurrentResourceOwner gets reset to portal->resowner as
> > well (see PortalRunFetch())?
>
> Right, but that's the FETCH's portal, which is a regular "live" portal
> that has a ResOwner.
I don't think so?
standard_ProcessUtility:
PerformPortalFetch:
/* get the portal from the portal name */
portal = GetPortalByName(stmt->portalname);
...
/* Do it */
nprocessed = PortalRunFetch(portal,
stmt->direction,
stmt->howMany,
dest);
PortalRunFetch:
PG_TRY();
{
ActivePortal = portal;
CurrentResourceOwner = portal->resowner;
So it seems to trigger a very similar codepath?
Greetings,
Andres Freund
--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: Segmentation fault with core dump
2013-04-10 21:34 Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 21:49 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-10 21:53 ` Re: Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 22:22 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-10 22:35 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
2013-04-10 23:06 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
@ 2013-04-10 23:32 ` Andres Freund <andres@2ndquadrant.com>
2 siblings, 0 replies; 32+ messages in thread
From: Andres Freund @ 2013-04-10 23:32 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Joshua Berry <yoberi@gmail.com>; pgsql-general
On 2013-04-10 19:06:12 -0400, Tom Lane wrote:
> I wrote:
> > (Wanders away wondering just how much the regression tests exercise
> > holdable cursors.)
>
> And the answer is they're not testing this code path at all, because if
> you do
> DECLARE c CURSOR WITH HOLD FOR ...
> FETCH ALL FROM c;
> then the second query executes with a portal (and resource owner)
> created to execute the FETCH command, not directly on the held portal.
>
> After a little bit of thought I'm not sure it's even possible to
> reproduce this problem with libpq, because it doesn't expose any way to
> issue a bare protocol Execute command against a pre-existing portal.
> (I had thought psqlOBC went through libpq, but maybe it's playing some
> games here.)
Hm. PQexecPrepared() looks like it can do that.
Greetings,
Andres Freund
--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: Segmentation fault with core dump
2013-04-10 21:34 Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 21:49 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-10 21:53 ` Re: Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 22:22 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-10 22:35 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
2013-04-10 23:06 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
@ 2013-04-12 11:12 ` Andres Freund <andres@2ndquadrant.com>
2013-05-08 16:39 ` Re: Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2 siblings, 1 reply; 32+ messages in thread
From: Andres Freund @ 2013-04-12 11:12 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Joshua Berry <yoberi@gmail.com>; pgsql-general
On 2013-04-10 19:06:12 -0400, Tom Lane wrote:
> I wrote:
> > (Wanders away wondering just how much the regression tests exercise
> > holdable cursors.)
>
> And the answer is they're not testing this code path at all, because if
> you do
> DECLARE c CURSOR WITH HOLD FOR ...
> FETCH ALL FROM c;
> then the second query executes with a portal (and resource owner)
> created to execute the FETCH command, not directly on the held portal.
>
> After a little bit of thought I'm not sure it's even possible to
> reproduce this problem with libpq, because it doesn't expose any way to
> issue a bare protocol Execute command against a pre-existing portal.
> (I had thought psqlOBC went through libpq, but maybe it's playing some
> games here.)
>
> Anyway, I'm thinking the appropriate fix might be like this
>
> - CurrentResourceOwner = portal->resowner;
> + if (portal->resowner)
> + CurrentResourceOwner = portal->resowner;
>
> in several places in pquery.c; that is, keep using
> TopTransactionResourceOwner if the portal doesn't have its own.
>
> A more general but probably much more invasive solution would be to fake
> up an intermediate portal when pulling data from a held portal, to
> more closely approximate the explicit-FETCH case.
We could also allocate a new resowner for the duration of that
transaction. That would get reassigned to the transactions resowner in
PreCommit_Portals (after a slight change there).
That actually seems simple enough?
Greetings,
Andres Freund
--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: Segmentation fault with core dump
2013-04-10 21:34 Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 21:49 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-10 21:53 ` Re: Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 22:22 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-10 22:35 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
2013-04-10 23:06 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
2013-04-12 11:12 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
@ 2013-05-08 16:39 ` Joshua Berry <yoberi@gmail.com>
2013-06-11 14:53 ` Re: Segmentation fault with core dump Hiroshi Inoue <inoue@tpf.co.jp>
0 siblings, 1 reply; 32+ messages in thread
From: Joshua Berry @ 2013-05-08 16:39 UTC (permalink / raw)
To: Andres Freund <andres@2ndquadrant.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-general
| I'm using PG 9.1.9 with a client application using various versions of
the
| pgsqlODBC driver on Windows. Cursors are used heavily, as well as some
pretty
| heavy trigger queries on db writes which update several materialized
views.
|
| The server has 48GB RAM installed, PG is configured for 12GB shared
buffers,
| 8MB max_stack_depth, 32MB temp_buffers, and 2MB work_mem. Most of the
other
| settings are defaults.
|
| The server will seg fault from every few days to up to two weeks. Each
time
| one of the postgres server processes seg faults, the server gets
terminated by
| signal 11, restarts in recovery for up to 30 seconds, after which time it
| accepts connections as if nothing ever happened. Unfortunately all the
open
| cursors and connections are lost, so the client apps are left in a bad
state.
|
| Seg faults have also occurred with PG 8.4. ... I migrated the database to
a
| server running PG9.1 with the hopes that the problem would disappear, but
it
| has not. So now I'm starting to debug.
|
| # uname -a
| Linux [hostname] 2.6.32-358.2.1.el6.x86_64 #1 SMP Tue Mar 12 14:18:09 CDT
2013
| x86_64 x86_64 x86_64 GNU/Linux
| # cat /etc/redhat-release
| Scientific Linux release 6.3 (Carbon)
|
| # psql -U jberry
| psql (9.1.9)
| Type "help" for help.
|
| jberry=# select version();
| version
|
-------------------------------------------------------------------------------
| PostgreSQL 9.1.9 on x86_64-unknown-linux-gnu, compiled by gcc (GCC)
4.4.7
| 20120313 (Red Hat 4.4.7-3), 64-bit
| (1 row)
I've had another postmaster segfault on my production server. It appears to
be the same failure as the last one nearly a month ago, but I wanted to
post the gdb bt details in case it helps shed light on the issue. Please
let me know if anyone would like to drill into the dumped core with greater
detail. Both the OS and PG versions remain unchanged.
Kind Regards,
-Joshua
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: Segmentation fault with core dump
2013-04-10 21:34 Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 21:49 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-10 21:53 ` Re: Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 22:22 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-10 22:35 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
2013-04-10 23:06 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
2013-04-12 11:12 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-05-08 16:39 ` Re: Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
@ 2013-06-11 14:53 ` Hiroshi Inoue <inoue@tpf.co.jp>
2013-06-11 15:03 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 32+ messages in thread
From: Hiroshi Inoue @ 2013-06-11 14:53 UTC (permalink / raw)
To: Joshua Berry <yoberi@gmail.com>; Andres Freund <andres@2ndquadrant.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-general
Hi,
(2013/05/09 1:39), Joshua Berry wrote:
> | I'm using PG 9.1.9 with a client application using various versions of
> the
> | pgsqlODBC driver on Windows. Cursors are used heavily, as well as some
> pretty
> | heavy trigger queries on db writes which update several materialized
> views.
> |
> | The server has 48GB RAM installed, PG is configured for 12GB shared
> buffers,
> | 8MB max_stack_depth, 32MB temp_buffers, and 2MB work_mem. Most of the
> other
> | settings are defaults.
> |
> | The server will seg fault from every few days to up to two weeks. Each
> time
> | one of the postgres server processes seg faults, the server gets
> terminated by
> | signal 11, restarts in recovery for up to 30 seconds, after which time it
> | accepts connections as if nothing ever happened. Unfortunately all the
> open
> | cursors and connections are lost, so the client apps are left in a bad
> state.
> |
> | Seg faults have also occurred with PG 8.4. ... I migrated the database
> to a
> | server running PG9.1 with the hopes that the problem would disappear,
> but it
> | has not. So now I'm starting to debug.
> |
> | # uname -a
> | Linux [hostname] 2.6.32-358.2.1.el6.x86_64 #1 SMP Tue Mar 12 14:18:09
> CDT 2013
> | x86_64 x86_64 x86_64 GNU/Linux
> | # cat /etc/redhat-release
> | Scientific Linux release 6.3 (Carbon)
> |
> | # psql -U jberry
> | psql (9.1.9)
> | Type "help" for help.
> |
> | jberry=# select version();
> | version
> |
> -------------------------------------------------------------------------------
> | PostgreSQL 9.1.9 on x86_64-unknown-linux-gnu, compiled by gcc (GCC)
> 4.4.7
> | 20120313 (Red Hat 4.4.7-3), 64-bit
> | (1 row)
>
> I've had another postmaster segfault on my production server. It appears
> to be the same failure as the last one nearly a month ago, but I wanted
> to post the gdb bt details in case it helps shed light on the issue.
> Please let me know if anyone would like to drill into the dumped core
> with greater detail. Both the OS and PG versions remain unchanged.
>
> Kind Regards,
> -Joshua
>
>
> On Fri, Apr 12, 2013 at 6:12 AM, Andres Freund <andres@2ndquadrant.com
> <mailto:andres@2ndquadrant.com>> wrote:
>
> On 2013-04-10 19:06:12 -0400, Tom Lane wrote:
> > I wrote:
> > > (Wanders away wondering just how much the regression tests exercise
> > > holdable cursors.)
> >
> > And the answer is they're not testing this code path at all,
> because if
> > you do
> > DECLARE c CURSOR WITH HOLD FOR ...
> > FETCH ALL FROM c;
> > then the second query executes with a portal (and resource owner)
> > created to execute the FETCH command, not directly on the held
> portal.
> >
> > After a little bit of thought I'm not sure it's even possible to
> > reproduce this problem with libpq, because it doesn't expose any
> way to
> > issue a bare protocol Execute command against a pre-existing portal.
> > (I had thought psqlOBC went through libpq, but maybe it's playing
> some
> > games here.)
> >
> > Anyway, I'm thinking the appropriate fix might be like this
> >
> > - CurrentResourceOwner = portal->resowner;
> > + if (portal->resowner)
> > + CurrentResourceOwner = portal->resowner;
> >
> > in several places in pquery.c; that is, keep using
> > TopTransactionResourceOwner if the portal doesn't have its own.
> >
> > A more general but probably much more invasive solution would be
> to fake
> > up an intermediate portal when pulling data from a held portal, to
> > more closely approximate the explicit-FETCH case.
>
> We could also allocate a new resowner for the duration of that
> transaction. That would get reassigned to the transactions resowner in
> PreCommit_Portals (after a slight change there).
> That actually seems simple enough?
I made some changes to multi thread handling of psqlodbc driver.
It's also better to fix the crash at backend side.
I made 2 patches.
The 1st one temporarily changes CurrentResourceOwner to
CurTransactionResourceOwner during catalog cache handling.
The 2nd one allocates a new resource owner for held portals.
Both fix the crash in my test case.
regards,
Hiroshi Inoue
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
Attachments: download all (2 files, .tar.gz)
holdable_cursor_printtup.patch (text/x-patch, 1.4K) download
diff --git a/src/backend/access/common/printtup.c b/src/backend/access/common/printtup.c
index e87e675..258a4c2 100644
--- a/src/backend/access/common/printtup.c
+++ b/src/backend/access/common/printtup.c
@@ -238,6 +238,7 @@ printtup_prepare_info(DR_printtup *myState, TupleDesc typeinfo, int numAttrs)
{
int16 *formats = myState->portal->formats;
int i;
+ bool resownerIsNull = false;
/* get rid of any old data */
if (myState->myinfo)
@@ -252,6 +253,15 @@ printtup_prepare_info(DR_printtup *myState, TupleDesc typeinfo, int numAttrs)
myState->myinfo = (PrinttupAttrInfo *)
palloc0(numAttrs * sizeof(PrinttupAttrInfo));
+ if (NULL == CurrentResourceOwner)
+ {
+ /*
+ * This occurs when processing execute messages
+ * for holdable cursors after commit.
+ */
+ resownerIsNull = true;
+ CurrentResourceOwner = CurTransactionResourceOwner;
+ }
for (i = 0; i < numAttrs; i++)
{
PrinttupAttrInfo *thisState = myState->myinfo + i;
@@ -273,10 +283,16 @@ printtup_prepare_info(DR_printtup *myState, TupleDesc typeinfo, int numAttrs)
fmgr_info(thisState->typsend, &thisState->finfo);
}
else
+ {
+ if (resownerIsNull)
+ CurrentResourceOwner = NULL;
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("unsupported format code: %d", format)));
+ }
}
+ if (resownerIsNull)
+ CurrentResourceOwner = NULL;
}
/* ----------------
holdable_cursor_resowner.patch (text/x-patch, 5.7K) download
diff --git a/src/backend/tcop/pquery.c b/src/backend/tcop/pquery.c
index f8989f7..ccc1c45 100644
--- a/src/backend/tcop/pquery.c
+++ b/src/backend/tcop/pquery.c
@@ -759,6 +759,11 @@ PortalRun(Portal portal, long count, bool isTopLevel,
saveResourceOwner = CurrentResourceOwner;
savePortalContext = PortalContext;
saveMemoryContext = CurrentMemoryContext;
+ /*
+ * Allocate a new ResourceOwner for the portal if not set.
+ * It can occur for held portals(committed holdable cursors).
+ */
+ PortalAllocResourceOwner(portal);
PG_TRY();
{
ActivePortal = portal;
diff --git a/src/backend/utils/mmgr/portalmem.c b/src/backend/utils/mmgr/portalmem.c
index 54bf16e..5013300 100644
--- a/src/backend/utils/mmgr/portalmem.c
+++ b/src/backend/utils/mmgr/portalmem.c
@@ -183,6 +183,37 @@ PortalListGetPrimaryStmt(List *stmts)
return NULL;
}
+static void DelinkResownerFromPortal(ResourceOwner owner, void *arg)
+{
+ Portal portal = (Portal) arg;
+
+ if (!portal) return;
+ if (portal->resowner == NULL)
+ elog(DEBUG1, "resowner is already delinked from Portal(%p)", portal);
+ else if (owner != portal->resowner)
+ elog(DEBUG1, "the target ResourceOwner is different from the portal's resowner", portal);
+ else
+ {
+ elog(DEBUG1, "delinking resowner(%p) from Portal(%p)", portal->resowner, portal);
+ portal->resowner = NULL;
+ }
+ UnregisterResownerOnDeleteProc(owner, DelinkResownerFromPortal, arg);
+}
+
+/*
+ * Allocate a new ResourceOwner for the portal if not set.
+ * Also register an on delete procedure for the ResourceOwner.
+ */
+void PortalAllocResourceOwner(Portal portal)
+{
+ if (portal->resowner)
+ return;
+ /* create a ResourceOwner for the portal */
+ portal->resowner = ResourceOwnerCreate(CurTransactionResourceOwner, "Portal");
+ /* register an on delete procedure for the ResourceOwner. */
+ RegisterResownerOnDeleteProc(portal->resowner, DelinkResownerFromPortal, portal);
+}
+
/*
* CreatePortal
* Returns a new portal given a name.
@@ -224,9 +255,7 @@ CreatePortal(const char *name, bool allowDup, bool dupSilent)
ALLOCSET_SMALL_INITSIZE,
ALLOCSET_SMALL_MAXSIZE);
- /* create a resource owner for the portal */
- portal->resowner = ResourceOwnerCreate(CurTransactionResourceOwner,
- "Portal");
+ PortalAllocResourceOwner(portal);
/* initialize portal fields that don't start off zero */
portal->status = PORTAL_NEW;
@@ -506,6 +535,8 @@ PortalDrop(Portal portal, bool isTopCommit)
/* drop cached plan reference, if any */
PortalReleaseCachedPlan(portal);
+ /* unregister the on delete procedure because resowner is set to NULL later in this routine */
+ UnregisterResownerOnDeleteProc(portal->resowner, NULL, portal);
/*
* Release any resources still attached to the portal. There are several
* cases being covered here:
diff --git a/src/backend/utils/resowner/resowner.c b/src/backend/utils/resowner/resowner.c
index e7ec393..63930dd 100644
--- a/src/backend/utils/resowner/resowner.c
+++ b/src/backend/utils/resowner/resowner.c
@@ -98,6 +98,8 @@ typedef struct ResourceOwnerData
int nfiles; /* number of owned temporary files */
File *files; /* dynamically allocated array */
int maxfiles; /* currently allocated array size */
+ ResourceOwnerDeleteProc on_delete;
+ void *on_delete_arg;
} ResourceOwnerData;
@@ -439,6 +441,10 @@ ResourceOwnerDelete(ResourceOwner owner)
if (owner->files)
pfree(owner->files);
+ /* call on delete procedure if exists */
+ if (owner->on_delete != NULL)
+ (*(owner->on_delete)) (owner, owner->on_delete_arg);
+
pfree(owner);
}
@@ -537,6 +543,33 @@ UnregisterResourceReleaseCallback(ResourceReleaseCallback callback, void *arg)
}
}
+/*
+ * Register or deregister an on delete procedure
+ *
+ */
+void
+RegisterResownerOnDeleteProc(ResourceOwner owner, ResourceOwnerDeleteProc proc, void *arg)
+{
+ if (!owner)
+ return;
+ owner->on_delete = proc;
+ owner->on_delete_arg = arg;
+}
+
+void
+UnregisterResownerOnDeleteProc(ResourceOwner owner, ResourceOwnerDeleteProc proc, void *arg)
+{
+ if (!owner)
+ return;
+ if (arg != owner->on_delete_arg)
+ return;
+ if (NULL != proc &&
+ proc != owner->on_delete)
+ return;
+ owner->on_delete = NULL;
+ owner->on_delete_arg = NULL;
+}
+
/*
* Make sure there is room for at least one more entry in a ResourceOwner's
diff --git a/src/include/utils/portal.h b/src/include/utils/portal.h
index 4ae7e46..41492c6 100644
--- a/src/include/utils/portal.h
+++ b/src/include/utils/portal.h
@@ -205,6 +205,7 @@ extern void AtSubAbort_Portals(SubTransactionId mySubid,
extern void AtSubCleanup_Portals(SubTransactionId mySubid);
extern Portal CreatePortal(const char *name, bool allowDup, bool dupSilent);
extern Portal CreateNewPortal(void);
+extern void PortalAllocResourceOwner(Portal portal);
extern void PinPortal(Portal portal);
extern void UnpinPortal(Portal portal);
extern void MarkPortalDone(Portal portal);
diff --git a/src/include/utils/resowner.h b/src/include/utils/resowner.h
index da76649..9a06d88 100644
--- a/src/include/utils/resowner.h
+++ b/src/include/utils/resowner.h
@@ -58,6 +58,11 @@ typedef void (*ResourceReleaseCallback) (ResourceReleasePhase phase,
bool isTopLevel,
void *arg);
+/*
+ * ResourceOwner delete procedure
+ */
+typedef void (*ResourceOwnerDeleteProc) (ResourceOwner owner, void *arg);
+
/*
* Functions in resowner.c
@@ -78,5 +83,7 @@ extern void RegisterResourceReleaseCallback(ResourceReleaseCallback callback,
void *arg);
extern void UnregisterResourceReleaseCallback(ResourceReleaseCallback callback,
void *arg);
+extern void RegisterResownerOnDeleteProc(ResourceOwner owner, ResourceOwnerDeleteProc proc, void *arg);
+extern void UnregisterResownerOnDeleteProc(ResourceOwner owner, ResourceOwnerDeleteProc proc, void *arg);
#endif /* RESOWNER_H */
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: Segmentation fault with core dump
2013-04-10 21:34 Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 21:49 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-10 21:53 ` Re: Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 22:22 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-10 22:35 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
2013-04-10 23:06 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
2013-04-12 11:12 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-05-08 16:39 ` Re: Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-06-11 14:53 ` Re: Segmentation fault with core dump Hiroshi Inoue <inoue@tpf.co.jp>
@ 2013-06-11 15:03 ` Tom Lane <tgl@sss.pgh.pa.us>
2013-06-12 03:25 ` Re: Segmentation fault with core dump Inoue, Hiroshi <inoue@tpf.co.jp>
0 siblings, 1 reply; 32+ messages in thread
From: Tom Lane @ 2013-06-11 15:03 UTC (permalink / raw)
To: Hiroshi Inoue <inoue@tpf.co.jp>; +Cc: Joshua Berry <yoberi@gmail.com>; Andres Freund <andres@2ndquadrant.com>; pgsql-general
Hiroshi Inoue <inoue@tpf.co.jp> writes:
> It's also better to fix the crash at backend side.
Yeah, definitely. Do we have a self-contained test case for this?
regards, tom lane
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: Segmentation fault with core dump
2013-04-10 21:34 Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 21:49 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-10 21:53 ` Re: Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 22:22 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-04-10 22:35 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
2013-04-10 23:06 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
2013-04-12 11:12 ` Re: Segmentation fault with core dump Andres Freund <andres@2ndquadrant.com>
2013-05-08 16:39 ` Re: Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-06-11 14:53 ` Re: Segmentation fault with core dump Hiroshi Inoue <inoue@tpf.co.jp>
2013-06-11 15:03 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
@ 2013-06-12 03:25 ` Inoue, Hiroshi <inoue@tpf.co.jp>
0 siblings, 0 replies; 32+ messages in thread
From: Inoue, Hiroshi @ 2013-06-12 03:25 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Joshua Berry <yoberi@gmail.com>; Andres Freund <andres@2ndquadrant.com>; pgsql-general; Heikki Linnakangas <hlinnakangas@vmware.com>
(2013/06/12 0:03), Tom Lane wrote:
> Hiroshi Inoue <inoue@tpf.co.jp> writes:
>> It's also better to fix the crash at backend side.
>
> Yeah, definitely. Do we have a self-contained test case for this?
Unfortunately no. I'm testing with a modified psqlodbc driver.
The simplest way may be as follows.
1. Implement an API function like PQexecPortal(portal name, count)
which sends only an execute message.
2. Call the APIs as follows.
// Connect to a database.
conn = PQxxxx(....);
//
// Not begin a transaction for simplicity.
//
// The following operation defines a holdable portal whose
// portal name = cursor_name.
PQexec(conn, "declare cursor_name cursor with hold for select ....");
// At this point the holdable cursor becomes a held portal whose
// resowner is reset to NULL. The following function call would
// crash the backend.
PQexecPortal(conn, cursor_name, 1);
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
^ permalink raw reply [nested|flat] 32+ messages in thread
* Segmentation fault with core dump
@ 2018-01-10 11:49 Glauco Torres <torres.glauco@gmail.com>
2018-01-10 17:08 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 32+ messages in thread
From: Glauco Torres @ 2018-01-10 11:49 UTC (permalink / raw)
To: pgsql-general
Hi group,
I'm using PG 9.6.6 and I have a problem with seg fault from every few days
to up to two week,
this server is a replica, the other servers (master, and other slaves) do
not have this problem.
I could not identify the problem, so I do not know what triggers the
problem, however I have the PostgreSQL log and the core-dump generated by
the problem.
The server has 60 GB RAM, PG is configured:
shared_buffers = 14GB
work_mem = 192MB
Below are the relevant details.
$ cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
postgres=# select version();
version
----------------------------------------------------------------------------------------------------------
PostgreSQL 9.6.6 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5
20150623 (Red Hat 4.8.5-16), 64-bit
(1 row)
# cat postgresql-Mon.log | grep 'was terminated by signal 11: Segmentation
fault'
2018-01-08 01:51:27.909 -03 [85039]: [102-1] user=,db=,app=,client= LOG:
server process (PID 40286) was terminated by signal 11: Segmentation fault
2018-01-08 05:09:51.929 -03 [85039]: [107-1] user=,db=,app=,client= LOG:
server process (PID 62427) was terminated by signal 11: Segmentation fault
2018-01-08 06:33:46.840 -03 [85039]: [112-1] user=,db=,app=,client= LOG:
server process (PID 72156) was terminated by signal 11: Segmentation fault
2018-01-08 13:59:37.422 -03 [119484]: [4-1] user=,db=,app=,client= LOG:
server process (PID 124190) was terminated by signal 11: Segmentation fault
2018-01-08 14:09:41.590 -03 [119484]: [9-1] user=,db=,app=,client= LOG:
checkpointer process (PID 124528) was terminated by signal 11: Segmentation
fault
2018-01-08 15:18:06.379 -03 [119484]: [13-1] user=,db=,app=,client= LOG:
server process (PID 129026) was terminated by signal 11: Segmentation fault
2018-01-08 15:23:15.586 -03 [119484]: [18-1] user=,db=,app=,client= LOG:
server process (PID 6528) was terminated by signal 11: Segmentation fault
2018-01-08 15:55:32.029 -03 [119484]: [23-1] user=,db=,app=,client= LOG:
server process (PID 8762) was terminated by signal 11: Segmentation fault
2018-01-08 20:52:16.344 -03 [14804]: [5-1] user=,db=,app=,client= LOG:
checkpointer process (PID 14828) was terminated by signal 11: Segmentation
fault
(gdb) bt
#0 ckpt_buforder_comparator (pa=pa@entry=0x7f6fa9ef4b2c,
pb=pb@entry=0x1be06d2d06644)
at bufmgr.c:4137
#1 0x0000000000801268 in med3 (a=0x7f6fa9ef4b2c "\177\006",
b=0x1be06d2d06644 <Address 0x1be06d2d06644 out of bounds>,
c=0x2fc9dfbb1815c <Address 0x2fc9dfbb1815c out of bounds>, cmp=0x6a4d20
<ckpt_buforder_comparator>)
at qsort.c:107
#2 0x0000000000801621 in pg_qsort (a=0x7f6fa9ef4b2c, a@entry=0x7f6fa9ea8380,
n=<optimized out>, es=es@entry=20, cmp=cmp@entry=0x6a4d20
<ckpt_buforder_comparator>) at qsort.c:157
#3 0x00000000008015e2 in pg_qsort (a=0x7f6fa9ea8380, n=<optimized out>,
n@entry=111473, es=es@entry=20, cmp=cmp@entry=0x6a4d20
<ckpt_buforder_comparator>) at qsort.c:203
#4 0x00000000006a81cf in BufferSync (flags=flags@entry=128) at
bufmgr.c:1863
#5 0x00000000006a8477 in CheckPointBuffers (flags=flags@entry=128) at
bufmgr.c:2578
#6 0x00000000004dd781 in CheckPointGuts (checkPointRedo=<optimized out>,
flags=<optimized out>) at xlog.c:8698
#7 0x00000000004e9faf in CreateRestartPoint (flags=<optimized out>) at
xlog.c:8856
#8 0x000000000066977c in CheckpointerMain () at checkpointer.c:490
#9 0x00000000004f2820 in AuxiliaryProcessMain (argc=argc@entry=2,
argv=argv@entry=0x7ffd8bac2b80) at bootstrap.c:429
#10 0x0000000000673330 in StartChildProcess (type=CheckpointerProcess) at
postmaster.c:5252
#11 0x0000000000674b1f in sigusr1_handler (postgres_signal_arg=<optimized
out>) at postmaster.c:4949
#12 <signal handler called>
#13 0x00007f6fc75a0b83 in __select_nocancel () from /lib64/libc.so.6
#14 0x000000000046ef32 in ServerLoop () at postmaster.c:1683
#15 0x0000000000675b69 in PostmasterMain (argc=argc@entry=3,
argv=argv@entry=0x27ca210)
at postmaster.c:1327
#16 0x000000000047053e in main (argc=3, argv=0x27ca210) at main.c:228
#0 ckpt_buforder_comparator (pa=pa@entry=0x7f6fa9ef4b2c,
pb=pb@entry=0x1be06d2d06644)
at bufmgr.c:4137
a = 0x7f6fa9ef4b2c
b = 0x1be06d2d06644
#1 0x0000000000801268 in med3 (a=0x7f6fa9ef4b2c "\177\006",
b=0x1be06d2d06644 <Address 0x1be06d2d06644 out of bounds>,
c=0x2fc9dfbb1815c <Address 0x2fc9dfbb1815c out of bounds>, cmp=0x6a4d20
<ckpt_buforder_comparator>)
at qsort.c:107
No locals.
#2 0x0000000000801621 in pg_qsort (a=0x7f6fa9ef4b2c, a@entry=0x7f6fa9ea8380,
n=<optimized out>, es=es@entry=20, cmp=cmp@entry=0x6a4d20
<ckpt_buforder_comparator>) at qsort.c:157
d = 350293923535640
pa = <optimized out>
pb = <optimized out>
pc = <optimized out>
pd = <optimized out>
pl = 0x7f6fa9ef4b2c "\177\006"
pm = 0x7f6fa9f06174 "\177\006"
pn = 0xa7428f0f82428 <Address 0xa7428f0f82428 out of bounds>
d1 = <optimized out>
d2 = <optimized out>
r = <optimized out>
swaptype = 2
presorted = 0
#3 0x00000000008015e2 in pg_qsort (a=0x7f6fa9ea8380, n=<optimized out>,
n@entry=111473, es=es@entry=20, cmp=cmp@entry=0x6a4d20
<ckpt_buforder_comparator>) at qsort.c:203
pa = <optimized out>
pb = 0x7f6fa9f3a49c "\177\006"
pc = <optimized out>
pd = 0x7f6faa0c8840 "\177\006"
pl = <optimized out>
pm = <optimized out>
pn = 0x7f6faa0c8854 "\177\006"
d1 = <optimized out>
d2 = 1631160
r = <optimized out>
swaptype = 2
presorted = 0
#4 0x00000000006a81cf in BufferSync (flags=flags@entry=128) at
bufmgr.c:1863
buf_state = <optimized out>
buf_id = 1835008
num_to_scan = 111473
num_spaces = <optimized out>
num_processed = <optimized out>
num_written = <optimized out>
per_ts_stat = 0x0
last_tsid = <optimized out>
ts_heap = 0x7f6c266a8340
i = <optimized out>
mask = -2139095040
wb_context = {max_pending = 0xc287ec <checkpoint_flush_after>, nr_pending =
0, pending_writebacks = {{tag = {rnode = {spcNode = 1663, dbNode = 69060,
relNode = 412606246}, forkNum = MAIN_FORKNUM, blockNum = 428}}, {tag = {
rnode = {spcNode = 1663, dbNode = 69060, relNode =
412606246}, forkNum = MAIN_FORKNUM, blockNum = 429}}, {tag = {rnode =
{spcNode = 1663, dbNode = 69060, relNode = 412606252}, forkNum =
MAIN_FORKNUM,
blockNum = 54}}, {tag = {rnode = {spcNode = 1663, dbNode =
69060, relNode = 412606252}, forkNum = MAIN_FORKNUM, blockNum = 58}}, {tag
= {rnode = {spcNode = 1663, dbNode = 69060, relNode = 412606252},
forkNum = MAIN_FORKNUM, blockNum = 81}}, {tag = {rnode =
{spcNode = 1663, dbNode = 69060, relNode = 412606252}, forkNum =
MAIN_FORKNUM, blockNum = 98}}, {tag = {rnode = {spcNode = 1663, dbNode =
69060,
relNode = 412606252}, forkNum = MAIN_FORKNUM, blockNum =
158}}, {tag = {rnode = {spcNode = 1663, dbNode = 69060, relNode =
412606252}, forkNum = MAIN_FORKNUM, blockNum = 160}}, {tag = {rnode =
{spcNode = 1663,
dbNode = 69060, relNode = 412606252}, forkNum =
MAIN_FORKNUM, blockNum = 173}}, {tag = {rnode = {spcNode = 1663, dbNode =
69060, relNode = 412606252}, forkNum = MAIN_FORKNUM, blockNum = 177}}, {tag
= {rnode = {
spcNode = 1663, dbNode = 69060, relNode = 412606252},
forkNum = MAIN_FORKNUM, blockNum = 191}}, {tag = {rnode = {spcNode = 1663,
dbNode = 69060, relNode = 412606257}, forkNum = MAIN_FORKNUM, blockNum =
24}}, {
tag = {rnode = {spcNode = 1663, dbNode = 69060, relNode =
412606257}, forkNum = MAIN_FORKNUM, blockNum = 31}}, {tag = {rnode =
{spcNode = 1663, dbNode = 69060, relNode = 412606257}, forkNum =
MAIN_FORKNUM,
blockNum = 36}}, {tag = {rnode = {spcNode = 1663, dbNode =
8156905, relNode = 0}, forkNum = VISIBILITYMAP_FORKNUM, blockNum = 1}},
{tag = {rnode = {spcNode = 1663, dbNode = 69060, relNode = 20971520},
forkNum = 14828, blockNum = 825242228}}, {tag = {rnode =
{spcNode = 825240888, dbNode = 540553261, relNode = 893005874}, forkNum =
942815793, blockNum = 909194542}}, {tag = {rnode = {spcNode = 858795296,
dbNode = 875649824, relNode = 1563963960}, forkNum =
844832826, blockNum = 825046578}}, {tag = {rnode = {spcNode = 1937055837,
dbNode = 742224485, relNode = 742220388}, forkNum = 1030778977,
blockNum = 1768710956}}, {tag = {rnode = {spcNode =
1031040613, dbNode = 1196379168, relNode = 1914708026}, forkNum =
1635021669, blockNum = 8156905}}, {tag = {rnode = {spcNode = 0, dbNode = 2,
relNode = 1},
forkNum = 1920409658, blockNum = 543519855}}, {tag = {rnode
= {spcNode = 6684672, dbNode = 14828, relNode = 825242228}, forkNum =
825240888, blockNum = 540553261}}, {tag = {rnode = {spcNode = 893005874,
dbNode = 943012401, relNode = 942945582}, forkNum =
858795296, blockNum = 875649824}}, {tag = {rnode = {spcNode = 1563963960,
dbNode = 844832826, relNode = 825047346}, forkNum = 1937055837,
blockNum = 742224485}}, {tag = {rnode = {spcNode =
742220388, dbNode = 1030778977, relNode = 1768710956}, forkNum =
1031040613, blockNum = 1196379168}}, {tag = {rnode = {spcNode = 1914708026,
dbNode = 1635021669,
relNode = 1869640818}, forkNum = 544501353, blockNum =
1918989427}}, {tag = {rnode = {spcNode = 1735289204, dbNode = 1769218106,
relNode = 1862952301}, forkNum = 1030513012, blockNum = 775501362}}, {tag =
{
rnode = {spcNode = 540096568, dbNode = 1931492211, relNode
= 543387257}, forkNum = 1701603686, blockNum = 859323763}}, {tag = {rnode =
{spcNode = 1814047799, dbNode = 1701277295, relNode = 809333875},
forkNum = 875573294, blockNum = 539783968}}, {tag = {rnode
= {spcNode = 1919252065, dbNode = 1030055777, relNode = 808463920}, forkNum
= 997400624, blockNum = 1936286752}}, {tag = {rnode = {spcNode =
1668178292,
dbNode = 809057637, relNode = 808794162}, forkNum =
742550304, blockNum = 1953719584}}, {tag = {rnode = {spcNode = 1952542057,
dbNode = 808533349, relNode = 960049456}, forkNum = 1114316856, blockNum =
8476938}},
{tag = {rnode = {spcNode = 0, dbNode = 8477036, relNode = 0},
forkNum = -951086535, blockNum = 32623}}, {tag = {rnode = {spcNode = 6,
dbNode = 0, relNode = 0}, forkNum = MAIN_FORKNUM, blockNum = 0}}, {tag =
{rnode = {
spcNode = 0, dbNode = 4294967295, relNode = 4294967295},
forkNum = -951080648, blockNum = 32623}}, {tag = {rnode = {spcNode = 2,
dbNode = 0, relNode = 0}, forkNum = MAIN_FORKNUM, blockNum = 0}}, {tag =
{rnode = {
spcNode = 0, dbNode = 0, relNode = 0}, forkNum =
-1951655728, blockNum = 32765}}, {tag = {rnode = {spcNode = 2343311504,
dbNode = 32765, relNode = 32}, forkNum = MAIN_FORKNUM, blockNum =
8459196}}, {tag = {
rnode = {spcNode = 0, dbNode = 0, relNode = 0}, forkNum =
MAIN_FORKNUM, blockNum = 0}}, {tag = {rnode = {spcNode = 8156905, dbNode =
0, relNode = 2}, forkNum = FSM_FORKNUM, blockNum = 0}}, {tag = {rnode = {
spcNode = 0, dbNode = 17235968, relNode = 14828}, forkNum
= 825242228, blockNum = 825240888}}, {tag = {rnode = {spcNode = 540553261,
dbNode = 893005874, relNode = 942815793}, forkNum = 909194542,
blockNum = 858795296}}, {tag = {rnode = {spcNode =
875649824, dbNode = 1563963960, relNode = 844832826}, forkNum = 825046834,
blockNum = 1937055837}}, {tag = {rnode = {spcNode = 742224485, dbNode =
742220388,
relNode = 1030778977}, forkNum = 1768710956, blockNum =
1031040613}}, {tag = {rnode = {spcNode = 1196379168, dbNode = 1914708026,
relNode = 1987011429}, forkNum = 544830053, blockNum = 1953719666}}, {tag =
{
rnode = {spcNode = 544502369, dbNode = 1852403568, relNode
= 1952522356}, forkNum = 1110782752, blockNum = 959983411}}, {tag = {rnode
= {spcNode = 825312577, dbNode = 839528498, relNode = 758657328},
forkNum = 808268080, blockNum = 808591416}}, {tag = {rnode
= {spcNode = 976303418, dbNode = 892221490, relNode = 757085745}, forkNum =
1528836912, blockNum = 842544177}}, {tag = {rnode = {spcNode = 540695864,
dbNode = 942813787, relNode = 542978349}, forkNum =
1919251317, blockNum = 1650732093}}, {tag = {rnode = {spcNode = 1885416509,
dbNode = 1663843696, relNode = 1852139884}, forkNum = 1142963572,
blockNum = 1229018181}}, {tag = {rnode = {spcNode =
538982988, dbNode = 1953718636, relNode = 1836016416}, forkNum =
1952803952, blockNum = 1948279909}}, {tag = {rnode = {spcNode = 1936613746,
dbNode = 1769235297,
relNode = 1998614127}, forkNum = 1629516641, blockNum =
1869357172}}, {tag = {rnode = {spcNode = 1769218151, dbNode = 840983917,
relNode = 758657328}, forkNum = 808268080, blockNum = 808591416}}, {tag =
{rnode = {
spcNode = 976303418, dbNode = 858667058, relNode =
909523250}, forkNum = 171126829, blockNum = 10}}, {tag = {rnode = {spcNode
= 0, dbNode = 0, relNode = 0}, forkNum = MAIN_FORKNUM,
blockNum = 0}} <repeats 13 times>, {tag = {rnode = {spcNode
= 6987421, dbNode = 0, relNode = 0}, forkNum = MAIN_FORKNUM, blockNum =
2343312048}}, {tag = {rnode = {spcNode = 32765, dbNode = 0, relNode = 0},
forkNum = MAIN_FORKNUM, blockNum = 0}}, {tag = {rnode =
{spcNode = 0, dbNode = 0, relNode = 15}, forkNum = MAIN_FORKNUM, blockNum =
3957080064}}, {tag = {rnode = {spcNode = 13747, dbNode = 6991741, relNode =
0},
forkNum = 15, blockNum = 0}}, {tag = {rnode = {spcNode =
6985347, dbNode = 0, relNode = 707}, forkNum = MAIN_FORKNUM, blockNum =
6992616}}, {tag = {rnode = {spcNode = 0, dbNode = 15, relNode = 0}, forkNum
= 15,
blockNum = 0}}, {tag = {rnode = {spcNode = 2343313312,
dbNode = 32765, relNode = 2343314560}, forkNum = 32765, blockNum = 1}},
{tag = {rnode = {spcNode = 0, dbNode = 6992908, relNode = 0}, forkNum =
2019518320,
blockNum = 6778732}}, {tag = {rnode = {spcNode = 808464432,
dbNode = 858796080, relNode = 808464432}, forkNum = 876754227, blockNum =
808464432}}, {tag = {rnode = {spcNode = 909193264, dbNode = 0, relNode =
0},
forkNum = MAIN_FORKNUM, blockNum = 0}}, {tag = {rnode =
{spcNode = 0, dbNode = 0, relNode = 0}, forkNum = MAIN_FORKNUM, blockNum =
0}}, {tag = {rnode = {spcNode = 0, dbNode = 0, relNode = 0},
forkNum = MAIN_FORKNUM, blockNum = 0}}, {tag = {rnode =
{spcNode = 0, dbNode = 0, relNode = 1}, forkNum = MAIN_FORKNUM, blockNum =
0}}, {tag = {rnode = {spcNode = 0, dbNode = 2343313776, relNode = 32765},
forkNum = -949801968, blockNum = 32623}}, {tag = {rnode =
{spcNode = 8449408, dbNode = 0, relNode = 3344033888}, forkNum = 32623,
blockNum = 0}}, {tag = {rnode = {spcNode = 0, dbNode = 0, relNode = 0},
forkNum = -1951653520, blockNum = 32765}}, {tag = {rnode =
{spcNode = 2343313760, dbNode = 32765, relNode = 8449415}, forkNum =
MAIN_FORKNUM, blockNum = 4}}, {tag = {rnode = {spcNode = 0, dbNode =
8449408,
relNode = 0}, forkNum = -951086535, blockNum = 32623}},
{tag = {rnode = {spcNode = 8459912, dbNode = 0, relNode = 42329571},
forkNum = MAIN_FORKNUM, blockNum = 8459902}}, {tag = {rnode = {spcNode = 0,
dbNode = 3343880761, relNode = 32623}, forkNum =
MAIN_FORKNUM, blockNum = 0}}, {tag = {rnode = {spcNode = 3343886648, dbNode
= 32623, relNode = 0}, forkNum = MAIN_FORKNUM, blockNum = 0}}, {tag =
{rnode = {
spcNode = 0, dbNode = 0, relNode = 0}, forkNum =
-1951654688, blockNum = 32765}}, {tag = {rnode = {spcNode = 3343886648,
dbNode = 32623, relNode = 0}, forkNum = MAIN_FORKNUM, blockNum = 1}}, {tag
= {rnode = {
spcNode = 0, dbNode = 0, relNode = 0}, forkNum = -4,
blockNum = 4294967295}}, {tag = {rnode = {spcNode = 0, dbNode = 16, relNode
= 6796}, forkNum = MAIN_FORKNUM, blockNum = 3344033888}}, {tag = {rnode = {
spcNode = 32623, dbNode = 9616944, relNode = 0}, forkNum
= MAIN_FORKNUM, blockNum = 32623}}, {tag = {rnode = {spcNode = 0, dbNode =
32765, relNode = 0}, forkNum = 32765, blockNum = 2343313700}}, {tag =
{rnode = {
spcNode = 32765, dbNode = 0, relNode = 0}, forkNum = 4,
blockNum = 32623}}, {tag = {rnode = {spcNode = 0, dbNode = 0, relNode = 0},
forkNum = MAIN_FORKNUM, blockNum = 4294967295}}, {tag = {rnode = {
spcNode = 4294967295, dbNode = 3343886648, relNode =
32623}, forkNum = FSM_FORKNUM, blockNum = 32623}}, {tag = {rnode = {spcNode
= 9616896, dbNode = 0, relNode = 3344033888}, forkNum = 32623, blockNum =
0}}, {
tag = {rnode = {spcNode = 0, dbNode = 8449408, relNode = 0},
forkNum = MAIN_FORKNUM, blockNum = 0}}, {tag = {rnode = {spcNode = 25,
dbNode = 32765, relNode = 8449415}, forkNum = MAIN_FORKNUM, blockNum = 2}},
{tag = {
rnode = {spcNode = 0, dbNode = 9616896, relNode = 0},
forkNum = -951086535, blockNum = 32623}}, {tag = {rnode = {spcNode =
9434791, dbNode = 0, relNode = 3343880761}, forkNum = 32623, blockNum =
28}}, {tag = {
rnode = {spcNode = 0, dbNode = 2343312880, relNode =
32765}, forkNum = -951080648, blockNum = 32623}}, {tag = {rnode = {spcNode
= 3343886648, dbNode = 32623, relNode = 0}, forkNum = MAIN_FORKNUM,
blockNum = 0}}, {
tag = {rnode = {spcNode = 4294967295, dbNode = 40, relNode =
48}, forkNum = -1951652928, blockNum = 32765}}, {tag = {rnode = {spcNode =
2343314176, dbNode = 32765, relNode = 2343314208}, forkNum = 32765,
blockNum = 9434794}}, {tag = {rnode = {spcNode = 0, dbNode
= 3, relNode = 0}, forkNum = 9434791, blockNum = 0}}, {tag = {rnode =
{spcNode = 3343880761, dbNode = 32623, relNode = 58}, forkNum =
MAIN_FORKNUM,
blockNum = 0}}, {tag = {rnode = {spcNode = 0, dbNode = 48,
relNode = 0}, forkNum = MAIN_FORKNUM, blockNum = 0}}, {tag = {rnode =
{spcNode = 0, dbNode = 0, relNode = 0}, forkNum = InvalidForkNumber,
blockNum = 2343314320}}, {tag = {rnode = {spcNode = 32765,
dbNode = 2343314304, relNode = 32765}, forkNum = 9564263, blockNum = 0}},
{tag = {rnode = {spcNode = 2343313056, dbNode = 32765, relNode =
3343886648},
forkNum = 32623, blockNum = 3343880761}}, {tag = {rnode =
{spcNode = 32623, dbNode = 3343886648, relNode = 32623}, forkNum =
MAIN_FORKNUM, blockNum = 0}}, {tag = {rnode = {spcNode = 4294967293, dbNode
= 4294967295,
relNode = 0}, forkNum = 10, blockNum = 229}}, {tag =
{rnode = {spcNode = 0, dbNode = 3343886648, relNode = 32623}, forkNum = 32,
blockNum = 0}}, {tag = {rnode = {spcNode = 0, dbNode = 0, relNode = 0},
forkNum = MAIN_FORKNUM, blockNum = 0}}, {tag = {rnode =
{spcNode = 32765, dbNode = 2343314149, relNode = 32765}, forkNum =
MAIN_FORKNUM, blockNum = 0}}, {tag = {rnode = {spcNode = 2343314464, dbNode
= 32765,
relNode = 2343314448}, forkNum = 32765, blockNum =
9734857}}, {tag = {rnode = {spcNode = 0, dbNode = 8448198, relNode = 0},
forkNum = 9734855, blockNum = 0}}, {tag = {rnode = {spcNode = 3343880761,
dbNode = 32623, relNode = 9616944}, forkNum =
MAIN_FORKNUM, blockNum = 0}}, {tag = {rnode = {spcNode = 32623, dbNode = 0,
relNode = 0}, forkNum = 9434791, blockNum = 0}}, {tag = {rnode = {spcNode =
0, dbNode = 0,
relNode = 3}, forkNum = MAIN_FORKNUM, blockNum =
9434794}}, {tag = {rnode = {spcNode = 0, dbNode = 0, relNode = 0}, forkNum
= MAIN_FORKNUM, blockNum = 0}}, {tag = {rnode = {spcNode = 2343313296,
dbNode = 32765,
relNode = 2343313232}, forkNum = 32765, blockNum = 0}},
{tag = {rnode = {spcNode = 32765, dbNode = 2343314608, relNode = 32765},
forkNum = MAIN_FORKNUM, blockNum = 32765}}, {tag = {rnode = {spcNode = 0,
dbNode = 0, relNode = 0}, forkNum = MAIN_FORKNUM,
blockNum = 0}}, {tag = {rnode = {spcNode = 0, dbNode = 4, relNode = 32623},
forkNum = 32, blockNum = 48}}, {tag = {rnode = {spcNode = 0, dbNode =
32765,
relNode = 0}, forkNum = 32765, blockNum = 0}}, {tag =
{rnode = {spcNode = 0, dbNode = 0, relNode = 0}, forkNum = INIT_FORKNUM,
blockNum = 4294967295}}, {tag = {rnode = {spcNode = 3343886648, dbNode =
32623,
relNode = 0}, forkNum = MAIN_FORKNUM, blockNum = 0}},
{tag = {rnode = {spcNode = 0, dbNode = 4294967295, relNode = 4294967295},
forkNum = -951080648, blockNum = 32623}}, {tag = {rnode = {spcNode = 0,
dbNode = 32623, relNode = 32}, forkNum = 48, blockNum =
2343314848}}, {tag = {rnode = {spcNode = 32765, dbNode = 0, relNode = 0},
forkNum = 9734855, blockNum = 0}}, {tag = {rnode = {spcNode = 0, dbNode =
0,
relNode = 6}, forkNum = 32623, blockNum = 9734860}}, {tag
= {rnode = {spcNode = 0, dbNode = 0, relNode = 0}, forkNum = MAIN_FORKNUM,
blockNum = 0}}, {tag = {rnode = {spcNode = 0, dbNode = 32765,
relNode = 2343314533}, forkNum = 32765, blockNum = 0}},
{tag = {rnode = {spcNode = 0, dbNode = 0, relNode = 32765}, forkNum =
MAIN_FORKNUM, blockNum = 0}}, {tag = {rnode = {spcNode = 0, dbNode = 0,
relNode = 4294967295}, forkNum = InvalidForkNumber,
blockNum = 3343886648}}, {tag = {rnode = {spcNode = 32623, dbNode = 0,
relNode = 32623}, forkNum = 16, blockNum = 48}}, {tag = {rnode = {spcNode =
2343315152,
dbNode = 32765, relNode = 2343314944}, forkNum = 32765,
blockNum = 9434791}}, {tag = {rnode = {spcNode = 0, dbNode = 0, relNode =
0}, forkNum = INIT_FORKNUM, blockNum = 0}}, {tag = {rnode = {spcNode =
9434794,
dbNode = 0, relNode = 0}, forkNum = MAIN_FORKNUM,
blockNum = 0}}, {tag = {rnode = {spcNode = 0, dbNode = 4294967295, relNode
= 4294967295}, forkNum = -1951652320, blockNum = 32765}}, {tag = {rnode = {
spcNode = 2343314960, dbNode = 32765, relNode =
41731220}, forkNum = MAIN_FORKNUM, blockNum = 9795134}}, {tag = {rnode =
{spcNode = 0, dbNode = 41731192, relNode = 0}, forkNum = -951086535,
blockNum = 32623}}, {
tag = {rnode = {spcNode = 0, dbNode = 0, relNode = 4},
forkNum = 10, blockNum = 16}}, {tag = {rnode = {spcNode = 48, dbNode =
2343315296, relNode = 32765}, forkNum = -1951652208, blockNum = 32765}},
{tag = {rnode = {
spcNode = 0, dbNode = 0, relNode = 0}, forkNum =
MAIN_FORKNUM, blockNum = 3}}, {tag = {rnode = {spcNode = 32623, dbNode =
3343886648, relNode = 32623}, forkNum = -1951653488, blockNum = 32765}},
{tag = {rnode = {
spcNode = 2343313744, dbNode = 32765, relNode =
4294967295}, forkNum = InvalidForkNumber, blockNum = 3343886648}}, {tag =
{rnode = {spcNode = 32623, dbNode = 0, relNode = 32623}, forkNum =
MAIN_FORKNUM,
blockNum = 48}}, {tag = {rnode = {spcNode = 0, dbNode = 0,
relNode = 0}, forkNum = 32765, blockNum = 9734855}}, {tag = {rnode =
{spcNode = 0, dbNode = 32, relNode = 0}, forkNum = MAIN_FORKNUM, blockNum =
0}}, {
tag = {rnode = {spcNode = 3343886648, dbNode = 32623, relNode
= 0}, forkNum = MAIN_FORKNUM, blockNum = 0}}, {tag = {rnode = {spcNode = 0,
dbNode = 0, relNode = 32765}, forkNum = MAIN_FORKNUM, blockNum = 0}}, {tag
= {
rnode = {spcNode = 0, dbNode = 0, relNode = 0}, forkNum =
MAIN_FORKNUM, blockNum = 4294967295}}, {tag = {rnode = {spcNode =
4294967295, dbNode = 3343886648, relNode = 32623}, forkNum = 8, blockNum =
16}}, {tag = {
rnode = {spcNode = 2309886240, dbNode = 1127760177, relNode
= 2343313776}, forkNum = 32765, blockNum = 2343314384}}, {tag = {rnode =
{spcNode = 32765, dbNode = 2343313776, relNode = 32765}, forkNum = 8449408,
blockNum = 0}}, {tag = {rnode = {spcNode = 2343314152,
dbNode = 32765, relNode = 1}, forkNum = MAIN_FORKNUM, blockNum = 1023}},
{tag = {rnode = {spcNode = 0, dbNode = 2343314384, relNode = 32765},
forkNum = -950277931, blockNum = 32623}}, {tag = {rnode =
{spcNode = 4222451713, dbNode = 0, relNode = 2343314384}, forkNum = 32765,
blockNum = 2343314384}}, {tag = {rnode = {spcNode = 32765, dbNode =
2343314384,
relNode = 32765}, forkNum = -1951652912, blockNum =
32765}}, {tag = {rnode = {spcNode = 2343314409, dbNode = 32765, relNode =
2343315407}, forkNum = 32765, blockNum = 2343314384}}, {tag = {rnode = {
spcNode = 32765, dbNode = 2343315407, relNode = 32765},
forkNum = MAIN_FORKNUM, blockNum = 0}}, {tag = {rnode = {spcNode = 0,
dbNode = 0, relNode = 0}, forkNum = MAIN_FORKNUM, blockNum = 0}}, {tag =
{rnode = {
spcNode = 0, dbNode = 0, relNode = 0}, forkNum = 12,
blockNum = 4}}, {tag = {rnode = {spcNode = 9616896, dbNode = 0, relNode =
2343305216}, forkNum = 942833661, blockNum = 0}}, {tag = {rnode = {spcNode
= 0,
dbNode = 2343314512, relNode = 32765}, forkNum =
-1951652784, blockNum = 32765}}, {tag = {rnode = {spcNode = 12, dbNode = 0,
relNode = 0}, forkNum = MAIN_FORKNUM, blockNum = 8}}, {tag = {rnode =
{spcNode = 48,
dbNode = 2343315808, relNode = 32765}, forkNum =
InvalidForkNumber, blockNum = 808615933}}, {tag = {rnode = {spcNode =
2343314048, dbNode = 32765, relNode = 2343314576}, forkNum = 32765,
blockNum = 3347493952}}, {
tag = {rnode = {spcNode = 32623, dbNode = 0, relNode = 0},
forkNum = -947468368, blockNum = 32623}}, {tag = {rnode = {spcNode =
1951653217, dbNode = 4294934530, relNode = 2343314080}, forkNum = 32765,
blockNum = 2343314079}}, {tag = {rnode = {spcNode = 32765, dbNode =
2343314624, relNode = 32765}, forkNum = 12, blockNum = 0}}, {tag = {rnode =
{spcNode = 9616896, dbNode = 0, relNode = 2343314408},
forkNum = 32765, blockNum = 1}}, {tag = {rnode = {spcNode =
0, dbNode = 2343314096, relNode = 32765}, forkNum = 6796, blockNum = 0}},
{tag = {rnode = {spcNode = 155648, dbNode = 0, relNode = 526916352},
forkNum = 32620, blockNum = 6}}, {tag = {rnode = {spcNode =
0, dbNode = 3347498848, relNode = 32623}, forkNum = -947468448, blockNum =
32623}}, {tag = {rnode = {spcNode = 1, dbNode = 0, relNode = 1951653025},
forkNum = -32766, blockNum = 2052}}, {tag = {rnode =
{spcNode = 0, dbNode = 513, relNode = 0}, forkNum = 64, blockNum = 0}},
{tag = {rnode = {spcNode = 561, dbNode = 155, relNode = 2343314272},
forkNum = 32765,
blockNum = 8}}, {tag = {rnode = {spcNode = 0, dbNode = 1,
relNode = 0}, forkNum = 118, blockNum = 120}}, {tag = {rnode = {spcNode =
0, dbNode = 0, relNode = 2343314271}, forkNum = 32765, blockNum = 1}}, {tag
= {
rnode = {spcNode = 0, dbNode = 118, relNode = 120}, forkNum
= MAIN_FORKNUM, blockNum = 0}}, {tag = {rnode = {spcNode = 124, dbNode =
32765, relNode = 6987421}, forkNum = MAIN_FORKNUM, blockNum = 4036731840}},
{
tag = {rnode = {spcNode = 13747, dbNode = 2343314384, relNode
= 32765}, forkNum = 124, blockNum = 0}}, {tag = {rnode = {spcNode = 384,
dbNode = 0, relNode = 6}, forkNum = MAIN_FORKNUM, blockNum = 3347498848}}, {
tag = {rnode = {spcNode = 32623, dbNode = 42324488, relNode =
0}, forkNum = 42324506, blockNum = 0}}, {tag = {rnode = {spcNode = 4,
dbNode = 0, relNode = 3344354262}, forkNum = 32623, blockNum = 42324416}},
{tag = {
rnode = {spcNode = 0, dbNode = 42324464, relNode = 0},
forkNum = -192, blockNum = 4294967295}}, {tag = {rnode = {spcNode = 0,
dbNode = 0, relNode = 3}, forkNum = MAIN_FORKNUM, blockNum = 3344353169}},
{tag = {
rnode = {spcNode = 32623, dbNode = 128, relNode = 0},
forkNum = INIT_FORKNUM, blockNum = 0}}, {tag = {rnode = {spcNode = 128,
dbNode = 0, relNode = 0}, forkNum = MAIN_FORKNUM, blockNum = 4029030200}},
{tag = {
rnode = {spcNode = 13747, dbNode = 3, relNode = 0}, forkNum
= INIT_FORKNUM, blockNum = 0}}, {tag = {rnode = {spcNode = 3344353005,
dbNode = 32623, relNode = 41743440}, forkNum = MAIN_FORKNUM, blockNum =
6985401}}, {
tag = {rnode = {spcNode = 0, dbNode = 42324416, relNode = 0},
forkNum = 4895616, blockNum = 0}}, {tag = {rnode = {spcNode = 41743440,
dbNode = 0, relNode = 6985401}, forkNum = MAIN_FORKNUM, blockNum =
42324416}}, {
tag = {rnode = {spcNode = 0, dbNode = 6876528, relNode = 0},
forkNum = 41733255, blockNum = 0}}, {tag = {rnode = {spcNode = 0, dbNode =
0, relNode = 0}, forkNum = MAIN_FORKNUM, blockNum = 0}}, {tag = {rnode = {
spcNode = 0, dbNode = 0, relNode = 0}, forkNum =
MAIN_FORKNUM, blockNum = 0}}, {tag = {rnode = {spcNode = 2343314816, dbNode
= 4, relNode = 3343787445}, forkNum = 32623, blockNum = 41680896}}, {tag =
{rnode = {
spcNode = 0, dbNode = 0, relNode = 0}, forkNum =
41867936, blockNum = 0}}...}}
#5 0x00000000006a8477 in CheckPointBuffers (flags=flags@entry=128) at
bufmgr.c:2578
No locals.
#6 0x00000000004dd781 in CheckPointGuts (checkPointRedo=<optimized out>,
flags=<optimized out>) at xlog.c:8698
No locals.
#7 0x00000000004e9faf in CreateRestartPoint (flags=<optimized out>) at
xlog.c:8856
lastCheckPointRecPtr = <optimized out>
lastCheckPointEndPtr = <optimized out>
lastCheckPoint = <optimized out>
PriorRedoPtr = <optimized out>
xtime = <optimized out>
__func__ = "CreateRestartPoint"
#8 0x000000000066977c in CheckpointerMain () at checkpointer.c:490
ckpt_performed = 0 '\000'
do_restartpoint = 1 '\001'
flags = 128
do_checkpoint = <optimized out>
now = 1515455518
elapsed_secs = 300
cur_timeout = <optimized out>
rc = <optimized out>
local_sigjmp_buf = {{__jmpbuf = {140726946769872,
-6702958939962280073, 2, 8447397, 0, 41868768, -6702958940010514569,
6701736465640912759}, __mask_was_saved = 1, __saved_mask = {__val =
{18446744066192964103,
140726946769792, 2, 8447397, 0, 41868768, 6968122, 0, 0, 0,
0, 0, 4, 8, 6700557, 1}}}}
checkpointer_context = 0x27cbb88
__func__ = "CheckpointerMain"
#9 0x00000000004f2820 in AuxiliaryProcessMain (argc=argc@entry=2,
argv=argv@entry=0x7ffd8bac2b80) at bootstrap.c:429
progname = 0x80e5a5 "postgres"
flag = <optimized out>
userDoption = 0x0
__func__ = "AuxiliaryProcessMain"
#10 0x0000000000673330 in StartChildProcess (type=CheckpointerProcess) at
postmaster.c:5252
pid = <optimized out>
av = {0x80e5a5 "postgres", 0x7ffd8bac2bd0 "-x4", 0x0,
0xffec105a240ead00 <Address 0xffec105a240ead00 out of bounds>, 0x1 <Address
0x1 out of bounds>, 0x39e6 <Address 0x39e6 out of bounds>, 0x7ffd8bac2bf4
"",
0x27ede00 "\260\215\301", 0x7f6fc9248800 "", 0x0}
ac = 2
typebuf =
"-x4\000\000\000\000\000vCg\000\000\000\000\000\360>N\307o\177\000\000\065\233N\307o\177\000"
#11 0x0000000000674b1f in sigusr1_handler (postgres_signal_arg=<optimized
out>) at postmaster.c:4949
save_errno = 0
__func__ = "sigusr1_handler"
#12 <signal handler called>
No symbol table info available.
#13 0x00007f6fc75a0b83 in __select_nocancel () from /lib64/libc.so.6
No symbol table info available.
#14 0x000000000046ef32 in ServerLoop () at postmaster.c:1683
timeout = {tv_sec = 59, tv_usec = 999708}
rmask = {fds_bits = {120, 0 <repeats 15 times>}}
selres = <optimized out>
now = <optimized out>
readmask = {fds_bits = {120, 0 <repeats 15 times>}}
last_lockfile_recheck_time = 1515438348
last_touch_time = 1515438348
__func__ = "ServerLoop"
#15 0x0000000000675b69 in PostmasterMain (argc=argc@entry=3,
argv=argv@entry=0x27ca210)
at postmaster.c:1327
opt = <optimized out>
status = <optimized out>
userDoption = <optimized out>
listen_addr_saved = <optimized out>
i = <optimized out>
output_config_variable = <optimized out>
__func__ = "PostmasterMain"
#16 0x000000000047053e in main (argc=3, argv=0x27ca210) at main.c:228
Kind Regards,
Glauco Torres
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: Segmentation fault with core dump
2018-01-10 11:49 Segmentation fault with core dump Glauco Torres <torres.glauco@gmail.com>
@ 2018-01-10 17:08 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-01-10 17:13 ` Re: Segmentation fault with core dump Merlin Moncure <mmoncure@gmail.com>
2018-01-10 17:37 ` Re: Segmentation fault with core dump Alvaro Herrera <alvherre@alvh.no-ip.org>
0 siblings, 2 replies; 32+ messages in thread
From: Tom Lane @ 2018-01-10 17:08 UTC (permalink / raw)
To: Glauco Torres <torres.glauco@gmail.com>; +Cc: pgsql-general
Glauco Torres <torres.glauco@gmail.com> writes:
> (gdb) bt
> #0 ckpt_buforder_comparator (pa=pa@entry=0x7f6fa9ef4b2c,
> pb=pb@entry=0x1be06d2d06644)
> at bufmgr.c:4137
> #1 0x0000000000801268 in med3 (a=0x7f6fa9ef4b2c "\177\006",
> b=0x1be06d2d06644 <Address 0x1be06d2d06644 out of bounds>,
> c=0x2fc9dfbb1815c <Address 0x2fc9dfbb1815c out of bounds>, cmp=0x6a4d20
> <ckpt_buforder_comparator>)
> at qsort.c:107
> #2 0x0000000000801621 in pg_qsort (a=0x7f6fa9ef4b2c, a@entry=0x7f6fa9ea8380,
> n=<optimized out>, es=es@entry=20, cmp=cmp@entry=0x6a4d20
> <ckpt_buforder_comparator>) at qsort.c:157
> #3 0x00000000008015e2 in pg_qsort (a=0x7f6fa9ea8380, n=<optimized out>,
> n@entry=111473, es=es@entry=20, cmp=cmp@entry=0x6a4d20
> <ckpt_buforder_comparator>) at qsort.c:203
> #4 0x00000000006a81cf in BufferSync (flags=flags@entry=128) at
> bufmgr.c:1863
Hm. I'm not normally one to jump to the conclusion that something is a
compiler bug, but it's hard to explain this stack trace any other way.
The value of "n" passed to the inner invocation of pg_qsort should not
have been more than 29914, but working from either the value of d or the
value of pn leads to the conclusion that it was 0x7f6fa9f3a470, which
looks a lot more like an address in the array than a proper value of n.
I suppose this might be due to a corrupted copy of the postgres executable
rather than an actual compiler bug. Did you build it yourself?
BTW, I notice that ckpt_buforder_comparator assumes it can't possibly
see the same block ID twice in the array, which I think is an
unsupportable assumption. But I cannot see a way that that could lead
to a crash in pg_qsort --- at worst it might cause a little inefficiency.
regards, tom lane
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: Segmentation fault with core dump
2018-01-10 11:49 Segmentation fault with core dump Glauco Torres <torres.glauco@gmail.com>
2018-01-10 17:08 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
@ 2018-01-10 17:13 ` Merlin Moncure <mmoncure@gmail.com>
2018-01-10 17:47 ` Re: Segmentation fault with core dump Alvaro Herrera <alvherre@alvh.no-ip.org>
1 sibling, 1 reply; 32+ messages in thread
From: Merlin Moncure @ 2018-01-10 17:13 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Glauco Torres <torres.glauco@gmail.com>; pgsql-general
On Wed, Jan 10, 2018 at 11:08 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Glauco Torres <torres.glauco@gmail.com> writes:
>> (gdb) bt
>> #0 ckpt_buforder_comparator (pa=pa@entry=0x7f6fa9ef4b2c,
>> pb=pb@entry=0x1be06d2d06644)
>> at bufmgr.c:4137
>> #1 0x0000000000801268 in med3 (a=0x7f6fa9ef4b2c "\177\006",
>> b=0x1be06d2d06644 <Address 0x1be06d2d06644 out of bounds>,
>> c=0x2fc9dfbb1815c <Address 0x2fc9dfbb1815c out of bounds>, cmp=0x6a4d20
>> <ckpt_buforder_comparator>)
>> at qsort.c:107
>> #2 0x0000000000801621 in pg_qsort (a=0x7f6fa9ef4b2c, a@entry=0x7f6fa9ea8380,
>> n=<optimized out>, es=es@entry=20, cmp=cmp@entry=0x6a4d20
>> <ckpt_buforder_comparator>) at qsort.c:157
>> #3 0x00000000008015e2 in pg_qsort (a=0x7f6fa9ea8380, n=<optimized out>,
>> n@entry=111473, es=es@entry=20, cmp=cmp@entry=0x6a4d20
>> <ckpt_buforder_comparator>) at qsort.c:203
>> #4 0x00000000006a81cf in BufferSync (flags=flags@entry=128) at
>> bufmgr.c:1863
>
> Hm. I'm not normally one to jump to the conclusion that something is a
> compiler bug, but it's hard to explain this stack trace any other way.
> The value of "n" passed to the inner invocation of pg_qsort should not
> have been more than 29914, but working from either the value of d or the
> value of pn leads to the conclusion that it was 0x7f6fa9f3a470, which
> looks a lot more like an address in the array than a proper value of n.
>
> I suppose this might be due to a corrupted copy of the postgres executable
> rather than an actual compiler bug. Did you build it yourself?
>
> BTW, I notice that ckpt_buforder_comparator assumes it can't possibly
> see the same block ID twice in the array, which I think is an
> unsupportable assumption. But I cannot see a way that that could lead
> to a crash in pg_qsort --- at worst it might cause a little inefficiency.
simple
SELECT version();
...can give a lot of hints on who/what compiled the database if you don't know.
merlin
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: Segmentation fault with core dump
2018-01-10 11:49 Segmentation fault with core dump Glauco Torres <torres.glauco@gmail.com>
2018-01-10 17:08 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
2018-01-10 17:13 ` Re: Segmentation fault with core dump Merlin Moncure <mmoncure@gmail.com>
@ 2018-01-10 17:47 ` Alvaro Herrera <alvherre@alvh.no-ip.org>
0 siblings, 0 replies; 32+ messages in thread
From: Alvaro Herrera @ 2018-01-10 17:47 UTC (permalink / raw)
To: Merlin Moncure <mmoncure@gmail.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Glauco Torres <torres.glauco@gmail.com>; pgsql-general
Merlin Moncure wrote:
> simple
> SELECT version();
> ...can give a lot of hints on who/what compiled the database if you don't know.
Probably, this is why Glauco included the output in his opening letter.
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: Segmentation fault with core dump
2018-01-10 11:49 Segmentation fault with core dump Glauco Torres <torres.glauco@gmail.com>
2018-01-10 17:08 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
@ 2018-01-10 17:37 ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2018-01-10 17:41 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 1 reply; 32+ messages in thread
From: Alvaro Herrera @ 2018-01-10 17:37 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Glauco Torres <torres.glauco@gmail.com>; pgsql-general
Tom Lane wrote:
> Glauco Torres <torres.glauco@gmail.com> writes:
> > (gdb) bt
> > #0 ckpt_buforder_comparator (pa=pa@entry=0x7f6fa9ef4b2c,
> > pb=pb@entry=0x1be06d2d06644)
> > at bufmgr.c:4137
> > #1 0x0000000000801268 in med3 (a=0x7f6fa9ef4b2c "\177\006",
> > b=0x1be06d2d06644 <Address 0x1be06d2d06644 out of bounds>,
> > c=0x2fc9dfbb1815c <Address 0x2fc9dfbb1815c out of bounds>, cmp=0x6a4d20
> > <ckpt_buforder_comparator>)
> > at qsort.c:107
> > #2 0x0000000000801621 in pg_qsort (a=0x7f6fa9ef4b2c, a@entry=0x7f6fa9ea8380,
> > n=<optimized out>, es=es@entry=20, cmp=cmp@entry=0x6a4d20
> > <ckpt_buforder_comparator>) at qsort.c:157
> > #3 0x00000000008015e2 in pg_qsort (a=0x7f6fa9ea8380, n=<optimized out>,
> > n@entry=111473, es=es@entry=20, cmp=cmp@entry=0x6a4d20
> > <ckpt_buforder_comparator>) at qsort.c:203
> > #4 0x00000000006a81cf in BufferSync (flags=flags@entry=128) at
> > bufmgr.c:1863
>
> Hm. I'm not normally one to jump to the conclusion that something is a
> compiler bug, but it's hard to explain this stack trace any other way.
> The value of "n" passed to the inner invocation of pg_qsort should not
> have been more than 29914, but working from either the value of d or the
> value of pn leads to the conclusion that it was 0x7f6fa9f3a470, which
> looks a lot more like an address in the array than a proper value of n.
>
> I suppose this might be due to a corrupted copy of the postgres executable
> rather than an actual compiler bug. Did you build it yourself?
Hmm, is this something that can be explained by using a different
postgres executable in GDB than the one that produced the core file?
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: Segmentation fault with core dump
2018-01-10 11:49 Segmentation fault with core dump Glauco Torres <torres.glauco@gmail.com>
2018-01-10 17:08 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
2018-01-10 17:37 ` Re: Segmentation fault with core dump Alvaro Herrera <alvherre@alvh.no-ip.org>
@ 2018-01-10 17:41 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-01-10 18:04 ` Re: Segmentation fault with core dump Glauco Torres <torres.glauco@gmail.com>
0 siblings, 1 reply; 32+ messages in thread
From: Tom Lane @ 2018-01-10 17:41 UTC (permalink / raw)
To: Alvaro Herrera <alvherre@alvh.no-ip.org>; +Cc: Glauco Torres <torres.glauco@gmail.com>; pgsql-general
Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> Tom Lane wrote:
>> Hm. I'm not normally one to jump to the conclusion that something is a
>> compiler bug, but it's hard to explain this stack trace any other way.
>> The value of "n" passed to the inner invocation of pg_qsort should not
>> have been more than 29914, but working from either the value of d or the
>> value of pn leads to the conclusion that it was 0x7f6fa9f3a470, which
>> looks a lot more like an address in the array than a proper value of n.
> Hmm, is this something that can be explained by using a different
> postgres executable in GDB than the one that produced the core file?
That would result in nonsensical gdb output, most likely; but Glauco's
trace is internally consistent enough that I doubt gdb is lying to us.
In any case, the crash is an observable fact :-(
regards, tom lane
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: Segmentation fault with core dump
2018-01-10 11:49 Segmentation fault with core dump Glauco Torres <torres.glauco@gmail.com>
2018-01-10 17:08 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
2018-01-10 17:37 ` Re: Segmentation fault with core dump Alvaro Herrera <alvherre@alvh.no-ip.org>
2018-01-10 17:41 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
@ 2018-01-10 18:04 ` Glauco Torres <torres.glauco@gmail.com>
2018-01-10 18:12 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 32+ messages in thread
From: Glauco Torres @ 2018-01-10 18:04 UTC (permalink / raw)
To: pgsql-general
>
> That would result in nonsensical gdb output, most likely; but Glauco's
> trace is internally consistent enough that I doubt gdb is lying to us.
> In any case, the crash is an observable fact :-(
>
>
> The system is a CentOS 7, and PG was installed using PGDG's YUM repository.
We are pretty sure that the same binary that crashed was using on `gdb`
command. More specifically, the path used was
`/usr/pgsql-9.6/bin/postmaster`, and we were running 9.6.6 (most recent 9.6
minor release today) for a few weeks, so there shouldn't have any upgrade
on the binaries since the server was up, specially because we restarted the
service in order to allow core dump creation, this is not the first crash
(although the only one with core dump generated so far), we can send new
gdb stack if it happens again.
More information:
$ uname -a
Linux pg-iii.br 3.10.0-514.10.2.el7.x86_64 #1 SMP Fri Mar 3 00:04:05 UTC
2017 x86_64 x86_64 x86_64 GNU/Linux
$ /usr/pgsql-9.6/bin/pg_config
BINDIR = /usr/pgsql-9.6/bin
DOCDIR = /usr/pgsql-9.6/doc
HTMLDIR = /usr/pgsql-9.6/doc/html
INCLUDEDIR = /usr/pgsql-9.6/include
PKGINCLUDEDIR = /usr/pgsql-9.6/include
INCLUDEDIR-SERVER = /usr/pgsql-9.6/include/server
LIBDIR = /usr/pgsql-9.6/lib
PKGLIBDIR = /usr/pgsql-9.6/lib
LOCALEDIR = /usr/pgsql-9.6/share/locale
MANDIR = /usr/pgsql-9.6/share/man
SHAREDIR = /usr/pgsql-9.6/share
SYSCONFDIR = /etc/sysconfig/pgsql
PGXS = /usr/pgsql-9.6/lib/pgxs/src/makefiles/pgxs.mk
CONFIGURE = '--enable-rpath' '--prefix=/usr/pgsql-9.6'
'--includedir=/usr/pgsql-9.6/include' '--mandir=/usr/pgsql-9.6/share/man'
'--datadir=/usr/pgsql-9.6/share' '--libdir=/usr/pgsql-9.6/lib'
'--with-perl' '--with-python' '--with-tcl' '--with-tclconfig=/usr/lib64'
'--with-openssl' '--with-pam' '--with-gssapi'
'--with-includes=/usr/include' '--with-libraries=/usr/lib64' '--enable-nls'
'--enable-dtrace' '--with-uuid=e2fs' '--with-libxml' '--with-libxslt'
'--with-ldap' '--with-selinux' '--with-systemd'
'--with-system-tzdata=/usr/share/zoneinfo'
'--sysconfdir=/etc/sysconfig/pgsql' '--docdir=/usr/pgsql-9.6/doc'
'--htmldir=/usr/pgsql-9.6/doc/html' 'CFLAGS=-O2 -g -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong
--param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic'
'LDFLAGS=-Wl,--as-needed'
CC = gcc
CPPFLAGS = -DFRONTEND -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include
CFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute
-Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard
-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches
-m64 -mtune=generic
CFLAGS_SL = -fPIC
LDFLAGS = -L../../src/common -Wl,--as-needed -L/usr/lib64 -Wl,--as-needed
-Wl,-rpath,'/usr/pgsql-9.6/lib',--enable-new-dtags
LDFLAGS_EX =
LDFLAGS_SL =
LIBS = -lpgcommon -lpgport -lselinux -lxslt -lxml2 -lpam -lssl -lcrypto
-lgssapi_krb5 -lz -lreadline -lrt -lcrypt -ldl -lm
VERSION = PostgreSQL 9.6.6
Regards,
Glauco
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: Segmentation fault with core dump
2018-01-10 11:49 Segmentation fault with core dump Glauco Torres <torres.glauco@gmail.com>
2018-01-10 17:08 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
2018-01-10 17:37 ` Re: Segmentation fault with core dump Alvaro Herrera <alvherre@alvh.no-ip.org>
2018-01-10 17:41 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
2018-01-10 18:04 ` Re: Segmentation fault with core dump Glauco Torres <torres.glauco@gmail.com>
@ 2018-01-10 18:12 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-01-10 18:21 ` Re: Segmentation fault with core dump Glauco Torres <torres.glauco@gmail.com>
0 siblings, 1 reply; 32+ messages in thread
From: Tom Lane @ 2018-01-10 18:12 UTC (permalink / raw)
To: Glauco Torres <torres.glauco@gmail.com>; +Cc: pgsql-general
Glauco Torres <torres.glauco@gmail.com> writes:
>> The system is a CentOS 7, and PG was installed using PGDG's YUM repository.
Might be worth comparing sha1sum's of the postgres executable between
this server and one that's not having the problem, just to eliminate
the corrupted-binary theory.
regards, tom lane
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: Segmentation fault with core dump
2018-01-10 11:49 Segmentation fault with core dump Glauco Torres <torres.glauco@gmail.com>
2018-01-10 17:08 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
2018-01-10 17:37 ` Re: Segmentation fault with core dump Alvaro Herrera <alvherre@alvh.no-ip.org>
2018-01-10 17:41 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
2018-01-10 18:04 ` Re: Segmentation fault with core dump Glauco Torres <torres.glauco@gmail.com>
2018-01-10 18:12 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
@ 2018-01-10 18:21 ` Glauco Torres <torres.glauco@gmail.com>
2018-01-10 18:38 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 32+ messages in thread
From: Glauco Torres @ 2018-01-10 18:21 UTC (permalink / raw)
To: pgsql-general; +Cc: Matheus Oliveira <matheus.oliveira@ifood.com.br>
>
> Might be worth comparing sha1sum's of the postgres executable between
> this server and one that's not having the problem, just to eliminate
> the corrupted-binary theory.
>
>
>
The return is the same for the two servers,
$ sha1sum /usr/pgsql-9.6/bin/postmaster
56bcb4d644a8b00f07e9bd42f9a3f02be7ff2523 /usr/pgsql-9.6/bin/postmaster
Today I left to generate more core-dump, follow the return,
(gdb) bt
#0 tbm_comparator (left=left@entry=0x1d5ca08, right=right@entry=0x3acdb70)
at tidbitmap.c:1031
#1 0x0000000000801268 in med3 (a=0x1d5ca08 "\350>\337\001", b=0x3acdb70
<Address 0x3acdb70 out of bounds>, c=0x583ecd8 <Address 0x583ecd8 out of
bounds>, cmp=0x603ca0 <tbm_comparator>) at qsort.c:107
#2 0x0000000000801621 in pg_qsort (a=0x1d5ca08, n=<optimized out>,
n@entry=10477,
es=es@entry=8, cmp=cmp@entry=0x603ca0 <tbm_comparator>) at qsort.c:157
#3 0x0000000000604a7b in tbm_begin_iterate (tbm=tbm@entry=0x1dd8a00) at
tidbitmap.c:635
#4 0x00000000005d3a89 in BitmapHeapNext (node=node@entry=0x1dc2ef0) at
nodeBitmapHeapscan.c:110
#5 0x00000000005caf1a in ExecScanFetch (recheckMtd=0x5d35b0
<BitmapHeapRecheck>, accessMtd=0x5d35f0 <BitmapHeapNext>, node=0x1dc2ef0)
at execScan.c:95
#6 ExecScan (node=node@entry=0x1dc2ef0, accessMtd=accessMtd@entry=0x5d35f0
<BitmapHeapNext>, recheckMtd=recheckMtd@entry=0x5d35b0 <BitmapHeapRecheck>)
at execScan.c:180
#7 0x00000000005d3cff in ExecBitmapHeapScan (node=node@entry=0x1dc2ef0) at
nodeBitmapHeapscan.c:440
#8 0x00000000005c3fb8 in ExecProcNode (node=node@entry=0x1dc2ef0) at
execProcnode.c:437
#9 0x00000000005de877 in ExecNestLoop (node=node@entry=0x1dc0148) at
nodeNestloop.c:174
#10 0x00000000005c3f28 in ExecProcNode (node=node@entry=0x1dc0148) at
execProcnode.c:476
#11 0x00000000005de7d7 in ExecNestLoop (node=node@entry=0x1dbfdd8) at
nodeNestloop.c:123
#12 0x00000000005c3f28 in ExecProcNode (node=node@entry=0x1dbfdd8) at
execProcnode.c:476
#13 0x00000000005d624d in MultiExecHash (node=node@entry=0x1dbf9b8) at
nodeHash.c:104
#14 0x00000000005c40c0 in MultiExecProcNode (node=node@entry=0x1dbf9b8) at
execProcnode.c:577
#15 0x00000000005d6cb9 in ExecHashJoin (node=node@entry=0x1dbe688) at
nodeHashjoin.c:178
#16 0x00000000005c3f08 in ExecProcNode (node=node@entry=0x1dbe688) at
execProcnode.c:484
#17 0x00000000005de7d7 in ExecNestLoop (node=node@entry=0x1dbc6e0) at
nodeNestloop.c:123
#18 0x00000000005c3f28 in ExecProcNode (node=node@entry=0x1dbc6e0) at
execProcnode.c:476
#19 0x00000000005de7d7 in ExecNestLoop (node=node@entry=0x1dbc520) at
nodeNestloop.c:123
#20 0x00000000005c3f28 in ExecProcNode (node=0x1dbc520) at
execProcnode.c:476
#21 0x00000000005cf619 in fetch_input_tuple (aggstate=aggstate@entry=0x1dbbc48)
at nodeAgg.c:598
#22 0x00000000005d10ff in agg_retrieve_direct (aggstate=0x1dbbc48) at
nodeAgg.c:2067
#23 ExecAgg (node=node@entry=0x1dbbc48) at nodeAgg.c:1892
#24 0x00000000005c3ec8 in ExecProcNode (node=node@entry=0x1dbbc48) at
execProcnode.c:503
#25 0x00000000005c03a7 in ExecutePlan (dest=0x1b607c8, direction=<optimized
out>, numberTuples=0, sendTuples=1 '\001', operation=CMD_SELECT,
use_parallel_mode=<optimized out>, planstate=0x1dbbc48, estate=0x1dbba58)
at execMain.c:1566
#26 standard_ExecutorRun (queryDesc=0x1c98de0, direction=<optimized out>,
count=0) at execMain.c:338
#27 0x00007f016577e0a5 in pgss_ExecutorRun (queryDesc=0x1c98de0,
direction=ForwardScanDirection, count=0) at pg_stat_statements.c:877
#28 0x00000000006d3a97 in PortalRunSelect (portal=portal@entry=0x1ad9278,
forward=forward@entry=1 '\001', count=0, count@entry=9223372036854775807,
dest=dest@entry=0x1b607c8) at pquery.c:948
#29 0x00000000006d4eab in PortalRun (portal=0x1ad9278,
count=9223372036854775807, isTopLevel=<optimized out>, dest=0x1b607c8,
altdest=0x1b607c8, completionTag=0x7ffdfe32a700 "") at pquery.c:789
#30 0x00000000006d2371 in PostgresMain (argc=<optimized out>,
argv=<optimized out>, dbname=<optimized out>, username=<optimized out>) at
postgres.c:1969
#31 0x000000000046f8d4 in BackendRun (port=0x1add6d0) at postmaster.c:4294
#32 BackendStartup (port=0x1add6d0) at postmaster.c:3968
#33 ServerLoop () at postmaster.c:1719
#34 0x0000000000675b69 in PostmasterMain (argc=argc@entry=3,
argv=argv@entry=0x1ab1210)
at postmaster.c:1327
#35 0x000000000047053e in main (argc=3, argv=0x1ab1210) at main.c:228
Regards,
Glauco
^ permalink raw reply [nested|flat] 32+ messages in thread
* Re: Segmentation fault with core dump
2018-01-10 11:49 Segmentation fault with core dump Glauco Torres <torres.glauco@gmail.com>
2018-01-10 17:08 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
2018-01-10 17:37 ` Re: Segmentation fault with core dump Alvaro Herrera <alvherre@alvh.no-ip.org>
2018-01-10 17:41 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
2018-01-10 18:04 ` Re: Segmentation fault with core dump Glauco Torres <torres.glauco@gmail.com>
2018-01-10 18:12 ` Re: Segmentation fault with core dump Tom Lane <tgl@sss.pgh.pa.us>
2018-01-10 18:21 ` Re: Segmentation fault with core dump Glauco Torres <torres.glauco@gmail.com>
@ 2018-01-10 18:38 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 32+ messages in thread
From: Tom Lane @ 2018-01-10 18:38 UTC (permalink / raw)
To: Glauco Torres <torres.glauco@gmail.com>; +Cc: pgsql-general; Matheus Oliveira <matheus.oliveira@ifood.com.br>
Glauco Torres <torres.glauco@gmail.com> writes:
> Today I left to generate more core-dump, follow the return,
> (gdb) bt
> #0 tbm_comparator (left=left@entry=0x1d5ca08, right=right@entry=0x3acdb70)
> at tidbitmap.c:1031
> #1 0x0000000000801268 in med3 (a=0x1d5ca08 "\350>\337\001", b=0x3acdb70
> <Address 0x3acdb70 out of bounds>, c=0x583ecd8 <Address 0x583ecd8 out of
> bounds>, cmp=0x603ca0 <tbm_comparator>) at qsort.c:107
> #2 0x0000000000801621 in pg_qsort (a=0x1d5ca08, n=<optimized out>,
> n@entry=10477,
> es=es@entry=8, cmp=cmp@entry=0x603ca0 <tbm_comparator>) at qsort.c:157
> #3 0x0000000000604a7b in tbm_begin_iterate (tbm=tbm@entry=0x1dd8a00) at
> tidbitmap.c:635
Oh ho! I was wondering to myself "if pg_qsort is broken, why isn't
his system falling over everywhere?". The answer evidently is
"yes, it is falling over everywhere". This symptom looks pretty much
like what you had before, ie far-out-of-range addresses getting passed
to med3(), but the qsort call site is completely different.
Since you've eliminated the idea that the executable file per se
is different from your working servers, I think we're now down to
the conclusion that there's something flaky about the hardware
on this server. Maybe it's misexecuting integer divide every so
often --- though it's hard to guess why only pg_qsort would be
affected.
regards, tom lane
^ permalink raw reply [nested|flat] 32+ messages in thread
end of thread, other threads:[~2018-01-10 18:38 UTC | newest]
Thread overview: 32+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-04-10 21:34 Segmentation fault with core dump Joshua Berry <yoberi@gmail.com>
2013-04-10 21:40 ` Alvaro Herrera <alvherre@2ndquadrant.com>
2013-04-10 21:49 ` Andres Freund <andres@2ndquadrant.com>
2013-04-10 21:53 ` Joshua Berry <yoberi@gmail.com>
2013-04-10 22:22 ` Andres Freund <andres@2ndquadrant.com>
2013-04-10 22:31 ` Joshua Berry <yoberi@gmail.com>
2013-04-10 23:13 ` Andres Freund <andres@2ndquadrant.com>
2013-04-10 23:22 ` Tom Lane <tgl@sss.pgh.pa.us>
2013-04-10 23:25 ` Joshua Berry <yoberi@gmail.com>
2013-04-10 23:28 ` Andres Freund <andres@2ndquadrant.com>
2013-04-10 23:34 ` Joshua Berry <yoberi@gmail.com>
2013-04-10 22:35 ` Tom Lane <tgl@sss.pgh.pa.us>
2013-04-10 23:06 ` Tom Lane <tgl@sss.pgh.pa.us>
2013-04-10 23:21 ` Andres Freund <andres@2ndquadrant.com>
2013-04-10 23:29 ` Tom Lane <tgl@sss.pgh.pa.us>
2013-04-10 23:37 ` Andres Freund <andres@2ndquadrant.com>
2013-04-10 23:32 ` Andres Freund <andres@2ndquadrant.com>
2013-04-12 11:12 ` Andres Freund <andres@2ndquadrant.com>
2013-05-08 16:39 ` Joshua Berry <yoberi@gmail.com>
2013-06-11 14:53 ` Hiroshi Inoue <inoue@tpf.co.jp>
2013-06-11 15:03 ` Tom Lane <tgl@sss.pgh.pa.us>
2013-06-12 03:25 ` Inoue, Hiroshi <inoue@tpf.co.jp>
2018-01-10 11:49 Segmentation fault with core dump Glauco Torres <torres.glauco@gmail.com>
2018-01-10 17:08 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-01-10 17:13 ` Merlin Moncure <mmoncure@gmail.com>
2018-01-10 17:47 ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2018-01-10 17:37 ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2018-01-10 17:41 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-01-10 18:04 ` Glauco Torres <torres.glauco@gmail.com>
2018-01-10 18:12 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-01-10 18:21 ` Glauco Torres <torres.glauco@gmail.com>
2018-01-10 18:38 ` Tom Lane <tgl@sss.pgh.pa.us>
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