From: | Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com> |
---|---|
To: | exclusion(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org, PG Bug reporting form <noreply(at)postgresql(dot)org> |
Subject: | Re: BUG #17372: Altering statistics during concurrent drop can lead to a server crash |
Date: | 2022-01-20 17:57:32 |
Message-ID: | 2615f158-b790-4176-11ad-9711e4fd56c7@enterprisedb.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On 1/20/22 05:00, PG Bug reporting form wrote:
> The following bug has been logged on the website:
>
> Bug reference: 17372
> Logged by: Alexander Lakhin
> Email address: exclusion(at)gmail(dot)com
> PostgreSQL version: 14.1
> Operating system: Ubuntu 20.04
> Description:
>
> The following script (based on the stats_ext test):
> psql -c "CREATE TABLE ab1 (a INTEGER, b INTEGER, c INTEGER);"
> for i in `seq 100`; do
> echo "iteration $i"
> ( { for n in `seq 20`; do echo "CREATE STATISTICS ab1_a_b_stats ON a, b FROM
> ab1; DROP STATISTICS ab1_a_b_stats;"; done } | psql ) >psql1.log 2>&1 &
> ( { for n in `seq 20`; do echo "ALTER STATISTICS ab1_a_b_stats SET
> STATISTICS -1;"; done } | psql ) >psql2.log 2>&1 &
>
> wait
> sleep 2
> coredumpctl --no-pager && break
> done
>
Thanks for the report - I've reproduced it using your script (I had to
add a short wait before the syscache lookup). The issue is fairly
simple, we never check we actually found a tuple in the syscache, i.e.
there's no HeapTupleIsValid() call. We check the OID earlier, but the
tuple may have disappeared since then.
IMO the usual "cache lookup failed" error that we throw in other places
in similar cases is good enough. We already fail with other errors
(tuple concurrently updated/deleted) here.
Patch attached.
regards
--
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Attachment | Content-Type | Size |
---|---|---|
alter-statistics-fix.patch | text/x-patch | 618 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Liam Bowen | 2022-01-21 02:00:22 | Further information on BUG #17299: Exit code 3 when open connections concurrently (PQisthreadsafe() == 1) |
Previous Message | Vijaykumar Jain | 2022-01-20 17:38:59 | Re: Query on postgres_fdw extension |