Skip to content

Increase heap size#1890

Closed
Thevakumar-Luheerathan wants to merge 1 commit into
ballerina-platform:masterfrom
Thevakumar-Luheerathan:fix-build-failure
Closed

Increase heap size#1890
Thevakumar-Luheerathan wants to merge 1 commit into
ballerina-platform:masterfrom
Thevakumar-Luheerathan:fix-build-failure

Conversation

@Thevakumar-Luheerathan

@Thevakumar-Luheerathan Thevakumar-Luheerathan commented Jun 16, 2026

Copy link
Copy Markdown
Member

Purpose

Describe the problems, issues, or needs driving this feature/fix and include links to related issues in the following format: Resolves issue1, issue2, etc.

Goals

Describe the solutions that this feature/fix will introduce to resolve the problems described above

Approach

Describe how you are implementing the solutions. Include an animated GIF or screenshot if the change affects the UI (email documentation@wso2.com to review all UI text). Include a link to a Markdown file or Google doc if the feature write-up is too long to paste here.

User stories

Summary of user stories addressed by this change>

Release note

Brief description of the new feature or bug fix as it will appear in the release notes

Documentation

Link(s) to product documentation that addresses the changes of this PR. If no doc impact, enter “N/A” plus brief explanation of why there’s no doc impact

Training

Link to the PR for changes to the training content in https://github.com/wso2/WSO2-Training, if applicable

Certification

Type “Sent” when you have provided new/updated certification questions, plus four answers for each question (correct answer highlighted in bold), based on this change. Certification questions/answers should be sent to certification@wso2.com and NOT pasted in this PR. If there is no impact on certification exams, type “N/A” and explain why.

Marketing

Link to drafts of marketing content that will describe and promote this feature, including product page changes, technical articles, blog posts, videos, etc., if applicable

Automation tests

  • Unit tests

    Code coverage information

  • Integration tests

    Details about the test cases and coverage

Security checks

Samples

Provide high-level details about the samples related to this feature

Related PRs

List any other related PRs

Migrations (if applicable)

Describe migration steps and platforms on which migration has been tested

Test environment

List all JDK versions, operating systems, databases, and browser/versions on which this feature/fix was tested

Learning

Describe the research phase and any blog posts, patterns, libraries, or add-ons you used to solve the problem.

Summary

This pull request increases the JVM heap memory allocation for the test task in the OpenAPI CLI Gradle build configuration. The change sets the maximum heap size to 6GB to improve test suite stability and prevent intermittent build failures that occur during large-scale test execution when the default heap size is insufficient for compilation and caching operations.

Changes

  • openapi-cli/build.gradle: Updated the test task configuration to explicitly allocate 6GB of maximum heap size

This change aims to ensure more reliable test execution and prevent build failures related to memory constraints during the testing phase.

Copilot AI review requested due to automatic review settings June 16, 2026 10:18
@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The test Gradle task in openapi-cli/build.gradle is updated to set maxHeapSize = '6g', increasing the JVM heap limit for the full TestNG suite execution within a single JVM process.

Changes

Gradle Test Heap Configuration

Layer / File(s) Summary
Set maxHeapSize in test task
openapi-cli/build.gradle
Adds a comment and sets maxHeapSize = '6g' inside the existing test task block.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐇 A heap so small, the tests would cry,
Six gigabytes now reach the sky!
No more OOM, no more despair,
The TestNG suite runs without a care.
Hop hop hooray, the build is free! 🌿

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is entirely a template with no actual content filled in; all sections contain only placeholder text with no information about the heap size change, rationale, or testing. Fill in the PR description template with relevant details such as purpose (why heap size needed to increase), goals, approach, affected tests, and test environment specifications.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: increasing the JVM heap size in the Gradle test configuration.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@sonarqubecloud

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates the openapi-cli module’s Gradle test configuration to allocate more heap to the TestNG test JVM, aiming to reduce intermittent failures during the full test suite run.

Changes:

  • Increased the Gradle test task JVM heap limit for openapi-cli tests to 6g.
  • Added inline rationale explaining why the larger heap is needed for the full TestNG suite execution.

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

Comment thread openapi-cli/build.gradle
Comment on lines +107 to +111
// The full suite runs all ~890 tests in a single JVM (TestNG suite XML; forkEvery has no
// effect in suite mode). Each test does a full Ballerina compile that caches large stdlib
// modules in-JVM. The default ~4g heap is too tight, so G1 occasionally evicts the
// soft-referenced compiler cache mid-suite, intermittently breaking service type resolution
// ("Yaml was not generated"). Give it headroom.
Comment thread openapi-cli/build.gradle
dependsOn {
copyStdlibs
}
// The full suite runs all ~890 tests in a single JVM (TestNG suite XML; forkEvery has no

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
openapi-cli/build.gradle (1)

112-112: The 6g heap size is already documented with clear engineering reasoning.

The code includes detailed comments explaining that the full ~890 test suite runs in a single JVM, where each test performs a full Ballerina compile that caches stdlib modules. The default ~4g heap proved insufficient because the G1 garbage collector would evict the soft-referenced compiler cache mid-suite, intermittently breaking service type resolution ("Yaml was not generated"). Increasing to 6g provides the necessary headroom to resolve this issue.

While this justification is well-documented inline, no empirical data (memory profiling or test-run results demonstrating the 4g→6g improvement) or evidence of testing intermediate values (4.5g, 5.5g) was found in the repository. If you'd like to strengthen confidence in this choice further, consider documenting the peak heap usage observed during test runs or any performance comparisons in the PR description or a README section on build configuration.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@openapi-cli/build.gradle` at line 112, The maxHeapSize setting of 6g in the
build.gradle file is already well-documented with clear engineering rationale in
the inline comments. To strengthen confidence in this heap size choice and
provide empirical support for the decision, document in the PR description or a
README section on build configuration the peak heap usage observed during test
runs and include performance data or comparisons demonstrating why 4g was
insufficient and why the chosen 6g value (rather than intermediate values like
4.5g or 5.5g) was the appropriate threshold.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@openapi-cli/build.gradle`:
- Line 112: The maxHeapSize setting of 6g in the build.gradle file is already
well-documented with clear engineering rationale in the inline comments. To
strengthen confidence in this heap size choice and provide empirical support for
the decision, document in the PR description or a README section on build
configuration the peak heap usage observed during test runs and include
performance data or comparisons demonstrating why 4g was insufficient and why
the chosen 6g value (rather than intermediate values like 4.5g or 5.5g) was the
appropriate threshold.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: dfc36d9a-0b07-4784-9a13-50bca95fe18a

📥 Commits

Reviewing files that changed from the base of the PR and between dc1b20a and 2982356.

📒 Files selected for processing (1)
  • openapi-cli/build.gradle

@TharmiganK

Copy link
Copy Markdown
Contributor

Closing this since the intermittent issue has been fixed via: #1892

@TharmiganK TharmiganK closed this Jun 17, 2026
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.

3 participants