Skip to content

feat(plugin): make graphqlGenerateSDL worker JVM args configurable#2182

Merged
samuelAndalon merged 2 commits into
ExpediaGroup:masterfrom
Norman-Nam:configurable-sdl-worker-heap
Jun 26, 2026
Merged

feat(plugin): make graphqlGenerateSDL worker JVM args configurable#2182
samuelAndalon merged 2 commits into
ExpediaGroup:masterfrom
Norman-Nam:configurable-sdl-worker-heap

Conversation

@Norman-Nam

Copy link
Copy Markdown
Contributor

📝 Description

GraphQLGenerateSDLTask runs SDL generation in a process-isolated worker (workerExecutor.processIsolation), but the worker's forkOptions only set the executable — there is no way to configure its heap or any other JVM argument. The worker therefore runs with the Gradle default heap, and large schemas exhaust it and fail with java.lang.OutOfMemoryError: Java heap space with no supported workaround.

This PR adds an optional jvmArguments property to GraphQLGenerateSDLTask, applies it to the worker's forkOptions, and exposes it through the graphql { schema { } } DSL (and the --jvm-args CLI option).

graphql {
  schema {
    packages = listOf("com.example")
    jvmArguments = listOf("-Xmx2g")
  }
}

It defaults to an empty list, so existing builds are unaffected.

Closes #2181

🔗 Related Issues

Closes #2181

✅ Checklist

  • Added tests (GraphQLGenerateSDLTaskTest: default value + DSL → task propagation)
  • Updated documentation (gradle-plugin-tasks.mdx, gradle-plugin-usage-sdl.mdx)
  • ./gradlew :graphql-kotlin-gradle-plugin:check ktlintCheck detekt pass locally
  • Backward compatible (no behavior change when jvmArguments is unset)

🤖 Generated with Claude Code

GraphQLGenerateSDLTask runs SDL generation in a process-isolated worker
whose forkOptions only set the executable, so the worker uses the Gradle
default heap and cannot be tuned. Large schemas exhaust it and fail with
an OutOfMemoryError, with no supported way to raise the heap.

Add an optional jvmArguments property to the task, applied to the worker
forkOptions, and expose it via the `graphql { schema { } }` DSL. Defaults
to an empty list, so existing behavior is unchanged.

Closes #2181

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

val generateSchemaTask = project.tasks.named(GENERATE_SDL_TASK_NAME, GraphQLGenerateSDLTask::class.java).get()
generateSchemaTask.packages.set(supportedPackages)
generateSchemaTask.jvmArguments.set(extension.schemaExtension.jvmArguments)

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.

this will reset graphqlGenerateSDL.jvmArguments to [] whenever users configure:

graphql {
  schema {
    packages = listOf("com.example")
  }
}

even if they also configure the task directly:

tasks.named<GraphQLGenerateSDLTask>("graphqlGenerateSDL") {
  vmArguments.set(listOf("-Xmx4g"))
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you
I updated in this commit
14ab765

…r args

Wire the SDL worker jvmArguments from the schema extension via convention()
instead of set() so values configured directly on graphqlGenerateSDL are no
longer clobbered by the extension default. Log allJvmArgs so managed options
such as -Xmx (stored as maxHeapSize, absent from jvmArgs) are visible.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Norman-Nam Norman-Nam requested a review from samuelAndalon June 21, 2026 12:56
@Norman-Nam

Copy link
Copy Markdown
Contributor Author

May you take a look for this @Samjin 🙇

@samuelAndalon samuelAndalon merged commit 1b25813 into ExpediaGroup:master Jun 26, 2026
9 checks passed
samuelAndalon added a commit that referenced this pull request Jul 1, 2026
…2197)

### 📝 Description
cherry pick #2182

Co-authored-by: Norman <vu.hoang.nam@moneyforward.co.jp>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

GraphQLGenerateSDLTask worker JVM heap/args are not configurable — OOMs on large schemas

2 participants