Re: Finding memory corruption in an extension

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Jack Orenstein <jao(at)geophile(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org >> PG-General Mailing List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Finding memory corruption in an extension
Date: 2021-01-08 17:53:52
Message-ID: CAFj8pRCtUDQw5eNZ1DmUsYU1EfctcCf63A=pz0_RnJt975Qv9A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi

pá 8. 1. 2021 v 18:48 odesílatel Jack Orenstein <jao(at)geophile(dot)com> napsal:

> An extension I'm creating is causing Postgres to crash, almost certainly
> due to memory corruption. I am using palloc0/pfree, calling SET_VARSIZE,
> and generally following the procedures documented here:
> https://www.postgresql.org/docs/12/xfunc-c.html. I am also testing my
> code outside of Postgres (using alloc/free instead of palloc0/pfree), and
> valgrind is not finding any corruption or leaks.
>
> The crash is not completely reproducible, but when it does happen, it's
> pretty fast -- create a table, insert a couple of rows, explain a query.
> (My goal is to create a GIN index on my datatype, but this crash occurs
> without the index.)
>
> I'm interested in advice on how to go about hunting down my problem.
> Something along the lines of a debugging malloc, or valgrind, for Postgres.
>

The basic feature is using postgres compiled with --enable-cassert flag. It
does lot of checks of memory corruptions

Regards

Pavel

> Jack Orenstein
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2021-01-08 18:28:45 Re: Finding memory corruption in an extension
Previous Message Jack Orenstein 2021-01-08 17:47:53 Finding memory corruption in an extension