Skip to content

GH-3404: fix CI TestByteBitPacking512VectorLE.unpackValuesUsingVector randomly oom#3405

Merged
wgtmac merged 1 commit intoapache:masterfrom
HuaHuaY:fix_ci_oom
Feb 27, 2026
Merged

GH-3404: fix CI TestByteBitPacking512VectorLE.unpackValuesUsingVector randomly oom#3405
wgtmac merged 1 commit intoapache:masterfrom
HuaHuaY:fix_ci_oom

Conversation

@HuaHuaY
Copy link
Contributor

@HuaHuaY HuaHuaY commented Feb 27, 2026

Rationale for this change

Fix CI TestByteBitPacking512VectorLE.unpackValuesUsingVector randomly oom by lazily initializing data and reusing temporary arrays.

What changes are included in this PR?

Refactor TestByteBitPacking512VectorLE.unpackValuesUsingVector without modifying its logic.

Are these changes tested?

Yes.

Are there any user-facing changes?

No.

Closes #3404

Copilot AI review requested due to automatic review settings February 27, 2026 03:24
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to eliminate CI flakiness (random OutOfMemoryError) in TestByteBitPacking512VectorLE.unpackValuesUsingVector by reducing peak memory usage during the test.

Changes:

  • Refactors test input generation from eagerly-built List<int[]> to a lazily-produced Stream<int[]>.
  • Reuses a single int[] output buffer (instead of multiple output arrays) across the different unpacking paths.
  • Minor loop formatting cleanup in the vector unpack methods.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +46 to +49
int pack8Count = intInput.length / 8;
int byteOutputSize = pack8Count * bitWidth;
byte[] byteOutput = new byte[byteOutputSize];
int[] output = new int[intInput.length];
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test still allocates extremely large arrays for higher bit widths (e.g., when intInput.length ~= 268,435,520, you allocate intInput + output (~2 GB total) plus byteOutput up to ~1 GB). Even with lazy generation and reusing a single output array, a single iteration can require ~3 GB of contiguous heap and can still OOM under typical Surefire heaps.

Consider refactoring the test to avoid materializing the full input/output/packed buffers at once (e.g., generate/pack/unpack/verify in smaller fixed-size chunks, or lower itemMax for this test while keeping representative coverage).

Copilot uses AI. Check for mistakes.
@wgtmac
Copy link
Member

wgtmac commented Feb 27, 2026

cc @dossett

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +59 to 66
unpack8Values(bitWidth, byteOutput, output);
assertArrayEquals(intInput, output);
Arrays.fill(output, 0);

ByteBuffer byteBuffer = ByteBuffer.wrap(byteOutput);
unpackValuesUsingVectorByteBuffer(bitWidth, byteBuffer, output3);
unpackValuesUsingVectorArray(bitWidth, byteOutput, output);
assertArrayEquals(intInput, output);
Arrays.fill(output, 0);

Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arrays.fill(output, 0) after each assert is an O(n) operation over the entire output array and adds significant runtime (especially for large chunks). Since each unpack method writes all positions it is responsible for, clearing should be unnecessary if output is sized to intInput.length; if you still need clearing, limit it to the written range (e.g., 0..intInput.length).

Copilot uses AI. Check for mistakes.
@wgtmac wgtmac merged commit efe71c2 into apache:master Feb 27, 2026
5 checks passed
@HuaHuaY HuaHuaY deleted the fix_ci_oom branch February 27, 2026 09:40
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.

CI TestByteBitPacking512VectorLE randomly meets out of memory

3 participants