rsocket / rsocket-kotlin

RSocket Kotlin multi-platform implementation
http://rsocket.io
Apache License 2.0
552 stars 37 forks source link

Incomplete async stack traces #206

Open mihai1voicescu opened 2 years ago

mihai1voicescu commented 2 years ago

Motivation

Some errors have their stack traces incomplete, making them impossible to debug. Example:

 02-01 17:42:09.667  E  [6652/6652] AndroidRuntime FATAL EXCEPTION: main
 02-01 17:42:09.667  E  [6652/6652] AndroidRuntime Process: io.almer.remoteassistence, PID: 6652
 02-01 17:42:09.667  E  [6652/6652] AndroidRuntime io.rsocket.kotlin.RSocketError$ApplicationError: Request cancelled
 02-01 17:42:09.667  E  [6652/6652] AndroidRuntime  at io.rsocket.kotlin.RSocketErrorKt.RSocketError(RSocketError.kt:68)
 02-01 17:42:09.667  E  [6652/6652] AndroidRuntime  at io.rsocket.kotlin.frame.ErrorFrameKt.readError(ErrorFrame.kt:47)
 02-01 17:42:09.667  E  [6652/6652] AndroidRuntime  at io.rsocket.kotlin.frame.FrameKt.readFrame(Frame.kt:71)
 02-01 17:42:09.667  E  [6652/6652] AndroidRuntime  at io.rsocket.kotlin.internal.ConnectKt$connect$7.invokeSuspend(Connect.kt:90)
 02-01 17:42:09.667  E  [6652/6652] AndroidRuntime  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
 02-01 17:42:09.667  E  [6652/6652] AndroidRuntime  at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
 02-01 17:42:09.667  E  [6652/6652] AndroidRuntime  at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
 02-01 17:42:09.667  E  [6652/6652] AndroidRuntime  at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
 02-01 17:42:09.667  E  [6652/6652] AndroidRuntime  at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
 02-01 17:42:09.667  E  [6652/6652] AndroidRuntime  at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

This looks like an internal error and I have nothing to debug it with or no additional info...

Even wrapping all the requests in try catch does not help in catching this...

Desired solution

Having the actual call site would be great. Also being able to catch the errors seems necessary.

olme04 commented 2 years ago

Hey, if I understand correctly you stacktrace, there is an error with type io.rsocket.kotlin.RSocketError$ApplicationError thrown, and you catch it, right? Such an error says that on responder side (f.e. server) something failed and responder has sent Error frame. On current moment, there is only message of Throwable is transmitted via network.

Do you have access to responder side of code? Does it have full stacktrace there? Or may be you can tell me, in which situation (code reproducer) this happens?