Re: [BUGS] Bus error in formatting.c NUM_numpart_to_char (9.4.12, 9.6.3, sparc)

Поиск
Список
Период
Сортировка
От Tom Turelinckx
Тема Re: [BUGS] Bus error in formatting.c NUM_numpart_to_char (9.4.12, 9.6.3, sparc)
Дата
Msg-id 00ac01d2ef48$6288c520$279a4f60$@turelinckx.be
обсуждение исходный текст
Ответ на Re: [BUGS] Bus error in formatting.c NUM_numpart_to_char (9.4.12, 9.6.3, sparc)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
Tom Turelinckx wrote:

> Switching to gcc-4.7 does not solve the alignment issue in 9.4.7 (resolved in 9.4.8) discussed here:
>
> https://www.postgresql.org/message-id/20160413094117.GC21485@msg.credativ.de
>
> Tom Lane wrote:
>
> > We never did get a clear explanation of why that crashed on Sparc.

With gcc 4.7, against postgresql 9.4.7.

Clean 9.4.7 fails contrib/test-decoding:

LOG:  server process (PID 18295) was terminated by signal 10: Bus error
DETAIL:  Failed process was running: SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL,
'include-xids','0', 'skip-empty-xacts', '1'); 

Reading symbols from /home/turelto/src/947/original/postgresql-9.4-9.4.7/build/src/backend/postgres...done.
[New LWP 18295]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/sparc-linux-gnu/libthread_db.so.1".
Core was generated by `postgres: turelto regression [local] SELECT                                   '.
Program terminated with signal 10, Bus error.
#0  ReorderBufferRestoreChange (data=0x5e1acf "", txn=0x6143a0, rb=0x614318)   at
/home/turelto/src/947/original/postgresql-9.4-9.4.7/build/../src/backend/replication/logical/reorderbuffer.c:2327
2327                                    Size            tuplelen = ((HeapTuple) data)->t_len;
(gdb) l
2322                                    data += tuplelen;
2323                            }
2324
2325                            if (change->data.tp.newtuple)
2326                            {
2327                                    Size            tuplelen = ((HeapTuple) data)->t_len;
2328
2329                                    change->data.tp.newtuple =
2330                                            ReorderBufferGetTupleBuf(rb, tuplelen - offsetof(HeapTupleHeaderData,
t_bits));
2331

After applying this commit from 9.4.8 against 9.4.7, patched 9.4.7 passes all tests:

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=0045691

Assembly snippet around line 2327 before patching:

.LBB695:
.LBB694:.loc 3 52 0mov    20, %o2add    %o0, 4, %o0
.LVL301:call    memcpy, 0 add    %l6, %l4, %l7
.LVL302:
.LBE694:
.LBE695:.loc 1 2318 0ld    [%l5+28], %g2
.LBB696:
.LBB697:.loc 3 52 0mov    %l6, %o1mov    %l4, %o2
.LBE697:
.LBE696:.loc 1 2318 0add    %g2, 35, %g1and    %g1, -8, %g1.loc 1 2317 0st    %g1, [%g2+20]
.LVL303:.loc 1 2321 0ld    [%l5+28], %g1
.LBB699:
.LBB698:.loc 3 52 0call    memcpy, 0 ld    [%g1+20], %o0
.LVL304:
.LBE698:
.LBE699:
.LBE691:.loc 1 2325 0ld    [%l5+32], %g1
.L355:cmp    %g1, 0be,a,pn    %icc, .L356 ld    [%i1+84], %g2
.LBB700:.loc 1 2327 0ld    [%l7], %l6
.LVL305:.loc 1 2330 0mov    %i0, %o0call    ReorderBufferGetTupleBuf, 0 add    %l6, -23, %o1
.LVL306:.loc 1 2329 0st    %o0, [%l5+32]
.LVL307:
.LBB701:
.LBB702:.loc 3 52 0mov    %l7, %o1mov    20, %o2
.LVL308:call    memcpy, 0 add    %o0, 4, %o0
.LVL309:
.LBE702:
.LBE701:.loc 1 2339 0ld    [%l5+32], %g1
.LBB703:
.LBB704:.loc 3 52 0add    %l7, 20, %o1
.LVL310:mov    %l6, %o2
.LBE704:
.LBE703:.loc 1 2339 0add    %g1, 35, %g2and    %g2, -8, %g2.loc 1 2338 0st    %g2, [%g1+20]
.LVL311:.loc 1 2342 0ld    [%l5+32], %g1
.LBB706:
.LBB705:.loc 3 52 0call    memcpy, 0 ld    [%g1+20], %o0
.LVL312:
.LBE705:
.LBE706:
.LBE700:
.LBB707:
.LBB708:

Assembly snippet after patching:

.LBB699:
.LBB698:.loc 3 52 0mov    20, %o2add    %o0, 4, %o0
.LVL301:call    memcpy, 0 add    %l6, %l4, %l7
.LVL302:
.LBE698:
.LBE699:.loc 1 2322 0ld    [%l5+28], %g2
.LBB700:
.LBB701:.loc 3 52 0mov    %l6, %o1mov    %l4, %o2
.LBE701:
.LBE700:.loc 1 2322 0add    %g2, 35, %g1and    %g1, -8, %g1.loc 1 2321 0st    %g1, [%g2+20]
.LVL303:.loc 1 2325 0ld    [%l5+28], %g1
.LBB703:
.LBB702:.loc 3 52 0call    memcpy, 0 ld    [%g1+20], %o0
.LVL304:
.LBE702:
.LBE703:
.LBE695:.loc 1 2329 0ld    [%l5+32], %g1
.L355:cmp    %g1, 0be,a,pn    %icc, .L356 ld    [%i1+84], %g2
.LVL305:
.LBB704:
.LBB705:
.LBB706:.loc 3 52 0ldub    [%l7], %g1
.LBE706:
.LBE705:.loc 1 2338 0mov    %i0, %o0
.LBB708:
.LBB707:.loc 3 52 0stb    %g1, [%fp-1036]
.LVL306:ldub    [%l7+1], %g1stb    %g1, [%fp-1035]ldub    [%l7+2], %g1stb    %g1, [%fp-1034]ldub    [%l7+3], %g1stb
%g1,[%fp-1033] 
.LBE707:
.LBE708:.loc 1 2338 0ld    [%fp-1036], %o1call    ReorderBufferGetTupleBuf, 0 add    %o1, -23, %o1
.LVL307:.loc 1 2337 0st    %o0, [%l5+32]
.LVL308:
.LBB709:
.LBB710:.loc 3 52 0mov    %l7, %o1mov    20, %o2
.LVL309:call    memcpy, 0 add    %o0, 4, %o0
.LVL310:
.LBE710:
.LBE709:.loc 1 2347 0ld    [%l5+32], %g1
.LBB711:
.LBB712:.loc 3 52 0add    %l7, 20, %o1
.LVL311:ld    [%fp-1036], %o2
.LBE712:
.LBE711:.loc 1 2347 0add    %g1, 35, %g2and    %g2, -8, %g2.loc 1 2346 0st    %g2, [%g1+20]
.LVL312:.loc 1 2350 0ld    [%l5+32], %g1
.LBB714:
.LBB713:.loc 3 52 0call    memcpy, 0 ld    [%g1+20], %o0
.LVL313:
.LBE713:
.LBE714:
.LBE704:
.LBB715:
.LBB716:

Best regards,
Tom Turelinckx




--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

В списке pgsql-bugs по дате отправления:

Предыдущее
От: devrim@gunduz.org
Дата:
Сообщение: Re: [BUGS] libpq.so.5 dependancy error installing pgsql onto linux 6.
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: [BUGS] BUG #14719: Logical replication unexpected behaviour whentarget table has missing columns