Bug #121554 ndbmtd 8.4.11: DbtupRoutines.cpp:666 require((srcBytes <= max_var_size)) failed in query thread read

Submitted: 19 Oct 19:46 Modified: 21 Nov 17:47
Reporter: Bart B Email Updates:
Status: Open Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S2 (Serious)
Version:8.4.11 (mysql-cluster-community) OS:Ubuntu (Ubuntu 24.04 LTS, kernel 6.8.0 (6.8.0-138-generic at event 3))
Assigned to: CPU Architecture:x86 (x86_64, AMD EPYC 4004-series (Zen 4), 16 cores / 32 threads)

[19 Oct 19:46] Bart B
Description:
1. SUMMARY

An ndbmtd data node (NDB 8.4.11, release build) aborted three times with

  DbtupRoutines.cpp:666: require((srcBytes <= max_var_size)) failed

- 3 events, 2 data nodes: node 4 twice (2026-08-31, 2026-09-03), node 2 once (2026-10-17);
  different node groups, separate hosts, RAM from different manufacturers.
- Same failure site: varsize_reader at base+0x39d8d1; ndbmtd md5 identical on both hosts.
- Always a query thread (DBQLQH) doing a READ COMMITTED read of a var-size attribute: two
  ordered-index scans and one primary-key dirty read, 2 tables, 3 fragments.
- In each trace dump the LDM thread owning that fragment was in the middle of an insert into
  the same fragment; its JAM shows it had just run Dbtup::alloc_var_part on an existing var
  page (cause or consequence, see caveat (b)).
- The partner replica kept the node group up; with StopOnError=0 the node was back in 69 s and
  84 s (event 1: ~2 h, StopOnError was still 1). We found no loss of stored data.

Hypothesis (source reading, unproven): insert-path var-page reorganisation (alloc_var_part ->
Tup_varsize_page::alloc_record -> reorg) runs without exclusive fragment access, while
query-thread readers dereference var-part pointers after releasing the TUP fragment mutex.
See "Suggested fix" for file:line references.

Attachment ndb-varsize-assert-bundle.tgz (README.txt inside): per event the error log, an
out.log excerpt, the crashing query-thread and owning-LDM traces; config.ini; full table
definitions; and the full-length versions of this description and of the suggested fix
(full-description.txt, full-suggested-fix.txt). Everything is anonymised.

2. ENVIRONMENT

mysql-cluster-community 8.4.11-1ubuntu24.04 (repo.mysql.com apt), Ubuntu 24.04, kernel 6.8.0.
Hosts: single-socket AMD EPYC 4004-series (Zen 4), 16C/32T, 2 x 32 GB DDR5 (no ECC beyond
DDR5 on-die ECC), NVMe. 6 data nodes, NoOfReplicas=2, NG0={1,2} NG1={3,4} NG2={5,6};
3 management nodes; one SQL node per data node host (ndb_cluster_connection_pool=4).
AutomaticThreadConfig=1, the same on all 6 data nodes: NumCPUs=16 until a rolling restart
on 2026-09-03 (events 1-2: 4 ldm, 4 query = DBQLQH 1-4), NumCPUs=24 since then (event 3:
6 ldm thr 2-7 = DBLQH 1-6, 6 query thr 8-13 = DBQLQH 1-6).
DataMemory=32G (40G at event 1), TransactionMemory=3G, LockPagesInMainMemory=1,
StopOnError=0 (1 at event 1), MaxNoOfConcurrentOperations=262144, MaxNoOfConcurrentScans=500.
SQL nodes: READ-COMMITTED, ndb_batch_size=1M, ndb_read_backup=ON.

3. THE THREE EVENTS ("35/3" = table 35 fragment 3)

                     Event 1               Event 2               Event 3
Time (UTC)           2026-08-31 13:58:44   2026-09-03 21:11:23   2026-10-17 23:24:36
Node / thread        4 / thr 9 DBQLQH(4)   4 / thr 8 DBQLQH(3)   2 / thr 8 DBQLQH(1)
Read                 ordered-index scan    PK read: LQHKEYREQ    ordered-index range
                     DESC, no bound,       Read Simple Dirty     scan ASC; died on 1st
                     pushed condition                            ACC_CHECK_SCAN after
                                                                 its SCAN_FRAGREQ
