Skip to content

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

Open
Norman-Nam wants to merge 2 commits into
ExpediaGroup:masterfrom
Norman-Nam:configurable-sdl-worker-heap
Open

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

Conversation

@Norman-Nam

Copy link
Copy Markdown

📝 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 ExpediaGroup#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
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
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