https://kotlinlang.org logo
Title
d

Didier Villevalois

08/14/2022, 2:06 PM
Hi all! I'm sorry if this questions have already been asked, but I might not use the right search terms... I don't know what I am configuring wrongly but I am failing to have to get filenames and line numbers in my Kotlin/Native stacktraces. (I give an example stacktrace in the thread.) Also, when executing tests with Kotest (might be an issue with Kotest though). You can also see this in CI builds (e.g. https://github.com/ptitjes/kzmq/runs/7826776961?check_suite_focus=true#step:6:418) where filenames are
null
and line numbers are `-1`:
DealerRouterTests.base (cio, cio) FAILED
    kotlinx.coroutines.TimeoutCancellationException at null:-1
The said stacktrace is produced while running native tests of Kzmq. Note that this project consists of multiple sub-projects (
:kzmq-core
,
:kzmq-cio
, ...) and the tests are located in their own sub-project (
:kzmq-tests
).
Example stacktrace:
kotlinx.coroutines.TimeoutCancellationException: Timed out waiting for 10000 ms
kotlinx.coroutines.TimeoutCancellationException: Timed out waiting for 10000 ms
	at kotlin.Throwable#<init>(Unknown Source)
	at kotlin.Exception#<init>(Unknown Source)
	at kotlin.RuntimeException#<init>(Unknown Source)
	at kotlin.IllegalStateException#<init>(Unknown Source)
	at kotlin.coroutines.cancellation.CancellationException#<init>(Unknown Source)
	at kotlinx.coroutines.TimeoutCancellationException#<init>(Unknown Source)
	at kotlinx.coroutines#TimeoutCancellationException(Unknown Source)
	at kotlinx.coroutines.TimeoutCoroutine.run#internal(Unknown Source)
	at kotlinx.coroutines.WorkerDispatcher.DisposableBlock.invoke#internal(Unknown Source)
	at kotlinx.coroutines.WorkerDispatcher.DisposableBlock.$<bridge-UNN>invoke(Unknown Source)
	at <global>.WorkerLaunchpad(Unknown Source)
	at <global>._ZN6Worker19processQueueElementEb(Unknown Source)
	at <global>._ZN12_GLOBAL__N_113workerRoutineEPv(Unknown Source)
	at <global>.0x0(Unknown Source)
	at <global>.0x0(Unknown Source)

DealerRouterTests.base (cio, cio) FAILED
    kotlinx.coroutines.TimeoutCancellationException at null:-1
s

sergey.bogolepov

08/16/2022, 2:58 PM
Did you try to enable libbacktrace?
d

Didier Villevalois

08/16/2022, 3:30 PM
Indeed, I did not... I will try that tonight and report back. Thanks @sergey.bogolepov.
Yep, got filenames and line numbers right after enabling libbacktrace! Both for external libraries (e.g. kotlinx-coroutines) and mine. Thanks a lot @sergey.bogolepov. For memory:
kotlin.native.binary.sourceInfoType=libbacktrace
s

Seb Jachec

08/17/2022, 9:50 AM
Out of interest, is there a reason why libbacktrace is experimental? Is it due to reliability, or are there performance concerns?
s

sergey.bogolepov

08/17/2022, 10:09 AM
Mostly because it is fairly new feature and we are introducing new features pretty cautiously. We are not aware of any significant problems besides absence of MinGW support.
s

Seb Jachec

08/17/2022, 10:37 AM
Makes sense, thanks!