Object               index 142 (idx_ts),   table 107, 107/4      index 141 (PRIMARY),
                     35/10                                       35/3
Requester            API 154 via DBTC(2)   API 160 via DBTC(1)   API 177 via DBTC(2)
                     on node 2             on node 4 (local)     on node 5
Abort path           interpreterNextLab >  handleReadReq >       interpreterStartLab >
                     readAttributes >      readAttributes >      readAttributes >
                     varsize_reader        read_packed >         read_packed >
                                           varsize_reader        varsize_reader
Owning LDM           thr 5 = DBLQH(4):     thr 3 = DBLQH(2):     thr 7 = DBLQH(6):
                     Write 35/10 -> ACC    Insert 107/4:         Write 35/3 -> ACC
                     insert; alloc_fix_rec alloc_fix_rec +       insert; alloc_fix_rec
                     + alloc_var_part      alloc_var_part        + alloc_var_part
                     (existing page); then (existing page); then (existing page); then
                     waits at DblqhMain    COMMIT waits at       waits at DblqhMain
                     7105 (write-key)      DblqhMain 7209        7105 (write-key)

Caveats: (a) the crashing node always held the primary replica; with read_backup=1 that is
just DBTC read routing here, not a clue. (b) A stuck owning LDM is also the expected
consequence of any query-thread crash (the dead thread never releases fragment access), so
it fits a race but does not prove one.

4. OUT.LOG (full stacks and base-relative offsets of all three events in the attachment)

Event 3 stack: varsize_reader < read_packed < readAttributes < interpreterStartLab <
execTUPKEYREQ < Dblqh::nextScanConfScanLab < continue_next_scan_conf < Dbtux::continue_scan
< Dblqh::execACC_CHECK_SCAN. All three error logs: Error 6000, "Signal 6 received; Aborted".

5. TABLES (anonymised; full DDL of both tables in the attachment)

Table id 35 (t1; indexes 141 = PRIMARY, 142 = idx_ts, 86 = idx_k1_ts), 13 columns:
PRIMARY KEY (k1 varchar(12) latin1, k2 char(32) latin1), PARTITION BY KEY (k1), utf8mb4
default; var-size: k1, s1 + s2 varchar(255) COLUMN_FORMAT DYNAMIC, s3 varchar(45),
s4 varchar(32), s5 varchar(20) (static); fixed: ts int (idx_ts, idx_k1_ts = (k1,ts)) and
small int/decimal/char(2) columns. NDB_TABLE=NOLOGGING=1.
Table id 107 (t2; index 114 = PRIMARY): same PK and partitioning, 28 columns; varchar
s1..s14, of which s1, s2, s4 (varchar(255)) and s9 (varchar(64)) are DYNAMIC, declared at
CREATE TABLE on 2026-08-29.
Both tables: NOLOGGING, Row Checksum 1, ForceVarPart 1, FragmentCount 12, FOR_RP_BY_LDM,
read_backup 1, no BLOB/TEXT/JSON; each mixes static var-size and DYNAMIC columns.

6. WORKLOAD (high-churn session-style tables)

t1: several hundred thousand rows. All 6 SQL nodes write it with multi-row REPLACE (~1000 rows
per statement, on the order of 100k rows/min); a REPLACE of a missing key becomes an insert.
Rows expire a few minutes after their last write; once a minute one SQL node deletes them in
chunks (READ COMMITTED ordered read on idx_ts, then a range DELETE on ts). Readers are
READ COMMITTED per-k1 queries (e.g. "WHERE k1 = ? ORDER BY ts DESC LIMIT n"), which DBTC can
route to query threads. t2 (tens of thousands of rows): single-row PK reads and writes. The
statements behind the crashing reads were not identified.

7. RULED OUT

- OOM / memory pressure, watchdog / overload / GCP warnings: none before any abort.
- Index-statistics scans: stat 0, API requesters, and none running at event 3.
- One table / index / node: 2 tables, 3 access paths (141 ASC, 142 DESC, hash PK), 2 nodes.
- Hardware (unlikely, not excluded): no MCE/EDAC/AER events, HardwareCorrupted 0 kB on all 6
  hosts; different DIMM makers on nodes 2 and 4; node 4 quiet for 44 days after 2 events in
  3 days; Row Checksum covers the fixed part incl. the var part reference. But the RAM is
  non-ECC, so a bit flip in any one event cannot be strictly excluded.
