Skip to content

PollerBehaviorAutoscaling uses ForkJoinPool.commonPool(), breaking Spring Boot LaunchedClassLoader context #2795

@gauravthadani

Description

@gauravthadani

Expected Behavior

With SpringBoot, Kotlin, PollerBehaviorAutoscaling, worker threads should inherit the context class loader of the thread that started the WorkerFactory.

Actual Behavior

When PollerBehaviorAutoscaling is enabled, worker threads are assigned jdk.internal.loader.ClassLoaders$AppClassLoader as their context class loader instead of Spring Boot's LaunchedClassLoader.

so even though io.temporal:temporal-kotlin was already on the classpath. The error was thrown when calling Async.procedure with Kotlin method references inside a workflow.

error being

java.lang.IllegalStateException: Kotlin method reference is used with async. 
For Temporal to correctly support async invocation kotlin method references, 
add io.temporal:temporal-kotlin to classpath

Steps to Reproduce the Problem

  1. user has kindly provided a repro here https://drive.google.com/file/d/1_-mEnJerLUWPDK97vQScENeqIfmVrHnr/view?usp=sharing

Specifications

  • Version:
  • Platform:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions