Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1reun4-00ED4t-LN for pgsql-bugs@arkaria.postgresql.org; Tue, 27 Feb 2024 10:34:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1reun3-0027O3-5A for pgsql-bugs@arkaria.postgresql.org; Tue, 27 Feb 2024 10:34:25 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1reun2-0027Nu-S6 for pgsql-bugs@lists.postgresql.org; Tue, 27 Feb 2024 10:34:25 +0000 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1reumu-001TCL-Ln for pgsql-bugs@lists.postgresql.org; Tue, 27 Feb 2024 10:34:23 +0000 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-33d36736d4eso2543867f8f.1 for ; Tue, 27 Feb 2024 02:34:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aiven.io; s=google; t=1709030055; x=1709634855; darn=lists.postgresql.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=rNDd2bTfKoiHtoRWt1XWxFfTDgb+0M/0GIDKGmsL7E8=; b=BZTRwblcQrcC82XLKnwCQYQfQ8yHxris2i0lo7yKig3hQyFeyJbiPQgZW1lfh9U9/P 1nW3zjZpMsaze0CJ0kfqXiVDfBXA33skoaSbuSwvPBirmkMtt+MNOxZZbjFmpJUv91Z6 uPll+k9qTaCrPvZL3I4J1Fejp5weKUtmIFJig= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709030055; x=1709634855; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=rNDd2bTfKoiHtoRWt1XWxFfTDgb+0M/0GIDKGmsL7E8=; b=iGXuBAjSexXWn96gaZ7KxDyBobtuFqSMpPHD0gmxlr6UcCnt9HmYWQfCJwHIlTmXci V2GF3O16MibRel+WVlS2q0+V7gcWuByIiWu963c2h6IMI/9cgaF8Cf6dj5jeNt7eJEIz XynX7HHOcQB6W2+Lpztle9WpNEh/xhHFg4TBaV7pwLKzq3ZAeYEkHvEhhrxRYuIVjrxo PVBrQM/saQCV7GVNnaect0HYLzKAuDwXx4FVpoCtGhXsHyr55ipLHu8aQFW3tE8yJPqq 7HV3ZsM9SKXDrCuT81qDoIWme210jrt51RWJ52X0b1alaWaKvZ6/Iohg1ULzZmFO1SCv 0z4w== X-Gm-Message-State: AOJu0YxqeqSeNo+78eYv42uZPgw05/v9cdZKYv4jgzgg7yQcIk2yNIbJ td+bOH/e5TAlj8DkaEJB6iq6ayBjSQ61ISem3prRV9i0v1GcW0MzB8S7RhhEHcqnkuMpo/WA66s VZlHWwuflRlqEWRyPQBpvNLGogbnJbA1hZhO0RsyxH6r/QAlQYXDKg+yvjLdsc7QuAb3xtDuxw6 I8Fa9xf3tFtRzzPzOxpME0LIhGZKleJv7oXK1lwguGCCNuqHR7XKqz X-Google-Smtp-Source: AGHT+IHViDqrfnZPZqFTM/zOu8QyRbmYQPye7UPGyCvbfMAInwhxP4Erp1RxoBJX0z0tk4UD3PkJIw== X-Received: by 2002:a05:6000:118b:b0:33d:d7be:3bec with SMTP id g11-20020a056000118b00b0033dd7be3becmr4001152wrx.58.1709030055318; Tue, 27 Feb 2024 02:34:15 -0800 (PST) Received: from aivenlaptop.localnet ([45.13.105.93]) by smtp.gmail.com with ESMTPSA id ck19-20020a5d5e93000000b0033db9383e70sm11117789wrb.81.2024.02.27.02.34.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 02:34:15 -0800 (PST) From: Ronan Dunklau To: pgsql-bugs Subject: Could not read block at end of the relation Date: Tue, 27 Feb 2024 11:34:14 +0100 Message-ID: <1878547.tdWV9SEqCh@aivenlaptop> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello, I'm sorry as this will be a very poor bug report. On PG16, I'm am experiencing random errors which share the same characteristics: - happens during heavy system load - lots of concurrent writes happening on a table - often (but haven't been able to confirm it is necessary), a vacuum is running on the table at the same time the error is triggered Then, several backends get the same error at once "ERROR: could not read block XXXX in file "base/XXXX/XXXX": read only 0 of 8192 bytes", with different block numbers. The relation is always a table (regular or toast). The blocks are past the end of the relation, and the different backends are all trying to read a different block. The offending queries are either an INSERT / UPDATE / COPY. I've seen that several bugs have been fixed in 16.1 and 16.2 regarding the new relation extension infrastructure, involving partitioned tables in one case and temp tables in the other one so I suspect maybe some other corner cases are uncovered in there. I suspected the FSM could be corrupted in some way but taking a look at it just after the errors have been triggered, the offending (non existing)blocks are just not present in the FSM either. I'm desperately trying to reproduce the issue in a test environment, without any luck so far... I suspected a race condition with VACUUM trying to reclaim the space at the end of the relation, but running a custom build trying to reproduce that (by always trying to truncate the relation during VACUUM regardless of the amount of possibly-freeable-space) hasn't led me anywhere. It seems that for some reason, a backend is extending the relation for the other waiting ones, and the newly allocated blocks don't end up being pinned in shared_buffers. They could then be evicted, and the waiting backend is now trying to read from a block which has to be read from disk but has never been marked dirty and never persisted. I don't have anything to back that hypothesis though... Once again I'm sorry that this report is too vague, I'll update if I manage to reproduce the issue or gather some more information, but in the meantime has anybody witnessed something similar ? And more importantly, do you have any pointers on how to investigate to try to trigger the issue manually ? Best regards, -- Ronan Dunklau