Commit e75ab50
fix: cap maxOwnStructures at 32 to avoid two-byte record corruption
RecordEncoder set maxOwnStructures=256 (the OOM cap). With msgpackr's default
maxSharedStructures of 32, that pushes maxOwn+maxShared past 64, flipping on
msgpackr's two-byte record-id encoding. That path mis-serializes over-cap "own"
structures when a shared-structures store is present (every primary store has
one): it writes an out-of-range record-id reference instead of inlining the
structure, so once a table exceeds the shared cap, new records become
undecodable ("Record id is not defined for N") — on BOTH the typed default and
the randomAccessFields=false opt-out. Confirmed via a high-cardinality repro
(2900+/3000 records undecodable at maxOwn=256; 0 at maxOwn<=32).
Lowering to 32 keeps msgpackr on the one-byte path, which inlines over-cap
shapes correctly and bounds memory at least as tightly. Adds a regression test
that writes 500 distinct shapes through a shared store and asserts every record
decodes, on both the typed and readOnlyStructures paths. The deeper msgpackr
two-byte fix (to make >32 shared structures correct) is tracked separately.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent cd7962a commit e75ab50
2 files changed
Lines changed: 54 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
95 | 103 | | |
96 | 104 | | |
97 | 105 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
0 commit comments