Skip to content

iOS only FileLogger crash #147

@philtz

Description

@philtz

Hi. We often get a crash due to file logging on iOS only: Uncaught Kotlin exception: kotlinx.io.IOException: Failed to open /var/mobile/Containers/Data/Application/108A558C-60A9-4612-899B-2271BFDE71FF/Documents/Logs/log.txt with Too many open files

It seems that logging too fast can cause this crash. Also we've noticed that sometimes some logs are missing from the file although they show in Console. Again, this is strictly iOS issue. All good on Android.
NOTE that this is not a new issue. It happened in the previous versions as well; we started integrating since 1.3+ and we now use 1.5.0

Below the crash stack trace:

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: SIGNAL 6 Abort trap: 6

Triggered by Thread:  5

Last Exception Backtrace:
0                         	0x103523b9c kfun:kotlinx.io.files.SystemFileSystem$1.sink#internal + 1100 (FileSystemNative.kt:88)
1                         	0x1037be76c kfun:kotlinx.io.files.FileSystem#sink(kotlinx.io.files.Path;kotlin.Boolean){}kotlinx.io.RawSink-trampoline + 136 (FileSystem.kt:130)
2                         	0x1037be76c kfun:saschpe.log4k.FileLogger#print(saschpe.log4k.Log.Level;kotlin.String;kotlin.String?;kotlin.Throwable?){} + 1580 (FileLogger.kt:40)
3                         	0x1038ecca8 kfun:saschpe.log4k.Logger#print(saschpe.log4k.Log.Level;kotlin.String;kotlin.String?;kotlin.Throwable?){}-trampoline + 40 (Logger.kt:22)
4                         	0x1038ecca8 kfun:saschpe.log4k.Logger#log(saschpe.log4k.Log.Level;kotlin.String;kotlin.String?;kotlin.Throwable?){} + 80 (Logger.kt:18)
5                         	0x1038ecca8 <inlined-lambda> + 1284 (STLog.kt:79)
6                         	0x1038ecca8 kfun:kotlin#let__at__0:0(kotlin.Function1<0:0,0:1>){0§<kotlin.Any?>;1§<kotlin.Any?>}0:1 + 1284 (Standard.kt:112)
7                         	0x1038ecca8 $$inlined$let$1.invoke#internal + 1568 (STLog.kt:69)
8                         	0x103301294 kfun:kotlin.Function2#invoke(1:0;1:1){}1:2-trampoline + 128 ([K][Suspend]Functions:1)
9                         	0x103301294 kfun:kotlin.coroutines.intrinsics#startCoroutineUninterceptedOrReturn__at__kotlin.coroutines.SuspendFunction1<0:0,0:1>(0:0;kotlin.coroutines.Continuation<0:1>){0§<kotlin.Any?>;1§<kotlin.Any?>}kotli... + 364 (IntrinsicsNative.kt:72)
10                        	0x103301294 <inlined-lambda> + 368 (IntrinsicsNative.kt:186)
11                        	0x103301294 kfun:kotlin.coroutines.intrinsics.createCoroutineUnintercepted$$inlined$createCoroutineFromSuspendFunction$2.invokeSuspend#internal + 532 (IntrinsicsNative.kt:254)
12                        	0x1032ff0ec kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#invokeSuspend(kotlin.Result<kotlin.Any?>){}kotlin.Any?-trampoline + 28 (ContinuationImpl.kt:50)
13                        	0x1032ff0ec <inlined-lambda> + 44 (ContinuationImpl.kt:30)
14                        	0x1032ff0ec kfun:kotlin#with(0:0;kotlin.Function1<0:0,0:1>){0§<kotlin.Any?>;1§<kotlin.Any?>}0:1 + 44 (Standard.kt:70)
15                        	0x1032ff0ec kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#resumeWith(kotlin.Result<kotlin.Any?>){} + 176 (ContinuationImpl.kt:26)
16                        	0x103435048 kfun:kotlin.coroutines.Continuation#resumeWith(kotlin.Result<1:0>){}-trampoline + 20 (Continuation.kt:26)
17                        	0x103435048 kfun:kotlin.coroutines#resume__at__kotlin.coroutines.Continuation<0:0>(0:0){0§<kotlin.Any?>} + 20 (Continuation.kt:45)
18                        	0x103435048 <inlined-lambda> + 1364 (DispatchedTask.kt:100)
19                        	0x103435048 kfun:kotlinx.coroutines#withContinuationContext(kotlin.coroutines.Continuation<*>;kotlin.Any?;kotlin.Function0<0:0>){0§<kotlin.Any?>}0:0 + 1364 (CoroutineContext.kt:44)
20                        	0x103435048 kfun:kotlinx.coroutines.DispatchedTask#run(){} + 1560 (DispatchedTask.kt:82)
21                        	0x103452374 kfun:kotlinx.coroutines.Runnable#run(){}-trampoline + 152 (Runnable.kt:12)
22                        	0x103452374 kfun:kotlinx.coroutines.MultiWorkerDispatcher.MultiWorkerDispatcher$workerRunLoop$1.$invokeCOROUTINE$0.invokeSuspend#internal + 1900 (MultithreadedDispatchers.kt:110)
23                        	0x1032ff0ec kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#invokeSuspend(kotlin.Result<kotlin.Any?>){}kotlin.Any?-trampoline + 28 (ContinuationImpl.kt:50)
24                        	0x1032ff0ec <inlined-lambda> + 44 (ContinuationImpl.kt:30)
25                        	0x1032ff0ec kfun:kotlin#with(0:0;kotlin.Function1<0:0,0:1>){0§<kotlin.Any?>;1§<kotlin.Any?>}0:1 + 44 (Standard.kt:70)
26                        	0x1032ff0ec kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#resumeWith(kotlin.Result<kotlin.Any?>){} + 176 (ContinuationImpl.kt:26)
27                        	0x103435048 kfun:kotlin.coroutines.Continuation#resumeWith(kotlin.Result<1:0>){}-trampoline + 20 (Continuation.kt:26)
28                        	0x103435048 kfun:kotlin.coroutines#resume__at__kotlin.coroutines.Continuation<0:0>(0:0){0§<kotlin.Any?>} + 20 (Continuation.kt:45)
29                        	0x103435048 <inlined-lambda> + 1364 (DispatchedTask.kt:100)
30                        	0x103435048 kfun:kotlinx.coroutines#withContinuationContext(kotlin.coroutines.Continuation<*>;kotlin.Any?;kotlin.Function0<0:0>){0§<kotlin.Any?>}0:0 + 1364 (CoroutineContext.kt:44)
31                        	0x103435048 kfun:kotlinx.coroutines.DispatchedTask#run(){} + 1560 (DispatchedTask.kt:82)
32                        	0x1033ea138 kfun:kotlinx.coroutines.Runnable#run(){}-trampoline + 156 (Runnable.kt:12)
33                        	0x1033ea138 <inlined-lambda> + 156 (EventLoop.common.kt:263)
34                        	0x1033ea138 <inlined-lambda> + 156 (Dispatchers.kt:104)
35                        	0x1033ea138 kfun:kotlinx.cinterop#autoreleasepool(kotlin.Function0<0:0>){0§<kotlin.Any?>}0:0 + 164 (ObjectiveCUtils.kt:13)
36                        	0x1033ea138 kfun:kotlinx.coroutines#platformAutoreleasePool(kotlin.Function0<kotlin.Unit>){} + 164 (Dispatchers.kt:104)
37                        	0x1033ea138 kfun:kotlinx.coroutines.EventLoopImplBase#processNextEvent(){}kotlin.Long + 1108 (EventLoop.common.kt:263)
38                        	0x10344a324 kfun:kotlinx.coroutines.EventLoop#processNextEvent(){}kotlin.Long-trampoline + 20 (EventLoop.common.kt:49)
39                        	0x10344a324 kfun:kotlinx.coroutines.BlockingCoroutine.joinBlocking#internal + 144 (Builders.kt:131)
40                        	0x10344a324 kfun:kotlinx.coroutines#runBlocking(kotlin.coroutines.CoroutineContext;kotlin.coroutines.SuspendFunction1<kotlinx.coroutines.CoroutineScope,0:0>){0§<kotlin.Any?>}0:0 + 1656 (Builders.kt:70)
41                        	0x1034517c8 kfun:kotlinx.coroutines#runBlocking$default(kotlin.coroutines.CoroutineContext?;kotlin.coroutines.SuspendFunction1<kotlinx.coroutines.CoroutineScope,0:0>;kotlin.Int){0§<kotlin.Any?>}0:0 + 16 (Builders.kt:47)
42                        	0x1034517c8 kfun:kotlinx.coroutines.MultiWorkerDispatcher.workerRunLoop#internal + 156 (MultithreadedDispatchers.kt:102)
43                        	0x1034517c8 kfun:kotlinx.coroutines.MultiWorkerDispatcher.MultiWorkerDispatcher$1.MultiWorkerDispatcher$1$invoke$$inlined$apply$1.invoke#internal + 164 (MultithreadedDispatchers.kt:86)
44                        	0x1034517c8 kfun:kotlinx.coroutines.MultiWorkerDispatcher.MultiWorkerDispatcher$1.MultiWorkerDispatcher$1$invoke$$inlined$apply$1.$<bridge-DN>invoke(){}#internal + 212 (MultithreadedDispatchers.kt:86)
45                        	0x1042635f4 Worker::processQueueElement(bool) + 1860
46                        	0x104262df8 (anonymous namespace)::workerRoutine(void*) + 128
47  libsystem_pthread.dylib       	0x1f343644c _pthread_start + 136 (pthread.c:931)
48  libsystem_pthread.dylib       	0x1f34328cc thread_start + 8

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions