Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jc8Z1-0005z9-Og for pgsql-general@arkaria.postgresql.org; Fri, 22 May 2020 14:22:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jc8Z0-0007zh-7l for pgsql-general@arkaria.postgresql.org; Fri, 22 May 2020 14:22:18 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jc8Yz-0007za-Qr for pgsql-general@lists.postgresql.org; Fri, 22 May 2020 14:22:17 +0000 Received: from mail-ot1-x342.google.com ([2607:f8b0:4864:20::342]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jc8Yw-0006hm-Fh for pgsql-general@lists.postgresql.org; Fri, 22 May 2020 14:22:17 +0000 Received: by mail-ot1-x342.google.com with SMTP id o13so8358456otl.5 for ; Fri, 22 May 2020 07:22:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=CRh+JrV1oRS1gV1gasIF1LCDkuSqc19ji4enqxVXXQo=; b=aQZRqUm/+4zS+KWfFvz07Ewe7QTFn+tDexH7QN6Rut5DaahDlWttae5n2aTLG0jpnU xuWadeobuSvhaLaIUt4+d4yxMAT0orcgdgcx2AiDIP4tyzgMGpRNyjq1dpI0GAkca4vH q1UzwPtcfGQ57AiEVlT2n0yG2uW7xR7JRmqW6W0RO2wUhzH2OPOjOn8PLociL2lMhqLR PrZEK9jUx26kfEqAteYHUtAvjqnVuYcOOwKLD5Z4qVnZ0KGbr/Zm911Y2zGsMtu7cGqu hrZC6cox12wOP1s+7jYpf90kjQ42rCG9Hzsuuwavn2tiLtCLlVlXOMX02WU6hXOvngsl /32w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=CRh+JrV1oRS1gV1gasIF1LCDkuSqc19ji4enqxVXXQo=; b=mu6QxvjjGJl7gmQ4mZ+Fu+G54OGWG4ptnUCcYZJeWBvQpTDrqUDfX4mkD05z+gff/j CL34Y3ZgoJKxIZfyzC3z+LVefXBQ6eF7A+r4gZnFUL/JnFwkNjNfGODtdRmQYTZU/NDq xTh73b7JIbXBH13Bg+8DFMuLOad2kuHMNMtOzYEFccRRnPut3go7AZN4d6rDSsx64tS/ TthN/B0iPpdxKaS9eSlR7WlfkOV11BG4j9pVT9EnIFun8Nud78WymEJU/v+b/SbzTgol A3Y8LlLPviMVVoEEV+4kJycjWJ3vTf2LGTv4P8nexqspW8mWOMu6Dg8p3gObnAakysgg hyjA== X-Gm-Message-State: AOAM530t0jj4XGigu6luhM1J14rYvhgG9tNoC3cxXEmpQKOC90Wms6GK yfme/oSgEJ3jd5YqBIy8mEIyI0uNdHk= X-Google-Smtp-Source: ABdhPJwRQUfzbS027/Z6kY1WQe6f8b59Uw+HR8fMIHNHCyrwM9UidUZruaCdQMk3ah7RlP2w+8xrKg== X-Received: by 2002:a9d:c28:: with SMTP id 37mr1213179otr.26.1590157331716; Fri, 22 May 2020 07:22:11 -0700 (PDT) Received: from [192.168.1.10] (ip70-186-126-197.no.no.cox.net. [70.186.126.197]) by smtp.googlemail.com with ESMTPSA id s25sm2490885otq.48.2020.05.22.07.22.10 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 22 May 2020 07:22:11 -0700 (PDT) Subject: Re: pg_dump crashes To: pgsql-general@lists.postgresql.org References: <38072bf3-a3dc-2a4c-21d3-a024a2dfce8b@aklaver.com> From: Ron Message-ID: <8f1e9fa7-0277-6de6-38e5-d29cc6babc9c@gmail.com> Date: Fri, 22 May 2020 09:22:10 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------8ED365D585F625855A74FCD7" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------8ED365D585F625855A74FCD7 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit > pg_dump: The command was: COPY public.file (fileid, fileindex, jobid, pathid, filenameid, deltaseq, markid, lstat, md5) TO stdout; What happens when you run that COPY ... TO stdout; command (but redirecting it to /dev/null)? On 5/22/20 8:40 AM, Nico De Ranter wrote: > I was just trying that.  It's always the same (huge) table that crashes > the pg_dump.   Running a dump excluding that one table goes fine, running > a dump of only that one table crashes. > In the system logs I always see a segfault > > May 22 15:22:14 core4 kernel: [337837.874618] postgres[1311]: segfault at > 7f778008ed0d ip 000055f197ccc008 sp 00007ffdd1fc15a8 error 4 in > postgres[55f1977c0000+727000] > > It doesn't seem to be an Out-of-memory thing (at least not on the OS level). > The database is currently installed on a dedicated server with 32GB RAM.  >  I tried tweaking some of the memory parameters for postgres, but the > crash always happens at the exact same spot (if I run pg_dump for that one > table with and without memory tweaks the resulting files are identical). > > One thing I just noticed looking at the dump file: at around the end of > the file I see this: > > 2087983804 516130 37989 2218636 3079067 0 0 P4B BcISC IGk L BOT BOP A jC > BAA I BeMj/b BceUl6 BehUAn 0Ms A C I4p9CBfUiSeAPU4eDuipKQ > *4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N > \N ?????????????????????????????? > 4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N > \N ?????????????????????????????? > 4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N > \N ?????????????????????????????? > 4557430888798830399 1061109567 1061109567 1145127487 1413694803 21071 \N > \N ?????????????????????????????? > 4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N > \N ?????????????????????????????? > 4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N > \N ?????????????????????????????? > 4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N > \N ?????????????????????????????? > 4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N > \N ?????????????????????????????? > 4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N > \N ?????????????????????????????? > 4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N > \N ?????????????????????????????? > 4557430888798830399 1061109567 1061109567 1145127487 1413694803 21071 \N > \N ?????????????????????????????? > 4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N > \N ?????????????????????????????? > 4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N > \N ?????????????????????????????? > 4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N > \N ?????????????????????????????? > 4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N > \N ?????????????????????????????? > 4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N > \N ?????????????????????????????? > 4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N > \N ?????????????????????????????? > 6071772946555290175 1056985679 1061109567 1061109567 1061109567 16191 \N > \N ?????????????????????????????? > 4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N > \N ?????????????????????????????? > 4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N > \N ?????????????????????????????? > 4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N > \N ?????????????????????????????? > 4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N > \N ?????????????????????????????? > 4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N > \N ?????????????????????????????? > 4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N > \N ?????????????????????????????? > 4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N > \N ?????????????????????????????? > 4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N > \N ?????????????????????????????? > 4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N > \N ?????????????????????????????? > 4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N > \N ??????????????????????????????* > 2087983833 554418 37989 5405605 14507502 0 0 P4B Bb8c/ IGk L BOS BOP A Lfh > BAA Bg BeMj+2 Bd1LVN BehUAl rlx ABA TOR > > It looks suspicious however there are about 837 more lines before the > output stops. > > Nico > > On Fri, May 22, 2020 at 3:27 PM Adrian Klaver > wrote: > > On 5/22/20 5:37 AM, Nico De Ranter wrote: > > Hi all, > > > > Postgres version: 9.5 > > OS: Ubuntu 18.04.4 > > > > I have a 144GB Bacula database that crashes the postgres daemon when I > > try to do a pg_dump. > > At some point the server ran out of diskspace for the database storage. > > I expanded the lvm and rebooted the server. It seemed to work fine, > > however when I try to dump the bacula database the postgres daemon dies > > after about 37GB. > > > > I tried copying the database to another machine and upgrading postgres > > to 11 using pg_upgrade.  The upgrade seems to work but I still get > > exactly the same problem when trying to dump the database. > > > > postgres@core4:~$ pg_dumpall --cluster 11/main --file=dump.sql > > pg_dump: Dumping the contents of table "file" failed: PQgetCopyData() > > failed. > > pg_dump: Error message from server: server closed the connection > > unexpectedly > > This probably means the server terminated abnormally > > before or while processing the request. > > pg_dump: The command was: COPY public.file (fileid, fileindex, jobid, > > pathid, filenameid, deltaseq, markid, lstat, md5) TO stdout; > > pg_dumpall: pg_dump failed on database "bacula", exiting > > What happens if you try to dump just this table? > > Something along lines of: > > pg_dump -t file -d some_db -U some_user > > Have you looked at the system logs to see if it is the OS killing the > process? > > > > > > In the logs I see: > > > > 2020-05-22 14:23:30.649 CEST [12768] LOG:  server process (PID 534) was > > terminated by signal 11: Segmentation fault > > 2020-05-22 14:23:30.649 CEST [12768] DETAIL:  Failed process was > > running: COPY public.file (fileid, fileindex, jobid, pathid, > filenameid, > > deltaseq, markid, lstat, md5) TO stdout; > > 2020-05-22 14:23:30.651 CEST [12768] LOG:  terminating any other active > > server processes > > 2020-05-22 14:23:30.651 CEST [482] WARNING:  terminating connection > > because of crash of another server process > > 2020-05-22 14:23:30.651 CEST [482] DETAIL:  The postmaster has > commanded > > this server process to roll back the current transaction and exit, > > because another server process exited abnormally and possibly corrupted > > shared memory. > > 2020-05-22 14:23:30.651 CEST [482] HINT:  In a moment you should be > able > > to reconnect to the database and repeat your command. > > 2020-05-22 14:23:30.652 CEST [12768] LOG:  all server processes > > terminated; reinitializing > > 2020-05-22 14:23:30.671 CEST [578] LOG:  database system was > > interrupted; last known up at 2020-05-22 14:15:19 CEST > > 2020-05-22 14:23:30.809 CEST [578] LOG:  database system was not > > properly shut down; automatic recovery in progress > > 2020-05-22 14:23:30.819 CEST [578] LOG:  redo starts at 197/D605EA18 > > 2020-05-22 14:23:30.819 CEST [578] LOG:  invalid record length at > > 197/D605EA50: wanted 24, got 0 > > 2020-05-22 14:23:30.819 CEST [578] LOG:  redo done at 197/D605EA18 > > 2020-05-22 14:23:30.876 CEST [12768] LOG:  database system is ready to > > accept connections > > 2020-05-22 14:29:07.511 CEST [12768] LOG:  received fast shutdown > request > > > > > > Any ideas how to fix or debug this? > > > > Nico > > > > -- > > > > Nico De Ranter > > > > Operations Engineer > > > > T. +32 16 38 72 10 > > > > > > > > > > > > > > > > eSATURNUS > > Philipssite 5, D, box 28 > > 3001 Leuven – Belgium > > > > > > > > T. +32 16 40 12 82 > > F. +32 16 40 84 77 > > www.esaturnus.com > > > > ** > > > > *For Service & Support :* > > > > Support Line Belgium: +32 2 2009897 > > > > Support Line International: +44 12 56 68 38 78 > > > > Or via email : medical.services.eu@sony.com > > > > > > > > > > > -- > Adrian Klaver > adrian.klaver@aklaver.com > > > > -- > > Nico De Ranter > > Operations Engineer > > T. +32 16 38 72 10 > > > > > > > > eSATURNUS > Philipssite 5, D, box 28 > 3001 Leuven – Belgium > > > > T. +32 16 40 12 82 > F. +32 16 40 84 77 > www.esaturnus.com > > ** > > *For Service & Support :* > > Support Line Belgium: +32 2 2009897 > > Support Line International: +44 12 56 68 38 78 > > Or via email : medical.services.eu@sony.com > > > -- Angular momentum makes the world go 'round. --------------8ED365D585F625855A74FCD7 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit > pg_dump: The command was: COPY public.file (fileid, fileindex, jobid, pathid, filenameid, deltaseq, markid, lstat, md5) TO stdout;

What happens when you run that COPY ... TO stdout; command (but redirecting it to /dev/null)?

On 5/22/20 8:40 AM, Nico De Ranter wrote:
I was just trying that.  It's always the same (huge) table that crashes the pg_dump.   Running a dump excluding that one table goes fine, running a dump of only that one table crashes.
In the system logs I always see a segfault

May 22 15:22:14 core4 kernel: [337837.874618] postgres[1311]: segfault at 7f778008ed0d ip 000055f197ccc008 sp 00007ffdd1fc15a8 error 4 in postgres[55f1977c0000+727000]

It doesn't seem to be an Out-of-memory thing (at least not on the OS level).
The database is currently installed on a dedicated server with 32GB RAM.   I tried tweaking some of the memory parameters for postgres, but the crash always happens at the exact same spot (if I run pg_dump for that one table with and without memory tweaks the resulting files are identical).

One thing I just noticed looking at the dump file: at around the end of the file I see this:

2087983804 516130 37989 2218636 3079067 0 0 P4B BcISC IGk L BOT BOP A jC BAA I BeMj/b BceUl6 BehUAn 0Ms A C I4p9CBfUiSeAPU4eDuipKQ
4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N \N ??????????????????????????????
4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N \N ??????????????????????????????
4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N \N ??????????????????????????????
4557430888798830399 1061109567 1061109567 1145127487 1413694803 21071 \N \N ??????????????????????????????
4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N \N ??????????????????????????????
4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N \N ??????????????????????????????
4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N \N ??????????????????????????????
4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N \N ??????????????????????????????
4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N \N ??????????????????????????????
4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N \N ??????????????????????????????
4557430888798830399 1061109567 1061109567 1145127487 1413694803 21071 \N \N ??????????????????????????????
4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N \N ??????????????????????????????
4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N \N ??????????????????????????????
4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N \N ??????????????????????????????
4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N \N ??????????????????????????????
4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N \N ??????????????????????????????
4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N \N ??????????????????????????????
6071772946555290175 1056985679 1061109567 1061109567 1061109567 16191 \N \N ??????????????????????????????
4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N \N ??????????????????????????????
4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N \N ??????????????????????????????
4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N \N ??????????????????????????????
4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N \N ??????????????????????????????
4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N \N ??????????????????????????????
4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N \N ??????????????????????????????
4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N \N ??????????????????????????????
4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N \N ??????????????????????????????
4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N \N ??????????????????????????????
4557430888798830399 1061109567 1061109567 1061109567 1061109567 16191 \N \N ??????????????????????????????

2087983833 554418 37989 5405605 14507502 0 0 P4B Bb8c/ IGk L BOS BOP A Lfh BAA Bg BeMj+2 Bd1LVN BehUAl rlx ABA TOR

It looks suspicious however there are about 837 more lines before the output stops.

Nico

On Fri, May 22, 2020 at 3:27 PM Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 5/22/20 5:37 AM, Nico De Ranter wrote:
> Hi all,
>
> Postgres version: 9.5
> OS: Ubuntu 18.04.4
>
> I have a 144GB Bacula database that crashes the postgres daemon when I
> try to do a pg_dump.
> At some point the server ran out of diskspace for the database storage. 
> I expanded the lvm and rebooted the server. It seemed to work fine,
> however when I try to dump the bacula database the postgres daemon dies
> after about 37GB.
>
> I tried copying the database to another machine and upgrading postgres
> to 11 using pg_upgrade.  The upgrade seems to work but I still get
> exactly the same problem when trying to dump the database.
>
> postgres@core4:~$ pg_dumpall --cluster 11/main --file=dump.sql
> pg_dump: Dumping the contents of table "file" failed: PQgetCopyData()
> failed.
> pg_dump: Error message from server: server closed the connection
> unexpectedly
> This probably means the server terminated abnormally
> before or while processing the request.
> pg_dump: The command was: COPY public.file (fileid, fileindex, jobid,
> pathid, filenameid, deltaseq, markid, lstat, md5) TO stdout;
> pg_dumpall: pg_dump failed on database "bacula", exiting

What happens if you try to dump just this table?

Something along lines of:

pg_dump -t file -d some_db -U some_user

Have you looked at the system logs to see if it is the OS killing the
process?


>
> In the logs I see:
>
> 2020-05-22 14:23:30.649 CEST [12768] LOG:  server process (PID 534) was
> terminated by signal 11: Segmentation fault
> 2020-05-22 14:23:30.649 CEST [12768] DETAIL:  Failed process was
> running: COPY public.file (fileid, fileindex, jobid, pathid, filenameid,
> deltaseq, markid, lstat, md5) TO stdout;
> 2020-05-22 14:23:30.651 CEST [12768] LOG:  terminating any other active
> server processes
> 2020-05-22 14:23:30.651 CEST [482] WARNING:  terminating connection
> because of crash of another server process
> 2020-05-22 14:23:30.651 CEST [482] DETAIL:  The postmaster has commanded
> this server process to roll back the current transaction and exit,
> because another server process exited abnormally and possibly corrupted
> shared memory.
> 2020-05-22 14:23:30.651 CEST [482] HINT:  In a moment you should be able
> to reconnect to the database and repeat your command.
> 2020-05-22 14:23:30.652 CEST [12768] LOG:  all server processes
> terminated; reinitializing
> 2020-05-22 14:23:30.671 CEST [578] LOG:  database system was
> interrupted; last known up at 2020-05-22 14:15:19 CEST
> 2020-05-22 14:23:30.809 CEST [578] LOG:  database system was not
> properly shut down; automatic recovery in progress
> 2020-05-22 14:23:30.819 CEST [578] LOG:  redo starts at 197/D605EA18
> 2020-05-22 14:23:30.819 CEST [578] LOG:  invalid record length at
> 197/D605EA50: wanted 24, got 0
> 2020-05-22 14:23:30.819 CEST [578] LOG:  redo done at 197/D605EA18
> 2020-05-22 14:23:30.876 CEST [12768] LOG:  database system is ready to
> accept connections
> 2020-05-22 14:29:07.511 CEST [12768] LOG:  received fast shutdown request
>
>
> Any ideas how to fix or debug this?
>
> Nico
>
> --
>
> Nico De Ranter
>
> Operations Engineer
>
> T. +32 16 38 72 10
>
>
> <http://www.esaturnus.com>
>
> <http://www.esaturnus.com>
>
>
> eSATURNUS
> Philipssite 5, D, box 28
> 3001 Leuven – Belgium
>
>       
>
> T. +32 16 40 12 82
> F. +32 16 40 84 77
> www.esaturnus.com <http://www.esaturnus.com>
>
> ** <http://www.esaturnus.com/>
>
> *For Service & Support :*
>
> Support Line Belgium: +32 2 2009897
>
> Support Line International: +44 12 56 68 38 78
>
> Or via email : medical.services.eu@sony.com
> <mailto:medical.services.eu@sony.com>
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


--

Nico De Ranter

Operations Engineer

T. +32 16 38 72 10



eSATURNUS
Philipssite 5, D, box 28
3001 Leuven – Belgium

T. +32 16 40 12 82
F. +32 16 40 84 77
www.esaturnus.com

For Service & Support :

Support Line Belgium: +32 2 2009897

Support Line International: +44 12 56 68 38 78

Or via email : medical.services.eu@sony.com



--
Angular momentum makes the world go 'round.
--------------8ED365D585F625855A74FCD7--