- Changes: no package or config change on the day of event 3.

8. IMPACT

The node was rebuilt from its partner; SQL clients stalled ~6 s until the node was declared
dead, and in-flight transactions got temporary errors (4010, 4028, 4119, 270). If the race
hypothesis is right, some reads could also return wrong var-size values with no error
instead of tripping the require; we have no evidence either way.

How to repeat:
We cannot reproduce this on demand; it is not deterministic. Below are the conditions under
which it happened, and a stress setup that should make the suspected race more likely.

Observed rate: 3 events in about 350 data-node-days (6 data nodes, about two months of
production): 2026-08-31, 2026-09-03 and 2026-10-17. The events hit two different nodes. The
thread layout was NumCPUs=16 for the first two and NumCPUs=24 for the third.

Conditions in production (DDL and settings are in the Description):
1. ndbmtd with query threads: AutomaticThreadConfig=1, one query thread per LDM thread,
   NoOfReplicas=2, read_backup=1, 12 fragments per table (FOR_RP_BY_LDM).
2. NOLOGGING tables with a 2-column PK (k1 varchar(12), k2 char(32)), PARTITION BY KEY (k1),
   extra ordered indexes (t1: on (ts) and, from after event 1, on (k1, ts); t2: on (n3, ts)),
   and several var-size columns: static varchar columns plus COLUMN_FORMAT DYNAMIC
   varchar(255) columns whose values vary in length.
3. Writers (all 6 SQL nodes): continuous multi-row REPLACE of about 1000 rows per statement,
   on the order of 100k rows/min. A REPLACE of a key that is not present becomes an INSERT,
   which allocates a var part (alloc_var_part). On the second table: single-row writes,
   e.g. the INSERT of a new key in event 2. Its expiry job also runs an UPDATE (by PK list)
   that sets a DYNAMIC varchar column to ''.
4. Expiry: every minute, rows older than a few minutes are deleted in chunks of 10000 rows
   (an ordered READ COMMITTED snapshot via the (ts) index, then a range DELETE on ts). As a
   result, var pages are constantly freed and re-filled, so free space inside them is
   fragmented.
5. Readers: many concurrent READ COMMITTED statements, which DBTC can route to query
   threads, reading var-size columns of the same fragments:
   a. primary-key lookups (WHERE k1 = ? AND k2 = ?): the access type of event 2
   b. single-partition range scans on PRIMARY (WHERE k1 = ?): the access type of event 3
   c. ordered scans with a pushed condition on a var-size column, e.g.
      WHERE k1 = ? ORDER BY ts DESC LIMIT n through the (ts) index: the access type of
      event 1
   The actual statements were not identified.

Suggested stress setup (we cannot run debug builds in production):
- Concentrate the race on few fragments: 1-2 LDM threads with the maximum number of query
  threads (query = 2x or 3x ldm). Use a single-fragment table, or make all readers and
  writers hit one partition key range.
- Make Tup_varsize_page::reorg() frequent. Insert rows whose var parts vary strongly in size
  (0-255 bytes in several columns), delete a random half, and keep inserting. That way
  alloc_record() often finds enough total free space but not enough contiguous space
  (alloc_size >= largest_size).
- Run 16-64 client threads doing READ COMMITTED PK reads and k1-range scans that return all
  var-size columns, concurrently with 4-8 threads doing INSERT/REPLACE of new keys plus
  DELETEs.
- Make silent corruption detectable: store each var column as a deterministic function of
  (k1, k2), e.g. a repeated hash of length f(k1,k2). Every reader then checks what it
  receives. If the hypothesis is right, mismatches may also appear, possibly before the
  require fires.
- In a debug build: add a jam()/counter to Tup_varsize_page::reorg(), enable the #if 0
  consistency check in varsize_reader (DbtupRoutines.cpp:673-692), and if possible delay
  query-thread reads between DbtupExecQuery.cpp:1209 (mutex released) and readAttributes()
  to widen the window.

Expected result if the hypothesis holds: DbtupRoutines.cpp:666 require((srcBytes <=
max_var_size)) in a DBQLQH thread, and/or reads returning var-column values that belong to
other rows.

