Skip to content

fix: allocate a new LOCAL INFILE terminator packet per write - #4580

Merged
sidorares merged 1 commit into
sidorares:masterfrom
jamalkamaladdin:fix/4568-infile-terminator-packet
Oct 6, 2026
Merged

sidorares merged 1 commit into
sidorares:masterfrom
jamalkamaladdin:fix/4568-infile-terminator-packet

Conversation

@jamalkamaladdin

Copy link
Copy Markdown
Contributor

Fixes #4568.

lib/commands/query.js: each LOCAL INFILE terminator write gets a new empty packet, in place of one module-level packet for all connections.
test/unit/commands/test-query-infile-terminator.test.mts: two connections with queued writes, each with its own terminator sequence id.
Cases: no stream factory, and a local stream that ends.

Query shared one module-level empty packet across every connection.
writePacket() writes the sequence id into that packet's header, and a
socket under backpressure queues the buffer by reference. A second
connection sending its own terminator before the first flushed
rewrote the queued header, so the server got the wrong sequence id
and failed with ER_NET_PACKETS_OUT_OF_ORDER.

Fixes sidorares#4568
@codecov

codecov Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.
βœ… Project coverage is 92.90%. Comparing base (e224afe) to head (246f4a2).

Files with missing lines Patch % Lines
lib/commands/query.js 80.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4580   +/-   ##
=======================================
  Coverage   92.90%   92.90%           
=======================================
  Files          95       95           
  Lines       16721    16722    +1     
  Branches     2498     2499    +1     
=======================================
+ Hits        15535    15536    +1     
  Misses       1186     1186           
Flag Coverage Ξ”
compression-0 92.86% <80.00%> (+<0.01%) ⬆️
compression-1 92.90% <80.00%> (+0.01%) ⬆️
static-parser-0 91.75% <80.00%> (+<0.01%) ⬆️
static-parser-1 91.87% <80.00%> (+<0.01%) ⬆️
tls-0 92.77% <80.00%> (+<0.01%) ⬆️
tls-1 92.90% <80.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

β˜” View full report in Codecov by Harness.
πŸ“’ Have feedback on the report? Share it here.

πŸš€ New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • πŸ“¦ JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sidorares
sidorares merged commit 8c068ef into sidorares:master Oct 6, 2026
104 checks passed
@sidorares

Copy link
Copy Markdown
Owner

thanks @jamalkamaladdin !

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.

LOAD DATA LOCAL INFILE: shared module-level EmptyPacket corrupts sequence ids under concurrency β†’ ER_NET_PACKETS_OUT_OF_ORDER

2 participants