Re: BUG #16329: Valgrind detects an invalid read when building a gist index with buffering

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Pavel Borisov <pashkin(dot)elfe(at)gmail(dot)com>
Cc: Alexander Lakhin <exclusion(at)gmail(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org, kyzevan23(at)mail(dot)ru
Subject: Re: BUG #16329: Valgrind detects an invalid read when building a gist index with buffering
Date: 2023-03-29 15:37:53
Message-ID: 3990135.1680104273@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Pavel Borisov <pashkin(dot)elfe(at)gmail(dot)com> writes:
> So I think that the patch by Alexander will do the thing. I also added some
> comments to the code and removed extra context reset in gistBuildCallback
> (which is already done level down) to make things clear.

My apologies for having let this slip through the cracks. I think
I'd wanted to understand why the committed version of the GiST
index tests doesn't expose the problem, and I never got time to
study that. I still haven't tracked it down, but the proposed patch
seems clearly safe so I've gone ahead and pushed it.

I did use Alexander's original code change that just moved the
totals-incrementing. It looks to me like gistProcessEmptyingQueue
is not guaranteed to reach the context reset, and I'd rather have
an extra reset than miss one. (No-op context resets are cheap.)

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2023-03-29 15:40:47 Re: BUG #17874: Incorrect memory access at gistBuildCallback
Previous Message PG Bug reporting form 2023-03-29 14:00:01 BUG #17877: Referencing a system column in a foreign key leads to incorrect memory access