Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fQLUc-0002VZ-0T for pgsql-general@arkaria.postgresql.org; Tue, 05 Jun 2018 23:35:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fQLUZ-00067J-Q0 for pgsql-general@arkaria.postgresql.org; Tue, 05 Jun 2018 23:35:55 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fQLUZ-00067A-FV for pgsql-general@lists.postgresql.org; Tue, 05 Jun 2018 23:35:55 +0000 Received: from mail-qt0-x22d.google.com ([2607:f8b0:400d:c0d::22d]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fQLUR-0005oJ-Hr for pgsql-general@lists.postgresql.org; Tue, 05 Jun 2018 23:35:55 +0000 Received: by mail-qt0-x22d.google.com with SMTP id i18-v6so4469738qtp.12 for ; Tue, 05 Jun 2018 16:35:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:mime-version:subject:message-id:date:to; bh=VE7dZB8GtEQ+g+llxOzaJdAnrBcEjaaKa4pEvLrdAso=; b=K53wBSEpjtv65kgxfUpQegWUGzkjUS9QoXH5dBcS3XV0uJXZASP/3UdnPcZE9SPPaF xVmRk3E5Y3NTW9J3GJ7d3niDEck97p2QMBScZ64+XZG33h+6il7NdRv3am/aoQxhSqLT BDJyGxU8ww0uLio5ZlBz5AsSWzrcVhCPFu7siBPg3aW4XZ7SygatdDRgCf90eGB8adjb AariwO3aQQUL0R4E2o+3mR1ecF+AYEIeybJmSgle4zWEGQofOX7+HFl4kV4uqiimHPbF JE8cbPqU0pm++XuP83ndKIJEki5uTJdDJAq1UiUv1Rb/VNcaqBApEqIec+p0CEijcSSX dgQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:mime-version:subject:message-id:date:to; bh=VE7dZB8GtEQ+g+llxOzaJdAnrBcEjaaKa4pEvLrdAso=; b=WyqbpLxzdjZwJfw+yWc/6IWsLginp8LHVBUKUXjWsVGJ8sqFPOkwP8p2+LnsIP+jsA R+3511KN0JDRhSS1V4G8z7t2qrQjEfAdXhjy+cAaH2KWOGXPoxhfXqN94BjCC74mQN1o TN6yhreuApQpUPpO8pTEwYyR+jArHkSjp44yMkXd1gTkcW8+0pZdqyQbo/8G4Dvo29Jp ZeXLmBg3jRU0DsllChn20o3Y9/qEokj4G6geWuBBrTThCSQ8tlrsl85DT4KmwVF+ZWGD MqhvHpMSnG/Ei759Q3eE1qLesH1wEmOxMlZpLFUxlx9XHKneaEzLbkGx/GdEY14iwsZQ GyEw== X-Gm-Message-State: APt69E3PhXI3wgFqt650ewCvYZCrcTG3iMOA1eZiLTUUau9CXlCwEHQ5 p2rRjzYBUmxfGtB091mS39u15E8Y X-Google-Smtp-Source: ADUXVKIX/avkQ/impviVpnVGsoh1BkPBLU9kmWLUnbFAwBukWa5vqlFXlBckoiQ3Fq1ZnVTqRjQ3pA== X-Received: by 2002:a0c:e28a:: with SMTP id r10-v6mr677239qvl.172.1528241744323; Tue, 05 Jun 2018 16:35:44 -0700 (PDT) Received: from [192.168.1.104] (50-249-28-57-static.hfc.comcastbusiness.net. [50.249.28.57]) by smtp.gmail.com with ESMTPSA id u22-v6sm23852056qtk.18.2018.06.05.16.35.43 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Jun 2018 16:35:43 -0700 (PDT) From: Jonathan Marks Content-Type: multipart/alternative; boundary="Apple-Mail=_CCBBA0C1-6B45-4D57-ACD8-1E9A89767C65" Mime-Version: 1.0 (Mac OS X Mail 11.2 \(3445.5.20\)) Subject: Segfault leading to crash, recovery mode, and TOAST corruption Message-Id: <1CC7D7DB-7DD8-4451-97AB-03ED7CFDF10C@gmail.com> Date: Tue, 5 Jun 2018 19:35:42 -0400 To: pgsql-general@lists.postgresql.org X-Mailer: Apple Mail (2.3445.5.20) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail=_CCBBA0C1-6B45-4D57-ACD8-1E9A89767C65 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hello =E2=80=94 We had two issues today (once this morning and once a few minutes ago) = with our primary database (RDS running 10.1, 32 cores, 240 GB RAM, 5TB = total disk space, 20k PIOPS) where the database suddenly crashed and = went into recovery mode. The first time this happened, we restarted the = server after about 5 minutes in an attempt to get the system live, and = the second time we let it stay in recovery mode until it recovered (took = about 10 minutes). The system was not under high load in either case. Both times that the server crashed, we saw this in the logs: 2018-06-05 23:08:44 = UTC:172.31.7.89(36224):production@OURDB:[12173]:ERROR: canceling = statement due to statement timeout 2018-06-05 23:08:44 UTC::@:[48863]:LOG: worker process: parallel worker = for PID 12173 (PID 20238) exited with exit code 1 2018-06-05 23:08:49 UTC::@:[48863]:LOG: server process (PID 12173) was = terminated by signal 11: Segmentation fault After the first crash, we then started getting errors like: 2018-06-05 23:08:45 = UTC:172.31.6.84(33392):production@OURDB:[11888]:ERROR: unexpected chunk = number 0 (expected 1) for toast value 1592283014 in pg_toast_26656 We were able to identify 15 rows that are corrupted and the exact fields = that are being TOASTED. We=E2=80=99re following Josh Berkus=E2=80=99 = post here: = http://www.databasesoup.com/2013/10/de-corrupting-toast-tables.html = . We have tried to update those rows to change the bad fields by using = UPDATE and DELETE, but every time we do we get an error: ERROR: tuple = concurrently updated We=E2=80=99re intending to reindex the TOAST table this evening, then = try to delete again, and then run pg_repack. However, while that may = resolve the TOAST corruption, we don=E2=80=99t believe it=E2=80=99s the = root cause of this issue. We can in theory restore from one of our = backups, but that would result in data loss for our clients and may not = necessarily resolve the issue. We=E2=80=99re worried that this is a = Postgres bug, perhaps due to parallelization =E2=80=94 would appreciate = any guidance people can give. Thank you! --Apple-Mail=_CCBBA0C1-6B45-4D57-ACD8-1E9A89767C65 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Hello= =E2=80=94

We had = two issues today (once this morning and once a few minutes ago) with our = primary database (RDS running 10.1, 32 cores, 240 GB RAM, 5TB total disk = space, 20k PIOPS) where the database suddenly crashed and went into = recovery mode. The first time this happened, we restarted the server = after about 5 minutes in an attempt to get the system live, and the = second time we let it stay in recovery mode until it recovered (took = about 10 minutes). The system was not under high load in either = case.

Both = times that the server crashed, we saw this in the logs:

2018-06-05= 23:08:44 UTC:172.31.7.89(36224):production@OURDB:[12173]:ERROR: =  canceling statement due to statement timeout
2018-06-05 23:08:44 = UTC::@:[48863]:LOG:  worker process: parallel worker for PID 12173 = (PID 20238) exited with exit code 1
2018-06-05 23:08:49 UTC::@:[48863]:LOG:  server process = (PID 12173) was terminated by signal 11: Segmentation = fault

After the first crash, we then started getting errors = like:

2018-06-05 23:08:45 = UTC:172.31.6.84(33392):production@OURDB:[11888]:ERROR:  unexpected = chunk number 0 (expected 1) for toast value 1592283014 in = pg_toast_26656

We were able to identify 15 rows that are corrupted and the = exact fields that are being TOASTED. We=E2=80=99re following Josh = Berkus=E2=80=99 post here: http://www.databasesoup.com/2013/10/de-corrupting-toast-tables.= html.

We = have tried to update those rows to change the bad fields by using UPDATE = and DELETE, but every time we do we get an error: ERROR: tuple = concurrently updated

We=E2=80=99re intending to reindex the TOAST table this = evening, then try to delete again, and then run pg_repack. However, = while that may resolve the TOAST corruption, we don=E2=80=99t believe = it=E2=80=99s the root cause of this issue. We can in theory restore from = one of our backups, but that would result in data loss for our clients = and may not necessarily resolve the issue. We=E2=80=99re worried that = this is a Postgres bug, perhaps due to parallelization =E2=80=94 would = appreciate any guidance people can give.

Thank you!



= --Apple-Mail=_CCBBA0C1-6B45-4D57-ACD8-1E9A89767C65--