temporalio / temporalio/sdk-java
`Async.function`/`Async.procedure` with a Kotlin method reference spawns a WorkflowThread per call instead of inlining, as it does the Java equivalent
Open
@dplyukhin is already working on this.
Since Aug 11, 2026.
- Dominant language
- Java
- Stars
- 433
- Forks
- 249
- Avg merge
- 5d 6h
- Merged PRs (30d)
- 26
Description
Expected Behavior
A Kotlin method reference to a stub is inlined like the Java equivalent, and shouldn't consume a workflow thread per call.
Actual Behavior
When a workflow uses Async.function / Async.procedure with a Kotlin method reference to an
activity (or child workflow) stub, the SDK does not run the call inline. It spawns one
WorkflowThread per call. A wide fan-out therefore holds one workflow-pool thread per in-flight
activity
The equivalent Java code is inlined and uses a single workflow thread.
Steps to Reproduce the Problem
see the attached code
Specifications
- Version: 1.33.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.