touchlab / Kermit

Kermit by Touchlab is a Kotlin Multiplatform centralized logging utility.
https://kermit.touchlab.co
Apache License 2.0
699 stars 40 forks source link

EXC_BAD_ACCESS (code=1, address=0x68000) when logging Ktor network response on iOS (Simulator only) #377

Closed timlittlelabs closed 11 months ago

timlittlelabs commented 11 months ago

I set up Ktor in such a way, that I do logging through Kermit. This setup is done as follows:

val kermitLogger: Logger = loggerWithTag("KTOR")

install(Logging) { logger = object : io.ktor.client.plugins.logging.Logger { override fun log(message: String) { kermitLogger.d(message) } } level = LogLevel.ALL }

Recently, iOS simulators have been crashing for me with an exception similar to: EXC_BAD_ACCESS (code=1, address=0x68000)

And it's ocurring in

#7 0x000000011454b1e4 in kfun:co.touchlab.kermit.OSLogWriter#callLog(co.touchlab.kermit.Severity;kotlin.String;kotlin.Throwable?){} at /Users/runner/work/Kermit/Kermit/kermit/src/darwinMain/kotlin/co/touchlab/kermit/OSLogWriter.kt:34

I'm suspecting this happens with large logs, is this a known issue? Is there a maximum amount of characters Kermit can log before the simulator runs out of memory?

I'm using Kermit version 1.2.2 for this

findjigar commented 11 months ago

@timlittlelabs We think this got fixed as part of https://github.com/touchlab/Kermit/issues/266, but to use that you would have to use 2.x version of Kermit. Is it possible for you to take up the latest Kermit version? It might have some breaking changes depending on your usage of Kermit.

If you cannot take 2.x version, then we can try to look at releasing a hotfix. Cannot guarantee that right now, though.

timlittlelabs commented 11 months ago

@findjigar First of all thanks for the reply and help! I've tried upgrading to Kermit 2.x, but am I correct in concluding it would also force me to upgrade to Kotlin 1.9.10? In that case it'll be hard for me to do, although I can try. Can you confirm/deny that the client consuming the Kermit lib also needs to be upgraded to Kotlin 1.9.10 in order to use it?

findjigar commented 11 months ago

Kermit 1.2.3 has been released, and this issue should be fixed now.