streetcomplete / StreetComplete

Easy to use OpenStreetMap editor for Android
https://streetcomplete.app
GNU General Public License v3.0
3.9k stars 356 forks source link

Shared log can be too large #5561

Open Helium314 opened 7 months ago

Helium314 commented 7 months ago

How to Reproduce Manage to accumulate a large amount of log messages (e.g. by being very active), then go to logger, select an early start date and click share. This may result in android.os.TransactionTooLargeException.

Expected Behavior Working log share. Maybe truncate the log if necessary, or write to a file instead.

Versions affected Probably all since addition of the logger.

westnordost commented 7 months ago

Truncate to only the newest or only the oldest? What magnitude of numbers are we talking?

Helium314 commented 7 months ago

I would say truncate to the newest, and maybe show a toast to clarify. Or check the size beforehand, and ask the user to use filters to reduce the size.

What magnitude of numbers are we talking?

I got a crash report where the log couldn't be shared because the size was 3.6 MB.

westnordost commented 7 months ago

According to a quick research, if the data passed in an Intent is below 500 kB it should be safe.

Assuming an average log size of 100 bytes, we have around 50,000 lines.

According to the documentation, it is also possible to not send the text directly but put it in some file and have the link to it in there. This would remove that restriction. Something with EXTRA_STREAM...

westnordost commented 7 months ago

Just adding @neonowy to the conversation

mnalis commented 2 months ago

I've tried to share a log with some 9k lines/entries from the StreetComplete, and it crashed:


Thread: mainApp version: 59.0-alpha4
Device: samsung  dm2q, Android 14
Locale: en_US

Stack trace:
java.lang.RuntimeException: Failure from system
    at android.app.Instrumentation.execStartActivity(Instrumentation.java:1880)
    at android.app.Activity.startActivityForResult(Activity.java:5760)
    at androidx.activity.ComponentActivity.startActivityForResult(SourceFile:0)
    at android.app.Activity.startActivityForResult(Activity.java:5718)
    at androidx.activity.ComponentActivity.startActivityForResult(SourceFile:0)
    at android.app.Activity.startActivity(Activity.java:6216)
    at android.app.Activity.startActivity(Activity.java:6183)
    at de.westnordost.streetcomplete.screens.about.logs.LogsScreenKt.shareLog(Unknown Source:59)
    at de.westnordost.streetcomplete.screens.about.logs.LogsScreenKt.access$shareLog(Unknown Source:0)
    at de.westnordost.streetcomplete.screens.about.logs.LogsScreenKt$LogsScreen$2$3.invoke$lambda$2(Unknown Source:26)
    at de.westnordost.streetcomplete.screens.about.logs.LogsScreenKt$LogsScreen$2$3.$r8$lambda$EZ8FyTCtK7xjZ8_3JxN_uNv0iz8(SourceFile:0)
    at de.westnordost.streetcomplete.screens.about.logs.LogsScreenKt$LogsScreen$2$3$$ExternalSyntheticLambda1.invoke(SourceFile:0)
    at androidx.compose.foundation.ClickablePointerInputNode$pointerInput$3.invoke-k-4lQ0M(Unknown Source:14)
    at androidx.compose.foundation.ClickablePointerInputNode$pointerInput$3.invoke(Unknown Source:6)
    at androidx.compose.foundation.gestures.TapGestureDetectorKt$detectTapAndPress$2$1.invokeSuspend(Unknown Source:186)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Unknown Source:11)
    at kotlinx.coroutines.DispatchedTaskKt.resume(Unknown Source:91)
    at kotlinx.coroutines.DispatchedTaskKt.dispatch(Unknown Source:51)
    at kotlinx.coroutines.CancellableContinuationImpl.dispatchResume(Unknown Source:7)
    at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl(Unknown Source:37)
    at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl$default(Unknown Source:7)
    at kotlinx.coroutines.CancellableContinuationImpl.resumeWith(Unknown Source:10)
    at androidx.compose.ui.input.pointer.SuspendingPointerInputModifierNodeImpl$PointerEventHandlerCoroutine.offerPointerEvent(Unknown Source:15)
    at androidx.compose.ui.input.pointer.SuspendingPointerInputModifierNodeImpl.dispatchPointerEvent(Unknown Source:50)
    at androidx.compose.ui.input.pointer.SuspendingPointerInputModifierNodeImpl.onPointerEvent-H0pRuoY(Unknown Source:33)
    at androidx.compose.foundation.AbstractClickablePointerInputNode.onPointerEvent-H0pRuoY(Unknown Source:2)
    at androidx.compose.foundation.AbstractClickableNode.onPointerEvent-H0pRuoY(Unknown Source:4)
    at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(Unknown Source:190)
    at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(Unknown Source:159)
    at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(Unknown Source:159)
    at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(Unknown Source:159)
    at androidx.compose.ui.input.pointer.NodeParent.dispatchMainEventPass(Unknown Source:19)
    at androidx.compose.ui.input.pointer.HitPathTracker.dispatchChanges(Unknown Source:24)
    at androidx.compose.ui.input.pointer.PointerInputEventProcessor.process-BIzXfog(Unknown Source:164)
    at androidx.compose.ui.platform.AndroidComposeView.sendMotionEvent-8iAsVTc(Unknown Source:78)
    at androidx.compose.ui.platform.AndroidComposeView.handleMotionEvent-8iAsVTc(Unknown Source:137)
    at androidx.compose.ui.platform.AndroidComposeView.dispatchTouchEvent(Unknown Source:63)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3328)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2998)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3328)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2998)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3328)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2998)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3328)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2998)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3328)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2998)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3328)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2998)
    at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:776)
    at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1967)
    at android.app.Activity.dispatchTouchEvent(Activity.java:4548)
    at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(Unknown Source:2)
    at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:734)
    at android.view.View.dispatchPointerEvent(View.java:16489)
    at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:8602)
    at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:8353)
    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:7682)
    at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:7739)
    at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:7705)
    at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:7908)
    at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:7713)
    at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:7965)
    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:7686)
    at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:7739)
    at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:7705)
    at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:7713)
    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:7686)
    at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:11250)
    at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:11119)
    at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:11075)
    at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:11384)
    at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:337)
    at android.os.MessageQueue.nativePollOnce(Native Method)
    at android.os.MessageQueue.next(MessageQueue.java:335)
    at android.os.Looper.loopOnce(Looper.java:187)
    at android.os.Looper.loop(Looper.java:319)
    at android.app.ActivityThread.main(ActivityThread.java:8919)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
    Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [androidx.compose.ui.platform.MotionDurationScaleImpl@48d0193, androidx.compose.runtime.BroadcastFrameClock@136a5d0, StandaloneCoroutine{Cancelling}@9aa29c9, AndroidUiDispatcher@a538ce]
Caused by: android.os.TransactionTooLargeException: data parcel size 2635952 bytes
    at android.os.BinderProxy.transactNative(Native Method)
    at android.os.BinderProxy.transact(BinderProxy.java:662)
    at android.app.IActivityTaskManager$Stub$Proxy.startActivity(IActivityTaskManager.java:3041)
    at android.app.Instrumentation.execStartActivity(Instrumentation.java:1873)
    ... 80 more

Log:
2024-09-02T12:32:02.504: I [Preloader] Loaded country boundaries in 0.1s
2024-09-02T12:32:02.604: I [Preloader] Loaded features dictionary in 0.2s
2024-09-02T12:32:02.605: I [Preloader] Preloading data took 0.2s
2024-09-02T12:32:02.877: V [MapImages] Loaded 27 images
2024-09-02T12:32:03.316: D [OsmAvatarsDownload] Downloaded file 172435