Skip to content

fix: skip action rows with extra_data exceeding MySQL TEXT column limit#371

Open
netcrafts wants to merge 1 commit into
QuiltServerTools:masterfrom
netcrafts:fix/extra-data-overflow
Open

fix: skip action rows with extra_data exceeding MySQL TEXT column limit#371
netcrafts wants to merge 1 commit into
QuiltServerTools:masterfrom
netcrafts:fix/extra-data-overflow

Conversation

@netcrafts
Copy link
Copy Markdown

What does this change?

Prevents a permanent retry loop when logging actions whose serialized NBT exceeds the MySQL TEXT column limit (65,535 bytes) for extra_data.

When a batch insert fails due to an oversized row, the offending action is now skipped with a WARN log entry. The remaining rows in the batch are inserted normally.

Why?

The extra_data column is defined as TEXT in MySQL, which has a hard 65,535-byte limit. When a player picks up or interacts with a deeply nested item — such as a shulker box containing beehives with full bee entity NBT — the serialized NBT string can exceed this limit.

Before this fix, the batchInsert call in insertActions() would throw a BatchUpdateException: Data too long for column 'extra_data', and the execute() retry wrapper would retry the same unresolvable batch up to MAX_QUERY_RETRIES (10) times before giving up, halting all logging on the server.

This was reproduced live: a fully-packed shulker box of beehives produces ~42KB of extra_data in vanilla, growing beyond 65,535 bytes when bees carry heavier entity NBT (custom names, active potion effects, hives with long lore). The overflow and retry loop were confirmed on a live server.

How?

In insertActions() in DatabaseManager.kt, the incoming action list is partitioned before batchInsert:

  • Any action whose extraData string length exceeds MAX_EXTRA_DATA_BYTES (65,535) is dropped
  • A WARN is emitted for each dropped row with the action type, coordinates, world, and player name so operators can identify the trigger
  • The remaining safe rows proceed to batchInsert as normal

Truncating was ruled out as it would produce invalid NBT, breaking rollback and restore. Catching BatchUpdateException after the fact was ruled out because Exposed does not identify which row caused the failure and the transaction is already in a failed state.

Testing

Steps to reproduce the bug (unpatched):

  1. Create a shulker box containing 27 beehives (all slots filled)
  2. Each beehive must hold 3 bees (max occupancy) where every bee has:
    • A custom CustomName tag (named with an anvil)
    • At least one active potion effect
  3. Each beehive item must have long lore text / attribute modifiers on it
  4. Have a player pick up or break the shulker box
  5. Observe BatchUpdateException: Data too long for column 'extra_data' in the log followed by repeated Transaction attempt #N failed retries — logging halts entirely

Verified on patched build (live Fabric / Minecraft 1.26.1 server):

  • With the above setup, extra_data reached 76,996 chars (117% of the 65,535-byte TEXT limit)
  • Patched jar skipped the offending row with:
    WARN: Skipping action log: extra_data too large (76996 chars) for action block-break at [minecraft:overworld ...] by Netcrafts
  • All other actions in the same batch were inserted correctly
  • The logging queue resumed immediately with no further retries
  • Standard beehive and shulker box interactions well under the limit log normally with no behaviour change

When deeply-nested item NBT (e.g. a shulker box containing 27 beehives
each with 3 named/potioned bees and long lore) is serialised, the
resulting string can exceed 65,535 bytes — the MySQL TEXT column limit
for extra_data. This caused the entire batchInsert to fail and the
execute() retry wrapper to spin up to MAX_QUERY_RETRIES times on the
same unresolvable batch, halting all logging on the server.

Partition the action list before batchInsert: any row whose extraData
exceeds MAX_EXTRA_DATA_BYTES (65,535) is dropped and a WARN is emitted
with the action type, coordinates, world, and player name so operators
can identify the trigger. The remaining rows are inserted normally.
@netcrafts netcrafts requested a review from a team as a code owner May 23, 2026 10:59
@netcrafts
Copy link
Copy Markdown
Author

seems like this would resolve #285

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant