Обсуждение: BUG #16237: When restoring database, backend disconnects or crashes when foreign key is created

Поиск
Список
Период
Сортировка

BUG #16237: When restoring database, backend disconnects or crashes when foreign key is created

От
PG Bug reporting form
Дата:
The following bug has been logged on the website:

Bug reference:      16237
Logged by:          Darryl Snover
Email address:      dsnover@electrainfo.com
PostgreSQL version: 12.1
Operating system:   Mac OS Catalina 10.15.2, EDB Install Image
Description:

When restoring a full database dump (psql -f filename), on one of the three
databases, when restoring, this error is occurring.  Is repeatable on a
different Mac.  Macintosh models:  MacBook Pro 16, clean OS installed, new
machine.  Also ran on 2012 Mac Mini Server, with Mac OS X Mojave 10.14, with
same errors.

Manually creating the constraint or any similar constraint causes the same
failure.

Log:

pg_restore: creating FK CONSTRAINT
"public.file_transit_transaction_file_transit_id_fkey"
pg_restore: from TOC entry 3972; 2606 4177792 FK CONSTRAINT
file_transit_transaction_file_transit_id_fkey postgres
pg_restore: error: could not execute query: server closed the connection
unexpectedly
    This probably means the server terminated abnormally
    before or while processing the request.
Command was: ALTER TABLE ONLY file_transit_transaction
    ADD CONSTRAINT file_transit_transaction_file_transit_id_fkey FOREIGN KEY
(file_transit_id) REFERENCES file_transit(file_transit_id);

CRASH REPORT EXAMPE (all are identical in that they all show same exception
type).

Process:               postgres [8984]
Path:                  /Users/USER/*/postgres
Identifier:            postgres
Version:               ???
Code Type:             X86-64 (Native)
Parent Process:        postgres [6396]
Responsible:           postgres [6396]
User ID:               503

Date/Time:             2020-01-25 15:11:35.585 -0500
OS Version:            Mac OS X 10.15.2 (19C57)
Report Version:        12
Bridge OS Version:     4.2 (17P2551)
Anonymous UUID:        C8E75799-5BBA-0E05-B04F-B6ADE1D72158

Sleep/Wake UUID:       70392B53-DF5A-408F-99CA-43E58A0CE312

Time Awake Since Boot: 27000 seconds
Time Since Wake:       3500 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (Code Signature Invalid)
Exception Codes:       0x0000000000000032, 0x000000010dd002d0
Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    Namespace CODESIGNING, Code 0x2

kernel messages:

VM Regions Near 0x10dd002d0:
    VM_ALLOCATE            000000010dcff000-000000010dd00000 [    4K]
r-x/rwx SM=PRV  
--> VM_ALLOCATE            000000010dd00000-000000010dd01000 [    4K]
r-x/rwx SM=PRV  
    __TEXT                 000000010dd01000-000000010dd8d000 [  560K]
r-x/rwx SM=COW  /Users/USER/*/*.dylib

Application Specific Information:
crashed on child side of fork pre-exec

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   ???                               0x000000010dd002d0 0 + 4526703312
1   postmaster                        0x000000010d560a74 ExecScan + 452
(execScan.c:228)
2   postmaster                        0x000000010d57445d ExecHashJoin + 1069
(nodeHashjoin.c:262)
3   postmaster                        0x000000010d558d0f standard_ExecutorRun +
287 (execMain.c:1652)
4   postmaster                        0x000000010d58bc52 _SPI_execute_plan +
1346 (spi.c:2523)
5   postmaster                        0x000000010d58c2ba SPI_execute_snapshot +
298 (spi.c:616)
6   postmaster                        0x000000010d783993 RI_Initial_Check +
2099 (ri_triggers.c:1488)
7   postmaster                        0x000000010d522df2
validateForeignKeyConstraint + 210 (tablecmds.c:9784)
8   postmaster                        0x000000010d51d4b0 ATController + 1664
(tablecmds.c:4715)
9   postmaster                        0x000000010d6c0a29 ProcessUtilitySlow +
2713 (utility.c:1131)
10  postmaster                        0x000000010d6bf517
standard_ProcessUtility + 1975 (utility.c:933)
11  postmaster                        0x000000010d6bea2f PortalRunUtility + 159
(pquery.c:1184)
12  postmaster                        0x000000010d6be04a PortalRunMulti + 234
(pquery.c:1328)
13  postmaster                        0x000000010d6bda67 PortalRun + 519
(pquery.c:800)
14  postmaster                        0x000000010d6bca55 exec_simple_query +
1445 (postgres.c:1223)
15  postmaster                        0x000000010d6ba8dd PostgresMain + 3901
(postgres.c:4238)
16  postmaster                        0x000000010d63b5a8 PostmasterMain + 7832
(postmaster.c:2458)
17  postmaster                        0x000000010d5a84ae main + 1678
18  libdyld.dylib                     0x00007fff681f27fd start + 1

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x000000010dd002d0  rbx: 0x00007fc5ff05b580  rcx: 0x00000001279b38d8
rdx: 0x00007ffee2850aa6
  rdi: 0x00007fc5ff05c320  rsi: 0x00007fc5ff05b580  rbp: 0x00007ffee2850ad0
