Re: JIT causes core dump during error recovery
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-hackers@lists.postgresql.org
Date: 2024-06-26T20:01:47Z
Lists: 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
Commits
-
Avoid crashing when a JIT-inlined backend function throws an error.
- dccda847b709 12.20 landed
- 86fac88eed4b 13.16 landed
- 5401e70e47aa 15.8 landed
- 13abc1f66074 14.13 landed
- 5d6c64d29097 17.0 landed
- 07d66d3cc2a9 16.4 landed