Skip to content

[Bug] Online playground is not working when use Executors.newSingleThreadExecutor().asCoroutineDispatcher() as CorotuineDisaptcher #158

@kkkkan

Description

@kkkkan

When Executors.newSingleThreadExecutor().asCoroutineDispatcher() is used as CorotuineDisaptcher in Kolin online playground , hardly success . ( But very occasionally successful.)
I encounted Evaluation stopped while it's taking too long️ error message.

image

code run

Code is following

import kotlinx.coroutines.*
import java.util.concurrent.Executors

fun main(){
    val dispatcher = Executors.newSingleThreadExecutor().asCoroutineDispatcher()
    val scope = CoroutineScope(Job()+dispatcher)
    scope.launch {
        println("1")
    }

    println("2")
}

I tried

  • Kotlin version v1.4.30 / v1.5.31 / v1.6.21
  • with all for JVM

but get same result.

As a side note

When I Executors.newSingleThreadExecutor().asCoroutineDispatcher() replace with newSingleThreadContext(name: String) and run , always get success and following result message : 1 2.

Execution Environment :

  • PC :
    Edition Windows 10 Home
    Version 21H2
    Install on ‎2022/‎01/‎04
    OS build 19044.1645
    Experience Windows Feature Experience Pack 120.2212.4170.0

  • Browser :
    Google Chrome version : 100.0.4896.127(Official Build) (64 bit)

(・ Country : Japan)

Thank you.

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