[K/N] Deprecate -Xworker-exception-handling ^KT-65170
Also deprecate legacy option with error (was a warning since 1.9.20-Beta)
This commit is contained in:
committed by
Space Team
parent
06095e86ca
commit
48f5e1d05c
+3
-1
@@ -119,7 +119,9 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration
|
|||||||
}
|
}
|
||||||
val workerExceptionHandling: WorkerExceptionHandling get() = configuration.get(KonanConfigKeys.WORKER_EXCEPTION_HANDLING)?.also {
|
val workerExceptionHandling: WorkerExceptionHandling get() = configuration.get(KonanConfigKeys.WORKER_EXCEPTION_HANDLING)?.also {
|
||||||
if (it != WorkerExceptionHandling.USE_HOOK) {
|
if (it != WorkerExceptionHandling.USE_HOOK) {
|
||||||
configuration.report(CompilerMessageSeverity.STRONG_WARNING, "Legacy exception handling in workers is deprecated")
|
configuration.report(CompilerMessageSeverity.ERROR, "Legacy exception handling in workers is deprecated")
|
||||||
|
} else {
|
||||||
|
configuration.report(CompilerMessageSeverity.STRONG_WARNING, "-Xworker-exception-handling is deprecated")
|
||||||
}
|
}
|
||||||
} ?: WorkerExceptionHandling.USE_HOOK
|
} ?: WorkerExceptionHandling.USE_HOOK
|
||||||
|
|
||||||
|
|||||||
@@ -383,23 +383,14 @@ tasks.register("worker10", KonanLocalTest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
standaloneTest("worker_exceptions") {
|
standaloneTest("worker_exceptions") {
|
||||||
flags = ["-tr", "-Xworker-exception-handling=use-hook"]
|
flags = ["-tr"]
|
||||||
outputChecker = {
|
outputChecker = {
|
||||||
!it.contains("testExecuteAfterStartQuiet error") && it.contains("testExecuteStart error") && !it.contains("testExecuteStartQuiet error")
|
!it.contains("testExecuteAfterStartQuiet error") && it.contains("testExecuteStart error") && !it.contains("testExecuteStartQuiet error")
|
||||||
}
|
}
|
||||||
source = "runtime/workers/worker_exceptions.kt"
|
source = "runtime/workers/worker_exceptions.kt"
|
||||||
}
|
}
|
||||||
|
|
||||||
standaloneTest("worker_exceptions_legacy") {
|
|
||||||
flags = ["-tr", "-Xworker-exception-handling=legacy"]
|
|
||||||
outputChecker = {
|
|
||||||
it.contains("testExecuteAfterStartLegacy error") && it.contains("testExecuteStartLegacy error")
|
|
||||||
}
|
|
||||||
source = "runtime/workers/worker_exceptions_legacy.kt"
|
|
||||||
}
|
|
||||||
|
|
||||||
standaloneTest("worker_exceptions_terminate") {
|
standaloneTest("worker_exceptions_terminate") {
|
||||||
flags = ["-Xworker-exception-handling=use-hook"]
|
|
||||||
expectedExitStatusChecker = { it != 0 }
|
expectedExitStatusChecker = { it != 0 }
|
||||||
outputChecker = {
|
outputChecker = {
|
||||||
it.contains("some error") && !it.contains("Will not happen")
|
it.contains("some error") && !it.contains("Will not happen")
|
||||||
@@ -407,32 +398,14 @@ standaloneTest("worker_exceptions_terminate") {
|
|||||||
source = "runtime/workers/worker_exceptions_terminate.kt"
|
source = "runtime/workers/worker_exceptions_terminate.kt"
|
||||||
}
|
}
|
||||||
|
|
||||||
standaloneTest("worker_exceptions_terminate_legacy") {
|
|
||||||
flags = ["-Xworker-exception-handling=legacy"]
|
|
||||||
outputChecker = {
|
|
||||||
it.contains("some error") && it.contains("Will not happen")
|
|
||||||
}
|
|
||||||
source = "runtime/workers/worker_exceptions_terminate.kt"
|
|
||||||
}
|
|
||||||
|
|
||||||
standaloneTest("worker_exceptions_terminate_hook") {
|
standaloneTest("worker_exceptions_terminate_hook") {
|
||||||
flags = ["-Xworker-exception-handling=use-hook"]
|
|
||||||
outputChecker = {
|
outputChecker = {
|
||||||
it.contains("hook called") && !it.contains("some error") && it.contains("Will happen")
|
it.contains("hook called") && !it.contains("some error") && it.contains("Will happen")
|
||||||
}
|
}
|
||||||
source = "runtime/workers/worker_exceptions_terminate_hook.kt"
|
source = "runtime/workers/worker_exceptions_terminate_hook.kt"
|
||||||
}
|
}
|
||||||
|
|
||||||
standaloneTest("worker_exceptions_terminate_hook_legacy") {
|
|
||||||
flags = ["-Xworker-exception-handling=legacy"]
|
|
||||||
outputChecker = {
|
|
||||||
!it.contains("hook called") && it.contains("some error") && it.contains("Will happen")
|
|
||||||
}
|
|
||||||
source = "runtime/workers/worker_exceptions_terminate_hook.kt"
|
|
||||||
}
|
|
||||||
|
|
||||||
standaloneTest("worker_exceptions_terminate_current") {
|
standaloneTest("worker_exceptions_terminate_current") {
|
||||||
flags = ["-Xworker-exception-handling=use-hook"]
|
|
||||||
expectedExitStatusChecker = { it != 0 }
|
expectedExitStatusChecker = { it != 0 }
|
||||||
outputChecker = {
|
outputChecker = {
|
||||||
it.contains("some error") && !it.contains("Will not happen")
|
it.contains("some error") && !it.contains("Will not happen")
|
||||||
@@ -440,30 +413,13 @@ standaloneTest("worker_exceptions_terminate_current") {
|
|||||||
source = "runtime/workers/worker_exceptions_terminate_current.kt"
|
source = "runtime/workers/worker_exceptions_terminate_current.kt"
|
||||||
}
|
}
|
||||||
|
|
||||||
standaloneTest("worker_exceptions_terminate_current_legacy") {
|
|
||||||
flags = ["-Xworker-exception-handling=legacy"]
|
|
||||||
outputChecker = {
|
|
||||||
it.contains("some error") && it.contains("Will not happen")
|
|
||||||
}
|
|
||||||
source = "runtime/workers/worker_exceptions_terminate_current.kt"
|
|
||||||
}
|
|
||||||
|
|
||||||
standaloneTest("worker_exceptions_terminate_hook_current") {
|
standaloneTest("worker_exceptions_terminate_hook_current") {
|
||||||
flags = ["-Xworker-exception-handling=use-hook"]
|
|
||||||
outputChecker = {
|
outputChecker = {
|
||||||
it.contains("hook called") && !it.contains("some error") && it.contains("Will happen")
|
it.contains("hook called") && !it.contains("some error") && it.contains("Will happen")
|
||||||
}
|
}
|
||||||
source = "runtime/workers/worker_exceptions_terminate_hook_current.kt"
|
source = "runtime/workers/worker_exceptions_terminate_hook_current.kt"
|
||||||
}
|
}
|
||||||
|
|
||||||
standaloneTest("worker_exceptions_terminate_hook_current_legacy") {
|
|
||||||
flags = ["-Xworker-exception-handling=legacy"]
|
|
||||||
outputChecker = {
|
|
||||||
!it.contains("hook called") && it.contains("some error") && it.contains("Will happen")
|
|
||||||
}
|
|
||||||
source = "runtime/workers/worker_exceptions_terminate_hook_current.kt"
|
|
||||||
}
|
|
||||||
|
|
||||||
standaloneTest("worker_threadlocal_no_leak") {
|
standaloneTest("worker_threadlocal_no_leak") {
|
||||||
source = "runtime/workers/worker_threadlocal_no_leak.kt"
|
source = "runtime/workers/worker_threadlocal_no_leak.kt"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
@file:OptIn(FreezingIsDeprecated::class, ObsoleteWorkersApi::class)
|
|
||||||
|
|
||||||
package runtime.workers.worker_exceptions_legacy
|
|
||||||
|
|
||||||
import kotlin.test.*
|
|
||||||
|
|
||||||
import kotlin.native.concurrent.*
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun testExecuteAfterStartLegacy() {
|
|
||||||
val worker = Worker.start()
|
|
||||||
worker.executeAfter(0L, {
|
|
||||||
throw Error("testExecuteAfterStartLegacy error")
|
|
||||||
}.freeze())
|
|
||||||
worker.requestTermination().result
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun testExecuteStartLegacy() {
|
|
||||||
val worker = Worker.start()
|
|
||||||
val future = worker.execute(TransferMode.SAFE, {}) {
|
|
||||||
throw Error("testExecuteStartLegacy error")
|
|
||||||
}
|
|
||||||
assertFailsWith<Throwable> {
|
|
||||||
future.result
|
|
||||||
}
|
|
||||||
worker.requestTermination().result
|
|
||||||
}
|
|
||||||
@@ -128,12 +128,9 @@ public value class Worker @PublishedApi internal constructor(public val id: Int)
|
|||||||
/**
|
/**
|
||||||
* Plan job for further execution in the worker.
|
* Plan job for further execution in the worker.
|
||||||
*
|
*
|
||||||
* With -Xworker-exception-handling=use-hook, if the worker was created with `errorReporting` set to true, any exception escaping from [operation] will
|
* If the worker was created with `errorReporting` set to true, any exception escaping from [operation] will
|
||||||
* be handled by [processUnhandledException].
|
* be handled by [processUnhandledException].
|
||||||
*
|
*
|
||||||
* Legacy MM: [operation] parameter must be either frozen, or execution to be planned on the current worker.
|
|
||||||
* Otherwise [IllegalStateException] will be thrown.
|
|
||||||
*
|
|
||||||
* @param afterMicroseconds defines after how many microseconds delay execution shall happen, 0 means immediately,
|
* @param afterMicroseconds defines after how many microseconds delay execution shall happen, 0 means immediately,
|
||||||
* @throws [IllegalArgumentException] on negative values of [afterMicroseconds].
|
* @throws [IllegalArgumentException] on negative values of [afterMicroseconds].
|
||||||
* @throws [IllegalStateException] if [operation] parameter is not frozen and worker is not current.
|
* @throws [IllegalStateException] if [operation] parameter is not frozen and worker is not current.
|
||||||
|
|||||||
Reference in New Issue
Block a user