Suggested fix:
HYPOTHESIS FROM SOURCE READING, NOT A VERIFIED ROOT CAUSE. (Longer version with quoted code:
full-suggested-fix.txt in the attachment.)

References are to tag mysql-cluster-8.4.11, storage/ndb/src/kernel/blocks/dbtup/ unless
another path is given. We have not reproduced the crash; a release build cannot show whether
a page reorg happened (tuppage.cpp has no jam()). By our diff, DbtupRoutines.cpp,
DbtupExecQuery.cpp, DbtupVarAlloc.cpp, DbtupCommit.cpp, Dbtup.hpp, Dblqh.hpp and DblqhMain.cpp
are unchanged in mysql-cluster-26.7.0 and the 9.7 branch.

A. The failing check
DbtupRoutines.cpp:666 require(srcBytes <= max_var_size) in varsize_reader. srcBytes is the
difference of two Uint16 entries of the row's offset array, read directly from the var page
(readVarSizeNotNULL 791-795; readDynVarSizeShrunkenNotNULL 1319-1321). If those bytes no
longer hold this row's offset array, the difference can exceed the column maximum (trips the
require) or come out small and plausible (silently returns another row's bytes).

B. Query-thread readers do not hold the mutex while they read
DbtupExecQuery.cpp execTUPKEYREQ, ZREAD: 1183 acquire_frag_mutex_read; 1192 setup_read ->
prepare_read stores pointers INTO the var page (4458, 4491-4492: m_data_ptr,
m_offset_array_ptr); 1199-1208 checksum under the mutex; 1209 release_frag_mutex_read;
1211 handleReadReq -> readAttributes (or interpreterStartLab). Dbtup.hpp:856-867: in query
threads the mutex is tup_frag_mutex[logicalPageId & 3], hashed by the FIXED-part page.
4850-4855 states the assumption that holding the mutex only during prepare_read is enough.

C. The insert path can move other rows' var parts without exclusive fragment access
handleInsertReq (DbtupExecQuery.cpp:2458-2461) -> alloc_var_rec (DbtupVarAlloc.cpp:83-115)
-> alloc_fix_rec (takes only the mutex of the NEW row's fixed page, DbtupFixAlloc.cpp:128)
-> alloc_var_part (117-157): get_alloc_page returns an existing var page (jam 138, present in
all three LDM JAMs), then Var_page::alloc_record (147-149). tuppage.cpp:239-251
alloc_record: if (alloc_size >= largest_size) reorg(temp); reorg (368-396) re-packs every
live entry on the page, so the var parts of OTHER rows can move. No
upgrade_to_exclusive_frag_access() is taken on this path ("An initial INSERT operation
requires no mutex", DbtupExecQuery.cpp:1349-1355); fragment access is only upgraded later
(1362-1373, write-key, before the TUX insert), which is where the LDM was blocked in events
1 and 3 (DblqhMain.cpp:7103-7105). alloc_var_rowid (DbtupVarAlloc.cpp:563-590) is similar.

D. Contrast: other paths that move var data do take exclusive access
handle_size_change_after_update (DbtupExecQuery.cpp:4796-4857): its comment says var-part
reallocation "is intruding on all readers from the query thread ... it can even reorganise
an entire page", and it calls upgrade_to_exclusive_frag_access (4825) around realloc_var_part
(which can reorg or call alloc_var_part). Commit and dealloc are exclusive as well
(DbtupCommit.cpp:1782, 201). The insert path in C reaches alloc_var_part -> alloc_record ->
reorg without that protection.

E. move_var_part (OPTIMIZE TABLE path) appears to have the same gap
DbtupVarAlloc.cpp:365-367 calls alloc_record on the destination page (may reorg) before the
upgrade at 393, although its own comment (382-392) says all places that reorganise pages and
rows must use exclusive fragment access because query threads may be reading.

F. Fit with the events, and what does not prove it
- All three are query-thread reads through readAttributes -> varsize_reader on fragments
  where the owning LDM's JAM shows alloc_var_part on an existing var page.
- A write prepare sets m_cond_write_key_waiters (Dblqh.hpp:5030) until write-key access is
  granted (DblqhMain.cpp:7118), and a resuming scan cannot re-acquire access while it is set
  (Dblqh.hpp:4867-4874). So in events 1 and 3 the blocked insert started after the scan last
  resumed: during the failing row read (the race) or after the require fired.
- Not discriminating: allocations into existing var pages are common (18 in the event-3 LDM
  JAMs), and a stuck owning LDM is also the expected consequence of any query-thread crash.

G. Possible fixes (suggestions only)
1. In alloc_var_part / alloc_record: when the allocation would reorg(), pick another or a
   fresh var page, or take exclusive fragment access first as
   handle_size_change_after_update does. alloc_var_rec calls alloc_var_part while holding the
   mutex from alloc_fix_rec, and DbtupExecQuery.cpp:1368-1371 warns against upgrading while
   holding a fragment mutex, so the decision probably has to be made before alloc_fix_rec, or
   the page choice has to avoid reorg() altogether.
2. In move_var_part: upgrade_to_exclusive_frag_access before alloc_record on the destination.
3. Diagnostics: a jam() in Tup_varsize_page::reorg, and the disabled #if 0 consistency check
   in varsize_reader (DbtupRoutines.cpp:673-692).

H. Questions
1. Is this known internally? We found no public bug. Related but already fixed in our version:
   Bug #111932 / #35660890 (query-thread multi-range scan lost its fragment lock, 8.4.4).
2. If our reading is wrong, what keeps query threads off a fragment while its LDM runs
   alloc_var_part?
3. Is disabling query threads (AutomaticThreadConfig=0, ClassicFragmentation=false, explicit
   ThreadConfig with ldm={count=6}, query={count=0}) a supported and effective workaround?
4. Is a rolling restart that temporarily mixes nodes with and without query threads safe in
   8.4.11 (remote DBTCs address DBQLQH instances directly)?
5. Should OPTIMIZE TABLE on tables with var-size columns be avoided until a fix (section E)?
[28 Oct 10:50] MySQL Verification Team
Hi

Thanks for the bug report.
All the information you can upload here would be helpful.

Thanks

Luis
[28 Oct 23:05] Bart B
Thank you. Attached: ndb-varsize-assert-bundle-2.tgz (developers only), with everything we kept:
- every per-thread trace file of all four events (event 2 lacks the thread-0 file);
- error logs, out.log extracts covering crash and restart (event 1: the whole out.log),
  and the management-node cluster log around event 4;
- ndb_desc -p -i and an ndbinfo.memory_per_fragment snapshot of both tables (2026-10-28);
- README.txt with thread layouts and the redaction rules (same scheme as the first
  attachment; the 8 trace files that were already in it are byte-identical).

A 4th occurrence happened after filing: data node 2 again, 2026-10-19 23:32:31 UTC. None
since (as of 2026-10-28).

Same failure: Error 6000, "Signal 6 received; Aborted",
  DbtupRoutines.cpp:666: require((srcBytes <= max_var_size)) failed
The ndbmtd binary is unchanged (same md5). The base-relative return addresses of frames #4-#16
are identical to event 2: require-failure handler 0x11f14c, varsize_reader 0x39d8d1,
read_packed 0x3a24eb, readAttributes 0x39ce15, handleReadReq 0x377612, execTUPKEYREQ 0x37c2fd.

Event 4: node 2, thr 13 = DBQLQH(6). PK read (LQHKEYREQ Read Simple Dirty) on table 107,
fragment 107/9, for API 172 via the local DBTC(1). Owning LDM thr 7 = DBLQH(6): Insert
107/9 with alloc_fix_rec + alloc_var_part (existing page), then its COMMIT waits at
DblqhMain 7209. Back to STARTED in 89 s (restart_info 82 s).

DETAILS

- Crashing signal (newest in thr 13): LQHKEYREQ Read, Simple Dirty NoDisk, TableId 107
  SchemaVer 4, FragId 9, ReplicaNo 0, transId H'00093cfb/H'01f0ac00, from DBTC(1) on node 2
  (thr 20); API 172 is the SQL node co-located with data node 2. The stack frames
  continueACCKEYCONF > acckeyconf_tupkeyreq show ACC found the key; the JAM shows no
  read-key wait.
- Owning LDM thr 7 (107/9 is in log part 227, block_instance 6): newest signals are an
  LQHKEYREQ Insert on 107/9 from DBTC(3) on node 1 (API 151, transId H'000cf68c/H'01f09700),
  then a PACKED_SIGNAL COMMIT for it. JAM: DbaccMain 01239 / DbtupExecQuery 02163 02195 02458
  / DbtupFixAlloc 00119 / DbtupVarAlloc 00532 00534 00421 00423 00138 / DbtupExecQuery 01355
  01363 / DbtuxNode 00168 / ... / DbtupCommit 01285 01559 01595 01759 / DblqhMain 07209.
  24 of 26 block threads have STOP_FOR_CRASH as newest signal; not thr 13 and thr 7.
  Watchdog: "thread 7 is stuck in: JobHandling in block: 247, gsn: 342".
- The crash stack matches event 2 exactly and the owning-LDM state has the same shape. In
  event 2 that insert also moved the var page to the full list (DbtupVarAlloc 519/521/499);
  in event 4 it did not. Different node, node group and DIMM vendor than event 2.

WHAT EVENT 4 ADDS

1. Timing. TIME_SIGNAL carries NDB_TICKS and THRMAN's 10 ms CONTINUEB(4) chain puts all
   threads on one relative clock. With T0 = the tick in thr 13's newest TIME_SIGNAL, the
   crashing read ran in [T0+40, T0+48] ms and thr 7's insert prepare in about
   [T0+43, T0+61] ms. The ticks cannot order them at the scale a race needs.
2. Ordering from the source. acquire_frag_commit_access_write_key sets
   m_cond_exclusive_waiters before the exclusive wait, which blocks new read-key access, so
   thr 13 got read-key access to 107/9 before thr 7 started this commit. The insert prepare
   (alloc_fix_rec, alloc_var_part, any reorg) holds only RK_WK access
   (acquire_frag_prepare_key_access), so it runs concurrently with query-thread key readers.
3. Caveat (b), roughly. In thr 7's buffer (~2.8 s), 107/9 had ~16 committing transactions,
   2 of them inserts. If the stuck LDM were only a consequence of the abort, an unrelated
   insert's commit would have had to reach thr 7 within the ~15-20 ms between thr 13 taking
   read-key access and STOP_FOR_CRASH: about 1-1.5% with independent arrivals (bursty
   traffic may raise that). Order of magnitude only.
4. Thread type. ~30% of the standalone Simple Dirty PK reads of table 107 in this dump ran on
   LDM threads, ~70% on query threads. 4 of 4 aborts in query threads would happen ~24% of
   the time (0.7^4) if thread type did not matter: weak evidence only.
5. Possible precondition (correlation only). ~1.3-1.5 s before the abort an expiry pass ran
   on 107/9: a READ COMMITTED exclusive scan of index 121 (idx_n3_ts) that took over 8 rows
   and updated them (SET n3 = -1, s1 = '', shrinking a DYNAMIC column), then 12 PK deletes.
   Event 3: thr 7 ran a bulk expiry DELETE on 35/3 within the last ~0.15 s of its trace.
   Events 1 and 2: no expiry activity on the fragment in the LDM buffers. Deletes and
   shrinking updates leave holes in var pages, making reorg() in a later insert more
   likely; 2 of 4 is also consistent with chance (~18%). The 2026-10-28 snapshot shows
   var_elem_free_bytes at 20-27% of var_elem_alloc_bytes on average (107/9: 25.8%).

RATE

Events 1-4: 2026-08-31, 09-03, 10-17, 10-19 on nodes 4, 4, 2, 2 (gaps 3.3, 44.1, 2.0 days).
Event 4 came 48 h after node 2 was rebuilt from node 1 after event 3 (NOLOGGING tables), so a
corrupt row surviving from before event 3 is unlikely. After the rolling restart of all six
nodes on 09-03 nothing happened for 44 days, so a fresh restart alone does not trigger it.
Between events 3 and 4: no change in binary, shared libraries, config generation, kernel,
schema or workload; no LCP or index-stat scan running; no MCE/EDAC/AER events.

QUESTIONS (in addition to section H of the report)

1. As an interim workaround, would fully fixed-size rows avoid this code path: both tables
   rebuilt with CHAR/BINARY/numeric columns only, no COLUMN_FORMAT DYNAMIC, ROW_FORMAT=FIXED,
   so ForceVarPart is off and inserts take the alloc_fix_rec-only path? Is any var part
   still allocated, or varsize_reader still called, in that layout?
2. Is ldm={count=6},query={count=0},recover={count=6} supported with NoOfFragmentLogParts=4?
   And can AutomaticThreadConfig=0 plus ThreadConfig go in one [ndbd] section, so the change
   is staged one node at a time?
3. Is there a counter, DUMP code or log option, safe on a live data node, that shows
   Tup_varsize_page::reorg() calls or per-fragment var-page fragmentation?
[21 Nov 17:47] Bart B
Two more occurrences, on two more data nodes (now 4 of our 6):
  event 5: data node 5, 2026-11-16 01:53:36 UTC
  event 6: data node 6, 2026-11-21 09:53:45 UTC (nodes 5 and 6 form one node group)
That is 6 events in 82 days (08-31, 09-03, 10-17, 10-19, 11-16, 11-21). Both new events show:
  - the same failure, DbtupRoutines.cpp:666: require((srcBytes <= max_var_size)) failed
    (Error 6000, SIGABRT), in a query thread;
  - the same binary: 8.4.11, ndbmtd md5 unchanged on all six data nodes (re-checked 2026-11-21);
  - the same base-relative frames #4-#12 as event 3: 0x11f14c (require handler),
    varsize_reader 0x39d8d1, read_packed 0x3a24eb, readAttributes 0x39ce15,
    interpreterStartLab 0x377308, execTUPKEYREQ 0x37c2fd, nextScanConfScanLab 0x2a5a60,
    continue_next_scan_conf 0x2aae7b, Dbtux::continue_scan 0x3cca40;
  - the angel restarting the node, STARTED after 92 s.
Attached: ndb-varsize-assert-bundle-3.tgz (developers only). It holds every per-thread trace,
the error log and an out.log extract of both events, redacted as before plus one addition
(README section 4).

One schema change since bundle 2: a single online ALTER (between 2026-10-28 and 2026-11-16) added
six nullable COLUMN_FORMAT DYNAMIC columns at the end of t1: three varchar(4..32) and three
char(1..3). The table version went from 0x02000005 to 0x03000005. Events 1-4 predate it.
In our naming: s6 varchar(4), s7 varchar(32), s8 varchar(16), n6 char(1), n7 char(3) and
n8 char(1). All six are CHARACTER SET latin1, DEFAULT NULL, COLUMN_FORMAT DYNAMIC.

EVENT 5 (node 5, thr 8 = DBQLQH(1))
- The scan: SCAN_FRAGREQ tableId 142 (sys/def/35/idx_ts, ordered index on t1.ts), fragmentNo 8,
  flags dr(nodisk): READ COMMITTED, ascending range, no 'k' flag, #sec 2. API 178 (SQL node
  co-located with data node 5) via the local DBTC(1), transId H'002b3503/H'0350b200.
  The newest signal on thr 8 is ACC_CHECK_SCAN, the first resume of that scan. This is the
  same shape as event 3.
- Unlike events 1, 3 and 6, this SCAN_FRAGREQ has no 'q' flag (attrLen 0), although it ran in
  a query thread. Here the DBTC was on the same node. In these dumps, every READ COMMITTED
  SCAN_FRAGREQ received by DBLQH or DBQLQH carries 'q' (attrLen 64) when its DBTC or DBSPJ is
  on another node, and none from a local one does. Locking scans never carry it. So our
  earlier reading of attrLen 64 as "the query-thread flag" was imprecise.
- The statement was very likely our expiry job's snapshot, which runs every minute at
  second 35 on that SQL node:
    CREATE TEMPORARY TABLE <tmp> ENGINE=MEMORY AS SELECT k1, k2, ts,
      CAST(COALESCE(n4,0) AS UNSIGNED), s7, s6, n6, n7, n8, n1, s4, s5
      FROM t1 WHERE ts < ? ORDER BY ts LIMIT 10000
  At events 1-4 the same statement read only k1, k2, ts and n4, as our description says. The
  plain SELECT there left out only the CREATE TEMPORARY TABLE wrapper and the CAST. It gained
  s6, s7, n6-n8 and n1, s4, s5 after event 4. The var-size attributes in its read set are now
  k1, s4 and s5 (VAR) and s6 and s7 (DYNAMIC), so the attribute being read cannot be pinned
  down.
- Owning LDM (35/8: log part 174, thr 2 = DBLQH(1)). Newest signal: LQHKEYREQ Write on 35/8,
  a REPLACE from DBTC(1) on node 4 for API 176. From DbtupFixAlloc on, its JAM tail is
  identical to event 3's owning LDM:
    DbtupFixAlloc 00119 / DbtupVarAlloc 00532 00534 00421 00423 00138 00519 00521 00499 /
    DbtupExecQuery 01355 01363 / DblqhMain 07105
  Earlier in that JAM, the insert path in events 5 and 6 also passes DbtupRoutines 02038
  (two and three times). Events 1 and 3 do not; this is after the ALTER above.

EVENT 6 (node 6, thr 13 = DBQLQH(6))
- The scan: SCAN_FRAGREQ tableId 86 (sys/def/35/idx_k1_ts, ordered index on t1 (k1, ts)),
  fragmentNo 5, flags drq(nodisk): READ COMMITTED, ascending range. API 155 (SQL node
  co-located with data node 2) via DBTC(1) on node 2, transId H'001c621e/H'04609b00.
  It aborted inside the first batch, while still executing that SCAN_FRAGREQ
  (execSCAN_FRAGREQ 0x2a740e > storedProcConfScanLab 0x2a666e >
  send_next_NEXT_SCANREQ 0x2a4945 > Dbtux::continue_scan 0x3cca40).
- Not the expiry job, which reads idx_ts. It was most likely an ordinary per-k1 reader: an
  ascending read, not the ORDER BY ts DESC reader given as the example in our description.
- Owning LDM (35/5: log part 173, thr 7 = DBLQH(6)). Newest signal: LQHKEYREQ Write on 35/5,
  a REPLACE from DBTC(3) on node 3 for API 174. From DbtupFixAlloc on, its JAM tail is
  identical to event 1's owning LDM:
    DbtupFixAlloc 00119 / DbtupVarAlloc 00532 00534 00421 00421 00423 00138 /
    DbtupExecQuery 01355 01363 / DblqhMain 07105
  Watchdog: "thread 7 is stuck in: JobHandling in block: 247, gsn: 316".

In both events, 24 of the 26 per-thread trace files (thread 0 included) have STOP_FOR_CRASH as
the newest signal. The two exceptions are the crashed query thread and the owning LDM.

PATTERN ACROSS ALL SIX EVENTS
In all 6 events, the owning LDM thread had just run alloc_fix_rec + alloc_var_part (on an
existing var page) for an insert into exactly the fragment the query thread was reading. It
was then blocked waiting for fragment access: DblqhMain 7105, or 7209 at commit in events 2
and 4. From DbtupFixAlloc on, the owning-LDM JAM tails of events 1 and 6 are identical, and
so are those of events 3 and 5.

As before (caveat (b) in the description), a blocked owning LDM is also what any query-thread
abort would cause, and the ticks cannot order the two at the scale a race needs. But the
insert with a var-part allocation on the same fragment recurs in every event. The readers used
four different access paths:
  - PK reads (events 2 and 4);
  - a PRIMARY-index scan (event 3);
  - scans of two different secondary ordered indexes (events 1, 5 and 6).
The failing frame always reads a row's attributes; it is never index traversal. This remains
consistent with the mechanism in the original report: Tup_varsize_page::alloc_record() ->
reorg() moving other rows' var parts without exclusive fragment access while a query thread is
in readAttributes().

The fault has now hit both nodes of one node group, 5 days apart. If the two ever fail within
one ~90 s restart window, the whole cluster goes down. The 8.4.13 release notes (2026-10-22)
list nothing in this area. We are staying on 8.4.11 with no workaround applied for now.

Questions:
1. Is this known internally, and does 8.4.13 change anything in this path?
2. Would removing query threads (ThreadConfig without query threads) be a valid interim
   workaround for this path? Is there a narrower one?
3. Is there anything specific you need to verify this: a dump command to run at the next
   event, an ndbinfo query, or a test we could run on a non-production cluster?

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.097 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.