fix(bigquery): replace unbounded Flux BUFFER with Flux.fromStream in Query.storeResult#605
Merged
fdelbrayelle merged 1 commit intomainfrom Apr 28, 2026
Merged
Conversation
…eam in storeResult Fixes #604: OOM on parallel Query tasks with fetchType=STORE.
Contributor
📦 Artifacts
🛡 TrivyVulnerability in:
|
| Vulnerability | Severity | Package | Installed Version | Fixed Version |
|---|---|---|---|---|
| GHSA-72hv-8253-57qq | MEDIUM | com.fasterxml.jackson.core:jackson-core | 2.20.1 | 2.21.1, 2.18.6 |
🧪 Java Unit Tests
| Tests | Passed ✅ | Skipped | Failed | Time ⏱ | |
|---|---|---|---|---|---|
| Java Tests Report | 117 ran | 107 ✅ | 10 | 0 ❌ | 7m 14s 803ms |
🔁 Unreleased Commits
3 commits since v2.2.0
| SHA | Title | Author | Date |
|---|---|---|---|
4fa4ff3 |
docs: add/update AGENTS.md with clear Why/What | François Delbrayelle | Apr 18, 26, 7:07:31 AM UTC |
044d7b4 |
docs: rewrite AGENTS.md Why section | François Delbrayelle | Apr 19, 26, 7:46:28 AM UTC |
8eebb99 |
docs: normalize README with Why and What | François Delbrayelle | Apr 19, 26, 8:06:11 AM UTC |
Malaydewangan09
approved these changes
Apr 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #604
Root cause
Query.storeResultusedFlux.create(..., FluxSink.OverflowStrategy.BUFFER)to driveFileSerde.writeAll:Flux.createis push-based: the producer (forEach) runs synchronously to completion before the subscriber drains, pumping every converted row into Reactor's internal unbounded queue.iterateAll()pages lazily from BigQuery, but that backpressure is invisible to Reactor here — every fetched row gets materialised as aLinkedHashMapand queued in JVM heap before any byte hits disk.Customer had two parallel tasks:
REPEATED STRING) → 75.5 MiB ION → ~4 KB/row in memoryWith N parallel executions, heap spiked to ~2.5 GiB (visible in Grafana) and triggered an OOM kill at ~01:00 CEST on 2026-04-27.
Fix
Replace
Flux.create(..., BUFFER)withFlux.fromStream, which is pull-based (synchronous-fuseable source). Reactor'swriteAllchain pulls one row at a time viadoOnNext, so only oneLinkedHashMapis live during each write cycle:This matches the pattern already used in
firestore/Query.java(Flux.fromIterable+FileSerde.writeAll).The
FluxSinkimport is removed as it is no longer referenced.Out of scope
fetchResult(used byFETCH/FETCH_ONE) also collects to aList— same memory class of issue, separate follow-up.