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
#2,981 1 comment 0 reactions 1 assignee View on GitHub

@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

code.zip

Specifications

  • Version: 1.33.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.