Re: pg11.1 jit segv

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: Justin Pryzby <pryzby@telsasoft.com>
Cc: pgsql-hackers@postgresql.org
Date: 2018-11-15T23:14:01Z
Lists: pgsql-hackers
Hi,

On 2018-11-15 17:03:35 -0600, Justin Pryzby wrote:
> On Thu, Nov 15, 2018 at 02:47:55PM -0800, Andres Freund wrote:
> > > (gdb) bt
> > > #0  0x00007f08127e814e in ?? ()
> > > #1  0x0000000000000000 in ?? ()
> > 
> > Could you enable jit_debugging_support and reproduce?  That should give
> > a more useful backtrace.

> Core was generated by `postgres: pryzbyj ts [local] EXPLAIN                   '.
> Program terminated with signal 11, Segmentation fault.
> #0  0x00007f819e227cb9 in __memcpy_ssse3_back () from /lib64/libc.so.6
> Missing separate debuginfos, use: debuginfo-install audit-libs-2.8.1-3.el7_5.1.x86_64 bzip2-libs-1.0.6-13.el7.x86_64 cyrus-sasl-lib-2.1.26-23.el7.x86_64 elfutils-libelf-0.170-4.el7.x86_64 elfutils-libs-0.170-4.el7.x86_64 glib4
> (gdb) bt
> #0  0x00007f819e227cb9 in __memcpy_ssse3_back () from /lib64/libc.so.6
> ...

Huh, that's the same crash? Because I don't see any evalexpr functions
in the stack, and without those the above bt should have worked...


> > It'd also be interesting if toggling jit_inline_above_cost=-1,
> > jit_optimize_above_cost=-1 and jit_tuple_deforming=false, each set
> > individually, make a difference.
> 
> Crashes with jit_tuple_deforming=true (others off).

> Doesn't crash with other combinations:
>    Options: Inlining false, Optimization true, Expressions true, Deforming false
>    Options: Inlining true, Optimization false, Expressions true, Deforming false

Oh, interesting. That helps.  Could you perhaps show an EXPLAIN VERBOSE
of the query plan?


> > Any way for me to reproduce this locally? I.e. can you narrow this down
> > to a reproducible test case?
> 
> Will work on it.

Thanks!

Greetings,

Andres Freund


Commits

  1. Fix jit compilation bug on wide tables.

  2. Verify that expected slot types match returned slot types.

  3. Rejigger materializing and fetching a HeapTuple from a slot.