Skip to content

compose: Raise Paparazzi test worker heap to avoid OutOfMemoryError#6558

Merged
andremion merged 1 commit into
developfrom
fix/compose-paparazzi-test-heap
Jul 8, 2026
Merged

compose: Raise Paparazzi test worker heap to avoid OutOfMemoryError#6558
andremion merged 1 commit into
developfrom
fix/compose-paparazzi-test-heap

Conversation

@andremion

@andremion andremion commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Goal

./gradlew :stream-chat-android-compose:recordPaparazziDebug fails with java.lang.OutOfMemoryError: Java heap space. The same can happen on verifyPaparazziDebug.

Paparazzi tests do not run in the Gradle daemon. They run in a forked unit test worker JVM, and that worker's heap is sized separately from the daemon. The compose module never sets a heap for the Test task, so the worker falls back to a 512 MB max heap. Passing -Dorg.gradle.jvmargs=-Xmx... on the command line does not help, because that only sizes the daemon, not the worker.

The compose snapshot suite has grown (more tests and larger renders). recordPaparazziDebug renders and compresses every snapshot in that worker, and the peak usage now exceeds 512 MB, so it runs out of memory during PNG compression.

Resolves AND-1299

Implementation

Set maxHeapSize = "4g" on the compose module Test tasks:

tasks.withType<Test>().configureEach {
    maxHeapSize = "4g"
}

This is scoped to the compose module only, since it is the only module using the Paparazzi plugin and no other module has shown this issue.

Testing

  1. On develop, run ./gradlew :stream-chat-android-compose:recordPaparazziDebug. It fails with OutOfMemoryError in ApngWriter.compress.
  2. On this branch, run the same command. It completes without the memory error.

To confirm the worker heap without a full record run, you can check the effective value:

  • Before the change, the forked testDebugUnitTest worker reports a 512 MB max heap.
  • After the change, it reports 4096 MB.

The forked unit test worker that runs Paparazzi defaults to a 512 MB heap.
recordPaparazziDebug renders and compresses every snapshot in that worker,
which now exceeds 512 MB and fails with OutOfMemoryError. Set maxHeapSize to
4g on the compose module Test tasks so record and verify runs complete.
@andremion andremion requested a review from a team as a code owner July 8, 2026 14:18
@andremion andremion added the pr:internal Internal changes / housekeeping label Jul 8, 2026
@andremion

Copy link
Copy Markdown
Contributor Author

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

PR checklist ✅

All required conditions are satisfied:

  • Title length is OK (or ignored by label).
  • At least one pr: label exists.
  • Sections ### Goal, ### Implementation, and ### Testing are filled, or the PR is bot-authored.
  • An issue is linked (Linear ticket or GitHub issue), or the PR is bot-authored.

🎉 Great job! This PR is ready for review.

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The Gradle build script for stream-chat-android-compose is updated to configure all Test tasks with a maxHeapSize of "4g", accompanied by comments explaining the change relates to Paparazzi snapshot rendering memory requirements.

Changes

Gradle Test Heap Configuration

Layer / File(s) Summary
Configure maxHeapSize for Test tasks
stream-chat-android-compose/build.gradle.kts
Adds a tasks.withType<Test>().configureEach block setting maxHeapSize to "4g" with explanatory comments about Paparazzi snapshot rendering memory usage.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Poem

A rabbit hops with heap so wide,
Four gigs of memory, snapshots survive,
No more crashes mid-Paparazzi test,
Just green checkmarks, memory at its best! 🐇💾

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly states the main compose-module change and its purpose to prevent Paparazzi OOMs.
Description check ✅ Passed The description includes Goal, Implementation, and Testing with concrete details; only non-critical template sections are missing.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/compose-paparazzi-test-heap

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@andremion andremion enabled auto-merge (squash) July 8, 2026 14:20
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 5.93 MB 5.93 MB 0.00 MB 🟢
stream-chat-android-ui-components 11.20 MB 11.20 MB 0.00 MB 🟢
stream-chat-android-compose 12.67 MB 12.67 MB 0.00 MB 🟢

@sonarqubecloud

sonarqubecloud Bot commented Jul 8, 2026

Copy link
Copy Markdown

@andremion andremion merged commit b2b7e21 into develop Jul 8, 2026
19 of 22 checks passed
@andremion andremion deleted the fix/compose-paparazzi-test-heap branch July 8, 2026 14:54
@stream-public-bot stream-public-bot added the released Included in a release label Jul 13, 2026
@stream-public-bot

Copy link
Copy Markdown
Contributor

🚀 Available in v7.6.0

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

Labels

pr:internal Internal changes / housekeeping released Included in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants