Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f7P8e-0005KX-78 for pgsql-bugs@arkaria.postgresql.org; Sat, 14 Apr 2018 17:39:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f7P8d-0005ue-AY for pgsql-bugs@arkaria.postgresql.org; Sat, 14 Apr 2018 17:38:59 +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 1f7P8d-0005uU-1N for pgsql-bugs@lists.postgresql.org; Sat, 14 Apr 2018 17:38:59 +0000 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1f7P8Z-00052H-7w for pgsql-bugs@postgresql.org; Sat, 14 Apr 2018 17:38:58 +0000 Received: by mail-wr0-x241.google.com with SMTP id s12so15471474wrc.8 for ; Sat, 14 Apr 2018 10:38:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=ta3bD2OP7jkVV47Iy6JXhflN6HL5tJ8feY+ib5Xj1Ok=; b=0ncHueeFGin3BRSf3twNF2oflh5XgXatS9LBod4I8uXlkkilMwXKxGGacNJL4yYwcA i7p8QlCwveIlWzcdci86Pkou8aStC3mFOd6CBeP/bAh9pyBXqwk1HxRG8Q6mSsIospWG NGXxr3pSaM6LMbWC1WsZeSk5+QHCiSZ+JTxJz+W8/Rzb9XHsh3G72dUzOE4wldp7ddO8 EYqeVk5hapmbESUJp0yTnm71CfGUgc5gU8tgr82bnHlp9wUWwmUUrBVH0Zw84JHeloxV ZDlK/mUJgJ5xxRa1kuOcOUKvldgjwlAv2wdxxoW7XGickUUgCjv2In1TdScppjtQORPr bdrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ta3bD2OP7jkVV47Iy6JXhflN6HL5tJ8feY+ib5Xj1Ok=; b=n9oMUhMTtbpa6EqllvTkILeRcsQgUWbyVupZ++pTgBa0bhJNd8NXTtKaFNm9A0G+Kr xnSXVmObUiuPIb5kvd9aUJBOh4zy6j6smG/0uGEA357BQSfi4P4eBIfNQSnM/M3flDFf 93k3z3qLq4Qy2105vNHQ9PHUTYwV22RYhDYvJ8NkjJlgCCcz2ss07dh23cbQho8/y5L7 PhFAofgYv6mW0wGVuezN01Q8siXCrbytjlxjJlYB1NdivJTyT6iwksDAEj1iJI9/5MC0 tqW/brwWyXUc6z4WMNMXx+AyAQs40uxIvP9T+CmC/v3bHnx0LgCjXmGUbDR6PVMhQFJg 5hdA== X-Gm-Message-State: ALQs6tBGx2KlSprclDERvB286ItLlwtpbj5YWhHFjT/vozWVtyrTfQsV lx+XpavTzPxIHQDexGmBMucfQg== X-Google-Smtp-Source: AIpwx4+10JgfCqnXsDQgqtb1ZRc2L5X4DDfnXqCLRIE8mxurz7rE0czR8ToYbZtkEcszOIfIxWhpKw== X-Received: by 10.223.175.40 with SMTP id z37mr870939wrc.72.1523727534328; Sat, 14 Apr 2018 10:38:54 -0700 (PDT) Received: from [10.137.2.19] (ip-78-102-97-226.net.upcbroadband.cz. [78.102.97.226]) by smtp.gmail.com with ESMTPSA id q71sm5491111wmd.41.2018.04.14.10.38.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 14 Apr 2018 10:38:53 -0700 (PDT) Subject: Re: Standby corruption after master is restarted To: emre@hasegeli.com, PostgreSQL Bugs Cc: gurkan.gur@innogames.com, david.pusch@innogames.com, patrick.schmidt@innogames.com References: From: Tomas Vondra Message-ID: Date: Sat, 14 Apr 2018 19:38:49 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi Emre, On 03/28/2018 07:50 PM, Emre Hasegeli wrote: > We experienced this issue again, this time on production. The primary > instance was in a loop of being killed by Linux OOM-killer and being > restarted in 1 minute intervals. The corruption only happened on one > of the two standbys. The primary and the other standby have no > problems. Only the was killed and restarted, the standbys were not. > There weren't any unusual settings, "fsync" was not disabled. Here is > the information I collected. > I've been trying to reproduce this by running a master with a couple of replicas, and randomly restarting the master (while pgbench is running). But so far no luck, so I guess something else is required to reproduce the behavior ... > The logs at the time standby broke: > >> 2018-03-28 14:00:30 UTC [3693-67] LOG: invalid resource manager ID 39 at 1DFB/D43BE688 >> 2018-03-28 14:00:30 UTC [25347-1] LOG: started streaming WAL from primary at 1DFB/D4000000 on timeline 5 >> 2018-03-28 14:00:59 UTC [3748-357177] LOG: restartpoint starting: time >> 2018-03-28 14:01:23 UTC [25347-2] FATAL: could not receive data from WAL stream: SSL SYSCALL error: EOF detected >> 2018-03-28 14:01:24 UTC [3693-68] FATAL: invalid memory alloc request size 1916035072 > > And from the next try: > >> 2018-03-28 14:02:15 UTC [26808-5] LOG: consistent recovery state reached at 1DFB/D6BDDFF8 >> 2018-03-28 14:02:15 UTC [26808-6] FATAL: invalid memory alloc request size 191603507 > In the initial report (from August 2018) you shared pg_xlogdump output, showing that the corrupted WAL record is an FPI_FOR_HINT right after CHECKPOINT_SHUTDOWN. Was it the same case this time? BTW which versions are we talking about? I see the initial report mentioned catversion 201608131, this one mentions 201510051, so I'm guessing 9.6 and 9.5. Which minor versions? Is the master under load (accepting writes) before shutdown? How was it restarted, actually? I see you're mentioning OOM killer, so I guess "kill -9". What about the first report - was it the same case, or was it restarted "nicely" using pg_ctl? Could the replica receive the WAL in some other way - say, from a WAL archive? What archive/restore commands you use? regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services