Re: replication cleanup code incorrect way to use of HTAB HASH_REMOVE ? - Mailing list pgsql-hackers

From Thomas Munro
Subject Re: replication cleanup code incorrect way to use of HTAB HASH_REMOVE ?
Date
Msg-id CA+hUKGLY=p4D=iW1TRVTK=cY3AOhFV3B--HMZHbjL6GypoT8+Q@mail.gmail.com
Whole thread Raw
In response to Re: replication cleanup code incorrect way to use of HTAB HASH_REMOVE ?  (Peter Smith <smithpb2250@gmail.com>)
Responses Re: replication cleanup code incorrect way to use of HTAB HASH_REMOVE ?  (Peter Smith <smithpb2250@gmail.com>)
Re: replication cleanup code incorrect way to use of HTAB HASH_REMOVE ?  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
On Mon, Mar 22, 2021 at 10:50 AM Peter Smith <smithpb2250@gmail.com> wrote:
> The real problem isn't the Assert. It's all those other usages of ent
> disobeying the API rule: "(NB: in the case of the REMOVE action, the
> result is a dangling pointer that shouldn't be dereferenced!)"

I suppose the HASH_REMOVE case could clobber the object with 0x7f if
CLOBBER_FREED_MEMORY is defined (typically assertion builds), or
alternatively return some other non-NULL but poisoned pointer, so that
problems of this ilk  blow up in early testing.



pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: shared memory stats: high level design decisions: consistency, dropping
Next
From: Peter Geoghegan
Date:
Subject: Re: 64-bit XIDs in deleted nbtree pages