Re: JIT crash introduced by 6185c9737c with LLVM 14

Lists: pgsql-bugs
From: Jeff Davis <jeff(at)j-davis(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Cc: Amit Langote <amitlan(at)postgresql(dot)org>
Subject: JIT crash introduced by 6185c9737c with LLVM 14
Date: 2024-06-14 04:25:30
Message-ID: c8303edcc9093ed102205138129d53f99b15b4c9.camel@j-davis.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

The following query causes a crash on an optimized build using LLVM 14:

create table t(i int);
set jit_above_cost=0;
select count(*) from t;

I bisected the crash to 6185c9737c.

Regards,
Jeff Davis


From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: Jeff Davis <jeff(at)j-davis(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org, Amit Langote <amitlan(at)postgresql(dot)org>
Subject: Re: JIT crash introduced by 6185c9737c with LLVM 14
Date: 2024-06-14 05:57:36
Message-ID: CA+HiwqHZRYt38Q7iWpMpEqh3-6ND+8AiHnysfhdgJr55KRKBpQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Hi Jeff,

On Fri, Jun 14, 2024 at 1:25 PM Jeff Davis <jeff(at)j-davis(dot)com> wrot>
> The following query causes a crash on an optimized build using LLVM 14:
>
> create table t(i int);
> set jit_above_cost=0;
> select count(*) from t;
>
> I bisected the crash to 6185c9737c.

Thanks for the report. Will look into it.

--
Thanks, Amit Langote


From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: Jeff Davis <jeff(at)j-davis(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org, Amit Langote <amitlan(at)postgresql(dot)org>
Subject: Re: JIT crash introduced by 6185c9737c with LLVM 14
Date: 2024-06-17 09:32:57
Message-ID: CA+HiwqH4cnsKv-OcF6mj+4DdCO22Yqu4pFZ8EdkRe29OQ76yBA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Hi Jeff,

On Fri, Jun 14, 2024 at 2:57 PM Amit Langote <amitlangote09(at)gmail(dot)com> wrote:
> On Fri, Jun 14, 2024 at 1:25 PM Jeff Davis <jeff(at)j-davis(dot)com> wrot>
> > The following query causes a crash on an optimized build using LLVM 14:
> >
> > create table t(i int);
> > set jit_above_cost=0;
> > select count(*) from t;
> >
> > I bisected the crash to 6185c9737c.
>
> Thanks for the report. Will look into it.

Would you please share more details about the crash (llvm build
attributes, etc.) as I'm unable to reproduce this crash with
libLLVM-14.so that I built from sources that I got at [1]. No luck
even after building with -DLLVM_ENABLE_ASSERTIONS=ON. I'm building PG
HEAD with --buildtype=release.

--
Thanks, Amit Langote

[1] https://github.com/llvm/llvm-project/releases/tag/llvmorg-14.0.6


From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: Jeff Davis <jeff(at)j-davis(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org, Amit Langote <amitlan(at)postgresql(dot)org>
Subject: Re: JIT crash introduced by 6185c9737c with LLVM 14
Date: 2024-06-18 06:11:40
Message-ID: CA+HiwqEkqFQXFRU4FxwSH1ei+8UJouNiddvDc4NL6ujinkvHfw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Hi,

On Mon, Jun 17, 2024 at 6:32 PM Amit Langote <amitlangote09(at)gmail(dot)com> wrote:
> Hi Jeff,
>
> On Fri, Jun 14, 2024 at 2:57 PM Amit Langote <amitlangote09(at)gmail(dot)com> wrote:
> > On Fri, Jun 14, 2024 at 1:25 PM Jeff Davis <jeff(at)j-davis(dot)com> wrot>
> > > The following query causes a crash on an optimized build using LLVM 14:
> > >
> > > create table t(i int);
> > > set jit_above_cost=0;
> > > select count(*) from t;
> > >
> > > I bisected the crash to 6185c9737c.
> >
> > Thanks for the report. Will look into it.
>
> Would you please share more details about the crash (llvm build
> attributes, etc.) as I'm unable to reproduce this crash with
> libLLVM-14.so that I built from sources that I got at [1]. No luck
> even after building with -DLLVM_ENABLE_ASSERTIONS=ON. I'm building PG
> HEAD with --buildtype=release.

Also, could you please check if the crash still occurs after applying
the attached patch which removes the changes that 6185c9737c made to
files under src/backend/jit?

(My colleague David Rowley offered to test it on a raspberrypi and on
a x86_64 machine with libLLVM-14.so, but sees no crash using those
steps.)

--
Thanks, Amit Langote

Attachment Content-Type Size
v1-0001-SQL-JSON-Remove-src-backend-jit-changes-for-testi.patch application/octet-stream 4.5 KB

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Amit Langote <amitlangote09(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org, Amit Langote <amitlan(at)postgresql(dot)org>
Subject: Re: JIT crash introduced by 6185c9737c with LLVM 14
Date: 2024-06-18 15:20:22
Message-ID: 12ffcc04d27a6677238a8ab8572a2bffc66c8fdf.camel@j-davis.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On Tue, 2024-06-18 at 15:11 +0900, Amit Langote wrote:
> Also, could you please check if the crash still occurs after applying
> the attached patch which removes the changes that 6185c9737c made to
> files under src/backend/jit?
>
> (My colleague David Rowley offered to test it on a raspberrypi and on
> a x86_64 machine with libLLVM-14.so, but sees no crash using those
> steps.)

My testcase was wrong because I was installing into the same
destination directory each time when bisecting (that shortcut normally
works but can cause problems with LLVM changes). When I install into a
fresh directory, it works.

There may (or may not) have been some bug in my original larger case,
but I'll have to re-investigate, and in any case I don't think your
commit was a problem.

Regards,
Jeff Davis


From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Amit Langote <amitlangote09(at)gmail(dot)com>, pgsql-bugs(at)postgresql(dot)org, Amit Langote <amitlan(at)postgresql(dot)org>
Subject: Re: JIT crash introduced by 6185c9737c with LLVM 14
Date: 2024-06-18 23:03:11
Message-ID: CA+hUKGJtKcRJv3ZiWfRyGd8aE5zaLebJMPf7d2L66tH7_wku3A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On Wed, Jun 19, 2024 at 3:20 AM Jeff Davis <pgsql(at)j-davis(dot)com> wrote:
> There may (or may not) have been some bug in my original larger case,
> but I'll have to re-investigate, and in any case I don't think your
> commit was a problem.

There are some unresolved reports of crashes on ARM CPUs using LLVM 14
in particular. What is your CPU?


From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: Jeff Davis <pgsql(at)j-davis(dot)com>, Amit Langote <amitlangote09(at)gmail(dot)com>, pgsql-bugs(at)postgresql(dot)org, Amit Langote <amitlan(at)postgresql(dot)org>
Subject: Re: JIT crash introduced by 6185c9737c with LLVM 14
Date: 2024-06-18 23:52:41
Message-ID: ZnIdyXbHsz7Km693@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg토토 사이트 추천SQL : Postg토토 사이트 추천SQL 메일 링리스트 : 2024-06-18 이후 PGSQL 버그 23:52

On Wed, Jun 19, 2024 at 11:03:11AM +1200, Thomas Munro wrote:
> On Wed, Jun 19, 2024 at 3:20 AM Jeff Davis <pgsql(at)j-davis(dot)com> wrote:
>> There may (or may not) have been some bug in my original larger case,
>> but I'll have to re-investigate, and in any case I don't think your
>> commit was a problem.

Okay, for now I have removed Amit's name as owner of this open item.

> There are some unresolved reports of crashes on ARM CPUs using LLVM 14
> in particular. What is your CPU?

But it looks like we still have something new to v17 in this case, so
the item it still around, pending more investigation.
--
Michael


From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-bugs(at)postgresql(dot)org, Amit Langote <amitlan(at)postgresql(dot)org>
Subject: Re: JIT crash introduced by 6185c9737c with LLVM 14
Date: 2024-06-19 00:09:56
Message-ID: CA+HiwqHM2ErVTkp_v58ch45-RECB3TJWUOW_BYK7qjhzss4dRg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On Wed, Jun 19, 2024 at 8:52 AM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
> On Wed, Jun 19, 2024 at 11:03:11AM +1200, Thomas Munro wrote:
> > On Wed, Jun 19, 2024 at 3:20 AM Jeff Davis <pgsql(at)j-davis(dot)com> wrote:
> >> There may (or may not) have been some bug in my original larger case,
> >> but I'll have to re-investigate, and in any case I don't think your
> >> commit was a problem.

Ok, thanks.

> Okay, for now I have removed Amit's name as owner of this open item.
>
> > There are some unresolved reports of crashes on ARM CPUs using LLVM 14
> > in particular. What is your CPU?
>
> But it looks like we still have something new to v17 in this case, so
> the item it still around, pending more investigation.

+1. I was about to mark it as resolved, but this makes sense.

--
Thanks, Amit Langote