Re: Re[2]: [BUGS] Segfault in MemoryContextAlloc - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Re[2]: [BUGS] Segfault in MemoryContextAlloc
Date
Msg-id 31289.1454801420@sss.pgh.pa.us
Whole thread Raw
In response to Re: Re[2]: [BUGS] Segfault in MemoryContextAlloc  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: Re[2]: [BUGS] Segfault in MemoryContextAlloc
List pgsql-bugs
Pavel Stehule <pavel.stehule@gmail.com> writes:
> 2016-01-27 13:26 GMT+01:00 Andres Freund <andres@anarazel.de>:
>> What exactly does your extension do? And where did you add that null check?

> this extension does some log preprocessing for syslog
> extension and fix attached

That extension is broken on its face.  You cannot have an emit_log_hook
that does catalog access, because elog() can be called outside a
transaction or in an already-failed transaction.  Whatever band-aids
you put around that will just be band-aids that will fail regularly.
You need to move the catalog lookup someplace else.  (Actually, I wonder
why you're doing a catalog lookup at all ... wouldn't it be sufficient to
do a DirectFunctionCall to inet_out?)

I doubt this has much to do with the OP's issue.

            regards, tom lane

pgsql-bugs by date:

Previous
From: "Peter J. Holzer"
Date:
Subject: Re: BUG #13898: ecpg complains on nested comments in /usr/pgsql-9.4/include/informix/esql/datetime.h
Next
From: Tom Lane
Date:
Subject: Re: Re[2]: [BUGS] Segfault in MemoryContextAlloc