Re: JIT causes core dump during error recovery - Mailing list pgsql-hackers

From Tom Lane
Subject Re: JIT causes core dump during error recovery
Date
Msg-id 1577388.1719432107@sss.pgh.pa.us
Whole thread Raw
In response to JIT causes core dump during error recovery  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: JIT causes core dump during error recovery
List pgsql-hackers
I wrote:
> What I think is the right solution is to fix things so that
> seemingly-no-longer-used jit compilations are not thrown away
> until transaction cleanup.  I don't know the JIT code nearly
> well enough to take point on fixing it like that, though.

Or maybe not.  I found by bisecting that it doesn't fail before
2e517818f (Fix SPI's handling of errors during transaction commit).
A salient part of that commit message:

    Having made that API redefinition, we can fix this mess by having
    SPI_commit[_and_chain] trap errors and start a new, clean transaction
    before re-throwing the error.  Likewise for SPI_rollback[_and_chain].

So delaying removal of the jit-created code segment until transaction
cleanup wouldn't be enough to prevent this crash, if I'm reading
things right.  The extra-pstrdup solution may be the only viable one.

I could use confirmation from someone who knows the JIT code about
when jit-created code is unloaded.  It also remains very unclear
why there is no crash if we don't force both jit_optimize_above_cost
and jit_inline_above_cost to small values.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: New standby_slot_names GUC in PG 17
Next
From: Jelte Fennema-Nio
Date:
Subject: Re: libpq: Fix lots of discrepancies in PQtrace