From: | Amit Langote <amitlangote09(at)gmail(dot)com> |
---|---|
To: | Tomas Vondra <tomas(at)vondra(dot)me> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Batching in executor |
Date: | 2025-10-10 06:40:37 |
Message-ID: | CA+HiwqFY6zfTcMYiT8eJQQWp7DvtGJc88Q6xAqA8pF8mb7ic=w@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
On Mon, Sep 29, 2025 at 8:01 PM Tomas Vondra <tomas(at)vondra(dot)me> wrote:
> I also tried running TPC-H. I don't have useful numbers yet, but I ran
> into a segfault - see the attached backtrace. It only happens with the
> batching, and only on Q22 for some reason. I initially thought it's a
> bug in clang, because I saw it with clang-22 built from git, and not
> with clang-14 or gcc. But since then I reproduced it with clang-19 (on
> debian 13). Still could be a clang bug, of course. I've seen ~20 of
> those segfaults so far, and the backtraces look exactly the same.
I can reproduce the Q22 segfault with clang-17 on macOS and the
attached patch 0009 fixes it.
The issue I observed is that two EEOPs both called the same helper,
and that helper re-peeked ExecExprEvalOp(op) to choose its path; in
this particular build the two EEOP cases in ExecInterpExpr() compiled
to identical code so their dispatch labels had the same address
(reverse_dispatch_table logging in ExecInitInterpreter() showed the
duplicate), and because ExecEvalStepOp() maps by label address the
reverse lookup could yield the other EEOP -- I saw ExprInit select
ROWLOOP EEOP while the ExprExec-time helper observed DIRECT EEOP and
ran code for it, which then crashed.
In 0009 (the fix), I split the helper into two functions, one per
EEOP, so the helper does not re-derive the opcode; with that change I
cannot reproduce the crash on macOS clang-17.
--
Thanks, Amit Langote
Attachment | Content-Type | Size |
---|---|---|
v3-0006-WIP-Add-EEOP_AGG_PLAIN_TRANS_BATCH_ROWLOOP.patch | application/octet-stream | 21.5 KB |
v3-0007-WIP-Add-EEOP_AGG_PLAIN_TRANS_BATCH_DIRECT.patch | application/octet-stream | 11.2 KB |
v3-0008-WIP-Add-ExecQualBatch-and-EEOPs-for-batched-quals.patch | application/octet-stream | 22.7 KB |
v3-0009-Blind-guess-at-fixing-segfault-on-running-tpch-q2.patch | application/octet-stream | 11.6 KB |
v3-0005-WIP-Add-EEOPs-and-helpers-for-TupleBatch-processi.patch | application/octet-stream | 16.9 KB |
v3-0001-Add-batch-table-AM-API-and-heapam-implementation.patch | application/octet-stream | 13.7 KB |
v3-0004-WIP-Add-agg_retrieve_direct_batch-for-plain-aggre.patch | application/octet-stream | 6.3 KB |
v3-0003-Executor-add-ExecProcNodeBatch-and-integrate-SeqS.patch | application/octet-stream | 9.0 KB |
v3-0002-SeqScan-add-batch-driven-variants-returning-slots.patch | application/octet-stream | 27.2 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Chao Li | 2025-10-10 07:00:35 | URLs in rbtree.c are broken |
Previous Message | Chao Li | 2025-10-10 06:39:58 | Re: Incorrect version number given to sync_pgdata() in pg_combinebackup.c |