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.96) (envelope-from ) id 1vW9ZG-00EDe7-2k for pgsql-bugs@arkaria.postgresql.org; Thu, 18 Dec 2025 08:41:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vW9ZF-000zu9-2o for pgsql-bugs@arkaria.postgresql.org; Thu, 18 Dec 2025 08:41:02 +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.96) (envelope-from ) id 1vW9ZF-000zu0-1q for pgsql-bugs@lists.postgresql.org; Thu, 18 Dec 2025 08:41:02 +0000 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vW9ZE-001IPm-0x for pgsql-bugs@postgresql.org; Thu, 18 Dec 2025 08:41:01 +0000 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-477619f8ae5so2182365e9.3 for ; Thu, 18 Dec 2025 00:40:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1766047257; x=1766652057; darn=postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=g34INEAGnFo1pxA7V6NOIzr5J+Xiwx86c0ycFFm/vxw=; b=VDUfwXuaEUIqcye7d51cwV1w3NnZt97En/SmzNedUkX6iEqx2hJIuBLpPZZv+QG6A5 KvlSdAXXKxOM+WRppPI0ojXRQQ2zye8uIOPwSvnv66EBC+rEw+5wejA57WkvfAQT8Bkf XT0hLPS4zGsoArIT6QoV0W0cHfy60esHuJEY7iGu/Xf4fniRvgM96Lnoo0FzvBMcykpd I/nQVpKMLwXFcJ+0Uek/Zh+2ERaC60DuJCIzo0sTJNfO9Y//ooqnLEyMLOzzkXkLqoAp ohKvTVC9XFrrXulQ1GDb3531kI0J1Gaw6DBcpg0X19ArShXbvIu2HDu85h588Is34cEk CyRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766047257; x=1766652057; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=g34INEAGnFo1pxA7V6NOIzr5J+Xiwx86c0ycFFm/vxw=; b=ZmMa2ov8mEBOFkEeCiw1/0OrZ/gOf2TG0xfNkglsNDAjxCRl50KTZ75aHhvO83O0CQ odKoNbIwXImt/Za806PCFkueFGPxqlSEkfPuIF4oBCK40+SlNLnJneDtCR4eN1nu1m4h 7PJ+QgfzWeBTRDTeOfxLdU/gl/7jOENPEh3tmN+HNL/iEeTC3Lr/Lwf3XHZTP/rZdAKU /uXwxSp/6cZ2PAAmVwrHhSuCr/3M37YIF99Hv7tj97GaQK7FMAP4JTDEZ+tLjavBQwgr VbqiU3rRLuJlwRLOgAKUtimRiUHhveF8vLYrhjHXBEcAw+M/dN/+8C/K9nXOnhtXSUaZ CsIg== X-Forwarded-Encrypted: i=1; AJvYcCUJY20Qj5HTQcuX1szZlrP9kI7gU7c89936+qROUf6IB6DjTHsRmwr67RLWLp6OrP7CErD/n/vg8wdl@postgresql.org X-Gm-Message-State: AOJu0Yy0YgawDeFdIfyP7ixQl4vHTFeOLmBGhlazXPy2GxROGIBJ1CCV UtZJpUXRKdv2kXZ0xvbhEnqk8M+hGNwyA3JBemEi27tXk3HuJHVjccNd/mr0md2aqvjS8hol1q/ KPpxX X-Gm-Gg: AY/fxX721pd1sGyCVX2bJ3MbJEInpYHQlEO21BYldfLIu/VoaRj/W3bnNxQoOsu9AaW Tg/z/IRbkNfWFiULQFriQk7QRgkNBbD395rxLNHVKQBTCLmDxV0xXZMXWNH9LNTk1thghH3+knW Y6facuziLVvZFiqt+JKpiE4ZJfzFd0PpM68E9rnMtpxOEVXeu5dEE36B13cN9d8+e6qQOxhDvXs +4NfB0cucDZjGoh74EH+n7PZ6o0hHRcNZNuA4TupT9k+Tle1tft70LHEm4YlYhTTqwFMEjxKivN fDynK6rU7Vq5vSS7cWtcekxR1GLzKx3rkw2nz7V6+GvIA2ZHFK420bv8abkXkVU1+lLvFwnM54j TWRVDCgcQ3yGhty8V/KsluBDq+ie/L2/J/Ta7UIMLSzzuSZRAkLoVZExC6WjTqZXKsd27RK4Fuz xTnvDfKWVYxHaUTKVM9MkROyJhoSb6QhbRfR9++2QV4wFAuDdiPOU= X-Google-Smtp-Source: AGHT+IH09BJwi3CNVLKau5JtxzhpzFB6S/IJtajM7pAZGF32LqESeH1NexwBtXZ5xJgfskinXxQXRg== X-Received: by 2002:a05:600c:45c9:b0:47a:8154:33e3 with SMTP id 5b1f17b1804b1-47a8f90f951mr201843455e9.28.1766047257205; Thu, 18 Dec 2025 00:40:57 -0800 (PST) Received: from laurenz.albe-K4N0CV00F97414D ([2001:871:70:e6a5:987f:2f0f:2a17:7c1b]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4324498fce1sm3802034f8f.28.2025.12.18.00.40.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Dec 2025 00:40:57 -0800 (PST) Message-ID: Subject: Re: [BUG] PostgreSQL 14.5: Data corruption in table tb_workstation_message (possible fstrim-related on eMMC) From: Laurenz Albe To: =?UTF-8?Q?=E7=AC=AC108=E6=AC=A1=E6=98=8E=E5=A4=A9?= <87326549@qq.com>, pgsql-bugs Date: Thu, 18 Dec 2025 09:40:56 +0100 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.56.2 (3.56.2-2.fc42) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 2025-12-18 at 14:42 +0800, =E7=AC=AC108=E6=AC=A1=E6=98=8E=E5=A4=A9 = wrote: > Environment Information > * PostgreSQL Version: 14.5 > =C2=A0* OS: Debian GNU/Linux 11 (bullseye) > =C2=A0* Architecture: aarch64 (8-core CPU) > =C2=A0* Memory: 8GB > =C2=A0* Storage Medium: eMMC > Problem Description > Data corruption occurred in the tb_workstation_message=C2=A0table (record= guid: ce04bd3f-232d-4c7f-9a91-540d0e581649). > Queries targeting this record fail with: > ERROR: invalid memory alloc request size 18446744073709551613 > Corruption details of the record: > =C2=A0* Only the guid=C2=A0field remains valid; > =C2=A0* All int-type fields (e.g., upload_status) are set to 0; > =C2=A0* All timestamp-type fields (e.g., create_time) are reset to 2000-0= 1-01 00:00:00; > =C2=A0* String-type fields (e.g., operator, content) are inaccessible (qu= eryable only after forcing UPDATE=C2=A0to null). > Investigation Details 1. Database Logs: No output between 2025-12-01 05= :37:05.932 ~ 09:02:31.533 (no abnormalities found). > =C2=A0=C2=A0=C2=A02. Dynamic Library Check: libpq.so=C2=A0had environment= variable misconfiguration (not pointing to PG install dir), > but the business app does NOT depend on this library =E2=80=94 low = corruption probability. > =C2=A0=C2=A0=C2=A03. eMMC Storage Analysis: > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0- Used dd=C2=A0to extract the c= orrupted block; hex analysis shows only guid=C2=A0bytes are valid (others a= re 0, > confirming physical data corruption). > =C2=A0=C2=A0=C2=A04. fstrim Check: > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0- fstrim=C2=A0executed at 2025-= 12-01 00:27 (asynchronous, runs on disk idle); anomaly occurred after this. > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0- Reproduction attempt: Simulat= ed data insertion + 10+ fstrim runs =E2=80=94 corruption not reproduced. > Impact * Business failure: Query errors trigger business alerts. > =C2=A0* Backup failure: Database backups are affected by corrupted data. > Additional Notes * No system/app/PG restarts during the anomaly window. > =C2=A0* No writes to tb_workstation_message=C2=A0after 2025-12-01 05:34:0= 0. > =C2=A0* No online operations/terminals between 05:34:00 ~ 09:02:31. > Request: > We suspect this may relate to fstrim on eMMC (with PG 14.5) but cannot re= produce it. Could the community > help analyze the root cause, or guide further troubleshooting? "fstrim" should not destroy data... I am wondering how this problem can lead to backup failure - unless you are= using "pg_dump" for backups. You probably figured out that you will have to delete the row to get rid of= the problem. In addition, you should dump and restore the database to a new cluster - wh= o knows what other data corruption is lurking there. I don't know what caused your problem, but I would suspect hardware failure= . Perhaps you should check or replace the disk. Yours, Laurenz Albe