rsp: 0x00007ffee2850a78
   r8: 0x000000000004850d   r9: 0xffffffff00000000  r10: 0x00000001279b38d0
r11: 0x0000000000000000
  r12: 0x00007fc5ff05c320  r13: 0x000000010da24220  r14: 0x00007fc5ff05b630
r15: 0x00007fc5ff05b470
  rip: 0x000000010dd002d0  rfl: 0x0000000000010246  cr2: 0x000000010dd002d0


PG Bug reporting form <noreply@postgresql.org> writes:
> When restoring a full database dump (psql -f filename), on one of the three
> databases, when restoring, this error is occurring.  Is repeatable on a
> different Mac.  Macintosh models:  MacBook Pro 16, clean OS installed, new
> machine.  Also ran on 2012 Mac Mini Server, with Mac OS X Mojave 10.14, with
> same errors.

Interesting ... can you share a database dump that causes this?

            regards, tom lane



Re: BUG #16237: When restoring database, backend disconnects orcrashes when foreign key is created

От
Alvaro Herrera
Дата:
On 2020-Jan-28, PG Bug reporting form wrote:

> pg_restore: creating FK CONSTRAINT
> "public.file_transit_transaction_file_transit_id_fkey"
> pg_restore: from TOC entry 3972; 2606 4177792 FK CONSTRAINT
> file_transit_transaction_file_transit_id_fkey postgres
> pg_restore: error: could not execute query: server closed the connection
> unexpectedly
>     This probably means the server terminated abnormally
>     before or while processing the request.
> Command was: ALTER TABLE ONLY file_transit_transaction
>     ADD CONSTRAINT file_transit_transaction_file_transit_id_fkey FOREIGN KEY
> (file_transit_id) REFERENCES file_transit(file_transit_id);

Is any of these tables (file_transit_transaction and file_transit)
partitioned?

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



Re: BUG #16237: When restoring database, backend disconnects orcrashes when foreign key is created

От
Darryl Snover
Дата:
> On Jan 28, 2020, at 1:14 PM, Alvaro Herrera <alvherre@2ndquadrant.com> wrote:
> 
> On 2020-Jan-28, PG Bug reporting form wrote:
> 
>> pg_restore: creating FK CONSTRAINT
>> "public.file_transit_transaction_file_transit_id_fkey"
>> pg_restore: from TOC entry 3972; 2606 4177792 FK CONSTRAINT
>> file_transit_transaction_file_transit_id_fkey postgres
>> pg_restore: error: could not execute query: server closed the connection
>> unexpectedly
>>     This probably means the server terminated abnormally
>>     before or while processing the request.
>> Command was: ALTER TABLE ONLY file_transit_transaction
>>    ADD CONSTRAINT file_transit_transaction_file_transit_id_fkey FOREIGN KEY
>> (file_transit_id) REFERENCES file_transit(file_transit_id);
> 
> Is any of these tables (file_transit_transaction and file_transit)
> partitioned?
> 

No tables are partitioned.  Any attempts to create any referential integrity constraint on any tables causes the same
crash.

I’m trying to prune down the database to rid it of any proprietary data, and see if I can get a reproducible small
set.

-Darryl