JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.92k stars 1.16k forks source link

Crash on iOS: `GrGpuResource::release()` #3862

Closed onseok closed 10 months ago

onseok commented 10 months ago

Describe the bug We've received a handful of reports of crashes on iOS via the AppStore & Firebase Crashlytics. We have not yet been able to reproduce the crash ourselves.

Affected platforms Select one of the platforms below:

Versions

To Reproduce We don't have reproduction steps as of yet. We've seen a half-dozen of reports via the AppStore & Firebase Crashlytics.

Expected behavior The app should not crash.

Screenshots N/A

Additional context

Crashed: RenderingDispatchQueue
0  Preat                          0x10c3e80 GrGpuResource::release() + 2324312
1  Preat                          0x10d070c GrResourceCache::purgeAsNeeded() + 2375652
2  Preat                          0x10d070c GrResourceCache::purgeAsNeeded() + 2375652
3  Preat                          0x10d097c GrResourceCache::insertResource(GrGpuResource*) + 2376276
4  Preat                          0x1173b04 GrMtlBuffer::GrMtlBuffer(GrMtlGpu*, unsigned long, GrGpuBufferType, GrAccessPattern, std::__1::basic_string_view<char, std::__1::char_traits<char>>) + 3044316
5  Preat                          0x1173a10 GrMtlBuffer::Make(GrMtlGpu*, unsigned long, GrGpuBufferType, GrAccessPattern) + 3044072
6  Preat                          0x10c29dc GrGpu::createBuffer(unsigned long, GrGpuBufferType, GrAccessPattern) + 2319028
7  Preat                          0x10d57f4 GrResourceProvider::createBuffer(unsigned long, GrGpuBufferType, GrAccessPattern, GrResourceProvider::ZeroInit) + 2396364
8  Preat                          0x10d6b48 GrStagingBufferManager::allocateStagingBufferSlice(unsigned long, unsigned long) + 2401312
9  Preat                          0x1179810 GrMtlGpu::uploadToTexture(GrMtlTexture*, SkIRect, GrColorType, GrMipLevel const*, int) + 3068136
10 Preat                          0x10c2604 GrGpu::writePixels(GrSurface*, SkIRect, GrColorType, GrColorType, GrMipLevel const*, int, bool) + 2318044
11 Preat                          0x10c2118 GrGpu::createTexture(SkISize, GrBackendFormat const&, GrTextureType, GrRenderable, int, SkBudgeted, GrProtected, GrColorType, GrColorType, GrMipLevel const*, int, std::__1::basic_string_view<char, std::__1::char_traits<char>>) + 2316784
12 Preat                          0x10d4650 GrResourceProvider::createTexture(SkISize, GrBackendFormat const&, GrTextureType, GrColorType, GrRenderable, int, SkBudgeted, GrMipmapped, GrProtected, GrMipLevel const*, std::__1::basic_string_view<char, std::__1::char_traits<char>>) + 2391848
13 Preat                          0x10d4ef0 GrResourceProvider::createTexture(SkISize, GrBackendFormat const&, GrTextureType, GrColorType, GrRenderable, int, SkBudgeted, SkBackingFit, GrProtected, GrMipLevel const&, std::__1::basic_string_view<char, std::__1::char_traits<char>>) + 2394056
14 Preat                          0x10ca5dc std::__1::__function::__func<GrProxyProvider::createNonMippedProxyFromBitmap(SkBitmap const&, SkBackingFit, SkBudgeted)::$_0, std::__1::allocator<GrProxyProvider::createNonMippedProxyFromBitmap(SkBitmap const&, SkBackingFit, SkBudgeted)::$_0>, GrSurfaceProxy::LazyCallbackResult (GrResourceProvider*, GrSurfaceProxy::LazySurfaceDesc const&)>::operator()(GrResourceProvider*&&, GrSurfaceProxy::LazySurfaceDesc const&) + 2350772
15 Preat                          0x10d8680 GrSurfaceProxyPriv::doLazyInstantiation(GrResourceProvider*) + 2408280
16 Preat                          0x10c923c GrProxyProvider::createProxyFromBitmap(SkBitmap const&, GrMipmapped, SkBackingFit, SkBudgeted) + 2345748
17 Preat                          0x10e12c4 make_bmp_proxy(GrProxyProvider*, SkBitmap const&, GrColorType, GrMipmapped, SkBackingFit, SkBudgeted) + 2444188
18 Preat                          0x10e0f24 GrMakeCachedBitmapProxyView(GrRecordingContext*, SkBitmap const&, std::__1::basic_string_view<char, std::__1::char_traits<char>>, GrMipmapped) + 2443260
19 Preat                          0xfa5ccc SkImage_Raster::onAsFragmentProcessor(GrRecordingContext*, SkSamplingOptions, SkTileMode const*, SkMatrix const&, SkRect const*, SkRect const*) const + 1152420
20 Preat                          0xfa1ba4 SkImage_Base::asFragmentProcessor(GrRecordingContext*, SkSamplingOptions, SkTileMode const*, SkMatrix const&, SkRect const*, SkRect const*) const + 1135740
21 Preat                          0x10a3db4 (anonymous namespace)::draw_image(GrRecordingContext*, skgpu::v1::SurfaceDrawContext*, GrClip const*, SkMatrixProvider const&, SkPaint const&, SkImage_Base const&, SkRect const&, SkRect const&, SkPoint const*, SkMatrix const&, GrQuadAAFlags, SkCanvas::SrcRectConstraint, SkSamplingOptions, SkTileMode) + 2193036
22 Preat                          0x10a580c skgpu::v1::Device::drawImageQuad(SkImage const*, SkRect const*, SkRect const*, SkPoint const*, GrQuadAAFlags, SkMatrix const*, SkSamplingOptions const&, SkPaint const&, SkCanvas::SrcRectConstraint) + 2199780
23 Preat                          0x10a1a00 skgpu::v1::Device::drawImageRect(SkImage const*, SkRect const*, SkRect const&, SkSamplingOptions const&, SkPaint const&, SkCanvas::SrcRectConstraint) + 2183896
24 Preat                          0xee25b0 SkCanvas::onDrawImageRect2(SkImage const*, SkRect const&, SkRect const&, SkSamplingOptions const&, SkPaint const*, SkCanvas::SrcRectConstraint) + 351880
25 Preat                          0xf55020 SkRecordDraw(SkRecord const&, SkCanvas*, SkPicture const* const*, SkDrawable* const*, int, SkBBoxHierarchy const*, SkPicture::AbortCallback*) + 821496
26 Preat                          0xee40a0 SkCanvas::onDrawPicture(SkPicture const*, SkMatrix const*, SkPaint const*) + 358776
27 Preat                          0xee3f98 SkCanvas::drawPicture(SkPicture const*, SkMatrix const*, SkPaint const*) + 358512
28 Preat                          0xf55020 SkRecordDraw(SkRecord const&, SkCanvas*, SkPicture const* const*, SkDrawable* const*, int, SkBBoxHierarchy const*, SkPicture::AbortCallback*) + 821496
29 Preat                          0xee40a0 SkCanvas::onDrawPicture(SkPicture const*, SkMatrix const*, SkPaint const*) + 358776
30 Preat                          0xee3f98 SkCanvas::drawPicture(SkPicture const*, SkMatrix const*, SkPaint const*) + 358512
31 Preat                          0xf55020 SkRecordDraw(SkRecord const&, SkCanvas*, SkPicture const* const*, SkDrawable* const*, int, SkBBoxHierarchy const*, SkPicture::AbortCallback*) + 821496
32 Preat                          0xee40a0 SkCanvas::onDrawPicture(SkPicture const*, SkMatrix const*, SkPaint const*) + 358776
33 Preat                          0xee3f98 SkCanvas::drawPicture(SkPicture const*, SkMatrix const*, SkPaint const*) + 358512
34 Preat                          0xf55020 SkRecordDraw(SkRecord const&, SkCanvas*, SkPicture const* const*, SkDrawable* const*, int, SkBBoxHierarchy const*, SkPicture::AbortCallback*) + 821496
35 Preat                          0xee40a0 SkCanvas::onDrawPicture(SkPicture const*, SkMatrix const*, SkPaint const*) + 358776
36 Preat                          0xee3f98 SkCanvas::drawPicture(SkPicture const*, SkMatrix const*, SkPaint const*) + 358512
37 Preat                          0xf55020 SkRecordDraw(SkRecord const&, SkCanvas*, SkPicture const* const*, SkDrawable* const*, int, SkBBoxHierarchy const*, SkPicture::AbortCallback*) + 821496
38 Preat                          0xee40a0 SkCanvas::onDrawPicture(SkPicture const*, SkMatrix const*, SkPaint const*) + 358776
39 Preat                          0xee3f98 SkCanvas::drawPicture(SkPicture const*, SkMatrix const*, SkPaint const*) + 358512
40 Preat                          0xf55020 SkRecordDraw(SkRecord const&, SkCanvas*, SkPicture const* const*, SkDrawable* const*, int, SkBBoxHierarchy const*, SkPicture::AbortCallback*) + 821496
41 Preat                          0xee40a0 SkCanvas::onDrawPicture(SkPicture const*, SkMatrix const*, SkPaint const*) + 358776
42 Preat                          0xee3f98 SkCanvas::drawPicture(SkPicture const*, SkMatrix const*, SkPaint const*) + 358512
43 Preat                          0xf55020 SkRecordDraw(SkRecord const&, SkCanvas*, SkPicture const* const*, SkDrawable* const*, int, SkBBoxHierarchy const*, SkPicture::AbortCallback*) + 821496
44 Preat                          0xee40a0 SkCanvas::onDrawPicture(SkPicture const*, SkMatrix const*, SkPaint const*) + 358776
45 Preat                          0xee3f98 SkCanvas::drawPicture(SkPicture const*, SkMatrix const*, SkPaint const*) + 358512
46 Preat                          0xf55020 SkRecordDraw(SkRecord const&, SkCanvas*, SkPicture const* const*, SkDrawable* const*, int, SkBBoxHierarchy const*, SkPicture::AbortCallback*) + 821496
47 Preat                          0xee40a0 SkCanvas::onDrawPicture(SkPicture const*, SkMatrix const*, SkPaint const*) + 358776
48 Preat                          0xee3f98 SkCanvas::drawPicture(SkPicture const*, SkMatrix const*, SkPaint const*) + 358512
49 Preat                          0x13f614c org_jetbrains_skia_Canvas__1nDrawPicture + 5675556
50 Preat                          0x3734e8 kfun:org.jetbrains.skia.Canvas#drawPicture(org.jetbrains.skia.Picture;org.jetbrains.skia.Matrix33?;org.jetbrains.skia.Paint?){}org.jetbrains.skia.Canvas + 62 (Native.native.kt:62)
51 Preat                          0x4cf82c kfun:androidx.compose.ui.window.MetalRedrawer.$draw$lambda$4$FUNCTION_REFERENCE$4.invoke#internal + 579 (Canvas.kt:579)
52 Preat                          0x4d0d4c kfun:androidx.compose.ui.window.MetalRedrawer.$draw$lambda$4$FUNCTION_REFERENCE$4.$<bridge-UNN>invoke(){}#internal + 428 (MetalRedrawer.kt:428)
53 Preat                          0xa37ce0 kfun:kotlin.Function0#invoke(){}1:0-trampoline + 1 ([K][Suspend]Functions:1)
54 Preat                          0x4d0e0c kfun:androidx.compose.ui.window.MetalRedrawer.$draw$lambda$5$FUNCTION_REFERENCE$5.$<bridge-UNN>invoke(){}#internal + 15 (ObjectiveCUtils.kt:15)
55 Preat                          0xa37ce0 kfun:kotlin.Function0#invoke(){}1:0-trampoline + 1 ([K][Suspend]Functions:1)
56 Preat                          0xe5df48 ___6f72672e6a6574627261696e732e636f6d706f73652e75693a75692f6f70742f6275696c644167656e742f776f726b2f356234626566333562333562396631322f636f6d706f73652f75692f75692f7372632f75696b69744d61696e2f6b6f746c696e2f616e64726f6964782f636f6d706f73652f75692f77696e646f772f4d6574616c52656472617765722e6b74_knbridge114_block_invoke + 4384530248
57 libdispatch.dylib              0x2320 _dispatch_call_block_and_release + 32
58 libdispatch.dylib              0x3eac _dispatch_client_callout + 20
59 libdispatch.dylib              0xb534 _dispatch_lane_serial_drain + 668
60 libdispatch.dylib              0xc0a4 _dispatch_lane_invoke + 384
61 libdispatch.dylib              0x16cdc _dispatch_workloop_worker_thread + 648
62 libsystem_pthread.dylib        0xddc _pthread_wqthread + 288
63 libsystem_pthread.dylib        0xb7c start_wqthread + 8
pjBooms commented 10 months ago

However, what do you guys suggest as the best way to load fonts for now apart from MOKO because this is a major blocker?

We are going to add support for fonts into our resource library next release

Plus the white background of UIKitView causes blinking which looks bad in dark mode. Any idea when this will be fixed properly?

Do you mean this issue?

LaatonWalaBhoot commented 10 months ago

Any tentative date for the next release with the fixes? Yes, that same issue. The blinking is horrible. Lottie and other libraries for auth blink in dark mode and look ugly. In fact any UI specific to iOS would see this problem in dark mode.

pjBooms commented 10 months ago

Any tentative date for the next release with the fixes?

It is a hard problem, we are investigating it right now. Currently we cannot provide estimations as it is still not clear what is the root cause.

LaatonWalaBhoot commented 10 months ago

No worries. Thanks a lot for the help. For now, using the flag forceMainThreadRendering = true has subsided the crashes. For anyone else looking for a fix for the font crash. Using a single font flavor in the font family stopped the font crashes as well. Not sure if it's a MOKO or CMP issue.

Eagerly waiting for the new release @pjBooms. Hopefully, UIKitView problems and resource library updates will be solved.

GuilhE commented 10 months ago

For anyone else looking for a fix for the font crash. Using a single font flavor in the font family stopped the font crashes as well. Not sure if it's a MOKO or CMP issue.

By "single font flavor in the font family", do you mean only one font file? If So, I use only one and it crashes. I don't use MOKO also, instead, just raw expect/actual.

LaatonWalaBhoot commented 10 months ago

@GuilhE I feel your pain. I tried multiple implementations of expect/actual like how Tivi does it but none worked. Since I am using cocoa pods maybe that's why. Spent almost a week on this. Attaching my typography code maybe this can help you. I am using MOKO for now until CMP releases font support. As you can see I am using only one flavour. Using multiple was causing lags and crashes.

@Composable
fun SansSerifCondensed() = fontFamilyResource(Res.fonts.RobotoCondensed.medium)

@Composable
fun MedialTypography(): Typography {
    val sansSerifCondensed = SansSerifCondensed()

    return Typography(
        labelLarge = TextStyle(
            fontFamily = sansSerifCondensed,
            fontWeight = FontWeight.Medium,
            letterSpacing = 0.10000000149011612.sp,
            lineHeight = 20.sp,
            fontSize = 14.sp
        ),
        labelMedium = TextStyle(
            fontFamily = sansSerifCondensed,
            fontWeight = FontWeight.Medium,
            letterSpacing = 0.5.sp,
            lineHeight = 16.sp,
            fontSize = 12.sp
        ),
        labelSmall = TextStyle(
            fontFamily = sansSerifCondensed,
            fontWeight = FontWeight.Medium,
            letterSpacing = 0.5.sp,
            lineHeight = 16.sp,
            fontSize = 11.sp
        ),
        bodyLarge = TextStyle(
            fontFamily = sansSerifCondensed,
            fontWeight = FontWeight.W400,
            letterSpacing = 0.5.sp,
            lineHeight = 24.sp,
            fontSize = 16.sp
        ),
        bodyMedium = TextStyle(
            fontFamily = sansSerifCondensed,
            fontWeight = FontWeight.W400,
            letterSpacing = 0.25.sp,
            lineHeight = 20.sp,
            fontSize = 14.sp
        ),
        bodySmall = TextStyle(
            fontFamily = sansSerifCondensed,
            fontWeight = FontWeight.W400,
            letterSpacing = 0.4000000059604645.sp,
            lineHeight = 16.sp,
            fontSize = 12.sp
        ),
        headlineLarge = TextStyle(
            fontFamily = sansSerifCondensed,
            fontWeight = FontWeight.W400,
            letterSpacing = 0.sp,
            lineHeight = 40.sp,
            fontSize = 32.sp
        ),
        headlineMedium = TextStyle(
            fontFamily = sansSerifCondensed,
            fontWeight = FontWeight.W400,
            letterSpacing = 0.sp,
            lineHeight = 36.sp,
            fontSize = 28.sp
        ),
        headlineSmall = TextStyle(
            fontFamily = sansSerifCondensed,
            fontWeight = FontWeight.W400,
            letterSpacing = 0.sp,
            lineHeight = 32.sp,
            fontSize = 24.sp
        ),
        displayLarge = TextStyle(
            fontFamily = sansSerifCondensed,
            fontWeight = FontWeight.W400,
            letterSpacing = (-0.25).sp,
            lineHeight = 64.sp,
            fontSize = 57.sp
        ),
        displayMedium = TextStyle(
            fontFamily = sansSerifCondensed,
            fontWeight = FontWeight.W400,
            letterSpacing = 0.sp,
            lineHeight = 52.sp,
            fontSize = 45.sp
        ),
        displaySmall = TextStyle(
            fontFamily = sansSerifCondensed,
            fontWeight = FontWeight.W400,
            letterSpacing = 0.sp,
            lineHeight = 44.sp,
            fontSize = 36.sp
        ),
        titleLarge = TextStyle(
            fontFamily = sansSerifCondensed,
            fontWeight = FontWeight.W400,
            letterSpacing = 0.sp,
            lineHeight = 28.sp,
            fontSize = 22.sp
        ),
        titleMedium = TextStyle(
            fontFamily = sansSerifCondensed,
            fontWeight = FontWeight.Medium,
            letterSpacing = 0.15000000596046448.sp,
            lineHeight = 24.sp,
            fontSize = 16.sp
        ),
        titleSmall = TextStyle(
            fontFamily = sansSerifCondensed,
            fontWeight = FontWeight.Medium,
            letterSpacing = 0.10000000149011612.sp,
            lineHeight = 20.sp,
            fontSize = 14.sp
        )
    )

}
GuilhE commented 10 months ago

Oh but this approach works for me, it stopped working properly starting from 1.5.10-rc01, that's why I opened this issue. With the latest versions, in my use case, it's harder to reproduce, but it's still there.

LaatonWalaBhoot commented 10 months ago

That's what the problem is. I am not sure when it started but it has been there since 1.5.1 I have tried expect/actual and moko but intermittent crashes are what is a dealbreaker App is already in production hence staying with the single font for now because that is the only one working without crashes.

dima-avdeev-jb commented 10 months ago

We fixed Crash with fonts. Please take a look at this comment in another Issue: https://github.com/JetBrains/compose-multiplatform/issues/3822#issuecomment-1806367451

Can you please check it without usage of flag forceMainThreadRendering at first. We hope, that new version of Skiko will help with this Crash as well.

But, if crash Crashed: RenderingDispatchQueue will still appears, you can use forceMainThreadRendering

LaatonWalaBhoot commented 10 months ago

@dima-avdeev-jb Please give me some time to confirm this. Would this also mean I do not have to use the 0.0.0-dev1260 build and can fallback to 1.5.10? If Crashed: RenderingDispatchQueue crash still appears with Skiko 0.7.88, Do I have to use 0.0.0-dev1260 for the time being?

dima-avdeev-jb commented 10 months ago

@LaatonWalaBhoot It is good to test with Compose version 1.5.10 and with 0.0.0-dev1260 as well. It will help us to better understand the problem.

Anyway, we want to fix all of it in next Compose 1.5.11 release

LaatonWalaBhoot commented 10 months ago

@dima-avdeev-jb Font crash and lag are no longer happening with the new skiko version. That seems to be fixed. However Crashed: RenderingDispatchQueue is still there with 1.5.10 and 0.0.0-dev1260 For now moving to production with 0.0.0-dev1260 and forceMainThreadRendering = true Hope this gets resolved in 1.5.11. Would UIKitView white background also get addressed in 1.5.11?

Stacktrace:

Crashed: RenderingDispatchQueue
0  libobjc.A.dylib                0x8238 objc_loadWeakRetained + 144
1  Medial                         0x10cc520 GrMtlPipelineState::setDepthStencilState(GrMtlRenderCommandEncoder*) + 160
2  Medial                         0x10cc46c GrMtlPipelineState::setDrawState(GrMtlRenderCommandEncoder*, skgpu::Swizzle const&, GrXferProcessor const&) + 208
3  Medial                         0x10cacc8 GrMtlOpsRenderPass::onBindPipeline(GrProgramInfo const&, SkRect const&) + 292
4  Medial                         0xfe63ac GrOpsRenderPass::bindPipeline(GrProgramInfo const&, SkRect const&) + 164
5  Medial                         0x108845c (anonymous namespace)::TextureOpImpl::onExecute(GrOpFlushState*, SkRect const&) + 132
6  Medial                         0x10739f0 GrOp::execute(GrOpFlushState*, SkRect const&) + 232
7  Medial                         0x10737d0 skgpu::ganesh::OpsTask::onExecute(GrOpFlushState*) + 1036
8  Medial                         0xfd2c6c GrDrawingManager::executeRenderTasks(GrOpFlushState*) + 188
9  Medial                         0xfd2644 GrDrawingManager::flush(SkSpan<GrSurfaceProxy*>, SkSurfaces::BackendSurfaceAccess, GrFlushInfo const&, skgpu::MutableTextureState const*) + 1440
10 Medial                         0xfd2e78 GrDrawingManager::flushSurfaces(SkSpan<GrSurfaceProxy*>, SkSurfaces::BackendSurfaceAccess, GrFlushInfo const&, skgpu::MutableTextureState const*) + 168
11 Medial                         0xfcd5f0 GrDirectContextPriv::flushSurfaces(SkSpan<GrSurfaceProxy*>, SkSurfaces::BackendSurfaceAccess, GrFlushInfo const&, skgpu::MutableTextureState const*) + 360
12 Medial                         0xfcc5c8 GrDirectContext::flush(SkSurface*, SkSurfaces::BackendSurfaceAccess, GrFlushInfo const&) + 148
13 Medial                         0xec0394 SkSurface::flushAndSubmit(bool) + 84
14 Medial                         0x3b9c88 kfun:androidx.compose.ui.window.MetalRedrawer.$draw$lambda$4$FUNCTION_REFERENCE$4.invoke#internal + 952 (Surface.kt:952)
15 Medial                         0x3bb128 kfun:androidx.compose.ui.window.MetalRedrawer.$draw$lambda$4$FUNCTION_REFERENCE$4.$<bridge-UNN>invoke(){}#internal + 428 (MetalRedrawer.kt:428)
16 Medial                         0x948298 kfun:kotlin.Function0#invoke(){}1:0-trampoline + 1 ([K][Suspend]Functions:1)
17 Medial                         0x3bb1e8 kfun:androidx.compose.ui.window.MetalRedrawer.$draw$lambda$5$FUNCTION_REFERENCE$5.$<bridge-UNN>invoke(){}#internal + 15 (ObjectiveCUtils.kt:15)
18 Medial                         0x948298 kfun:kotlin.Function0#invoke(){}1:0-trampoline + 1 ([K][Suspend]Functions:1)
19 Medial                         0xd9bdb0 ___6f72672e6a6574627261696e732e636f6d706f73652e75693a75692f6f70742f6275696c644167656e742f776f726b2f356234626566333562333562396631322f636f6d706f73652f75692f75692f7372632f75696b69744d61696e2f6b6f746c696e2f616e64726f6964782f636f6d706f73652f75692f77696e646f772f4d6574616c52656472617765722e6b74_knbridge114_block_invoke + 200
20 libdispatch.dylib              0x2320 _dispatch_call_block_and_release + 32
21 libdispatch.dylib              0x3eac _dispatch_client_callout + 20
22 libdispatch.dylib              0xb534 _dispatch_lane_serial_drain + 668
23 libdispatch.dylib              0xc0a4 _dispatch_lane_invoke + 384
24 libdispatch.dylib              0x16cdc _dispatch_workloop_worker_thread + 648
25 libsystem_pthread.dylib        0xddc _pthread_wqthread + 288
26 libsystem_pthread.dylib        0xb7c start_wqthread + 8
ToluwaniO commented 10 months ago

I'm a bit late to the party but I encountered this issue after upgrading to 1.5.10-beta02. I've been stuck on 1.5.10-beta01 ever since. My app does have a ton of photos, it's a photo sharing app. I load images on ios with UIImage and the KingFisher library.

Crashed: com.apple.main-thread
0  Runwayy                        0x17b43e8 GrGpuResource::release() + 4354180072
1  Runwayy                        0x17c07cc GrResourceCache::releaseAll() + 4354230220
2  Runwayy                        0x17c07cc GrResourceCache::releaseAll() + 4354230220
3  Runwayy                        0x17a1704 GrDirectContext::~GrDirectContext() + 4354103044
4  Runwayy                        0x17a1888 GrDirectContext::~GrDirectContext() + 4354103432
5  Runwayy                        0x5d120c kfun:org.jetbrains.skia.impl.FinalizationThunk.clean#internal + 19 (Managed.native.kt:19)
6  Runwayy                        0x5d0ba4 kfun:org.jetbrains.skia.impl.Managed#close(){} + 1 (Native.native.kt:1)
7  Runwayy                        0x785b24 kfun:androidx.compose.ui.window.ComposeWindow#objc:viewDidDisappear: + 297 (MetalRedrawer.kt:297)
8  Runwayy                        0x1550368 _6f72672e6a6574627261696e732e636f6d706f73652e75693a75692f6f70742f6275696c644167656e742f776f726b2f356234626566333562333562396631322f636f6d706f73652f75692f75692f7372632f75696b69744d61696e2f6b6f746c696e2f616e64726f6964782f636f6d706f73652f75692f77696e646f772f436f6d706f736557696e646f772e75696b69742e6b74_kncfun368 + 4351673192
9  UIKitCore                      0xcbec -[UIViewController _setViewAppearState:isAnimating:] + 1012
10 UIKitCore                      0x7edb2c __52-[UIViewController _setViewAppearState:isAnimating:]_block_invoke_2 + 168
11 UIKitCore                      0x2457dc __52-[UIViewController _setViewAppearState:isAnimating:]_block_invoke + 192
12 CoreFoundation                 0xa1cc __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__ + 24
13 CoreFoundation                 0x376b8 -[__NSSingleObjectArrayI enumerateObjectsWithOptions:usingBlock:] + 92
14 UIKitCore                      0xcdd4 -[UIViewController _setViewAppearState:isAnimating:] + 1500
15 UIKitCore                      0x4672a8 -[UIViewController __viewDidDisappear:] + 136
16 UIKitCore                      0x2206c4 -[UIViewController _endAppearanceTransition:] + 192
17 UIKitCore                      0x14cef0 -[UINavigationController navigationTransitionView:didEndTransition:fromView:toView:] + 1100
18 UIKitCore                      0x1fd49c __49-[UINavigationController _startCustomTransition:]_block_invoke + 208
19 UIKitCore                      0x2b1d10 -[_UIViewControllerTransitionContext completeTransition:] + 116
20 UIKitCore                      0x80779c __53-[_UINavigationParallaxTransition animateTransition:]_block_invoke_5 + 604
21 UIKitCore                      0x1060598 __UIVIEW_IS_EXECUTING_ANIMATION_COMPLETION_BLOCK__ + 36
22 UIKitCore                      0xce148 -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 636
23 UIKitCore                      0xcd0a4 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 436
24 UIKitCore                      0xcc7c0 -[UIViewAnimationState animationDidStop:finished:] + 196
25 UIKitCore                      0xcc8d4 -[UIViewAnimationState animationDidStop:finished:] + 472
26 QuartzCore                     0x134e0 CA::Layer::run_animation_callbacks(void*) + 232
27 libdispatch.dylib              0x3eac _dispatch_client_callout + 20
28 libdispatch.dylib              0x126a4 _dispatch_main_queue_drain + 928
29 libdispatch.dylib              0x122f4 _dispatch_main_queue_callback_4CF + 44
30 CoreFoundation                 0x98c28 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
31 CoreFoundation                 0x7a560 __CFRunLoopRun + 1992
32 CoreFoundation                 0x7f3ec CFRunLoopRunSpecific + 612
33 GraphicsServices               0x135c GSEventRunModal + 164
34 UIKitCore                      0x39cf58 -[UIApplication _run] + 888
35 UIKitCore                      0x39cbbc UIApplicationMain + 340
36 SwiftUI                        0x1bcc50 OUTLINED_FUNCTION_895 + 2472
37 SwiftUI                        0x1231ec block_copy_helper.1 + 496
38 SwiftUI                        0x10d294 OUTLINED_FUNCTION_901 + 2752
39 Runwayy                        0x6dc0 main + 4 (iOSApp.swift:4)
40 ???                            0x1e9ab4dec (Missing)
dima-avdeev-jb commented 10 months ago

@LaatonWalaBhoot Thanks so much for good assist in problem solving!

Yeah, for now you can use Compose 0.0.0-dev1260 and forceMainThreadRendering = true with custom Skiko version as well.

I am sure, that Compose 1.5.11 will contains fix with fonts. I hope fix for Crashed: RenderingDispatchQueue as well.

As for white backgroud - not sure here. First of all we want to fix and publish as fast as possible all critical bugs. White background may be fixed later... I don't know yet.

dima-avdeev-jb commented 10 months ago

@ToluwaniO can please provide a minial reproducible sample of your problem on GitHub ?

LaatonWalaBhoot commented 10 months ago

@dima-avdeev-jb Thanks so much for the help. We launched on Production with CMP today. You and your team have done some awesome work. Eagerly waiting for 1.5.11.

elijah-semyonov commented 10 months ago

@LaatonWalaBhoot Hi, could you kindly check if 0.0.0-dev1270 solves the issue (without forceMainThreadRendering)

LaatonWalaBhoot commented 10 months ago

@elijah-semyonov Please spare me some time. In the middle of the prod release. Will update you at the earliest

pjBooms commented 10 months ago

@LaatonWalaBhoot have not you tried the 0.0.0-dev1270 build yet? We need to decide if we should disable parallel rendering in 1.5.11

LaatonWalaBhoot commented 10 months ago

@pjBooms Not yet. But I will do it today. Please give me 12 hours to respond. Apologies for the delay. Have been stuck with production release

LaatonWalaBhoot commented 10 months ago

@pjBooms @elijah-semyonov The crash is still there with 0.0.0-dev1270 and without forceMainThreadRendering Stacktrace

Crashed: RenderingDispatchQueue
0  libobjc.A.dylib                0x8238 objc_loadWeakRetained + 144
1  Medial                         0x10e6c34 GrMtlPipelineState::setDepthStencilState(GrMtlRenderCommandEncoder*) + 160
2  Medial                         0x10e6b80 GrMtlPipelineState::setDrawState(GrMtlRenderCommandEncoder*, skgpu::Swizzle const&, GrXferProcessor const&) + 208
3  Medial                         0x10e53dc GrMtlOpsRenderPass::onBindPipeline(GrProgramInfo const&, SkRect const&) + 292
4  Medial                         0x1000ac0 GrOpsRenderPass::bindPipeline(GrProgramInfo const&, SkRect const&) + 164
5  Medial                         0x10a2b70 (anonymous namespace)::TextureOpImpl::onExecute(GrOpFlushState*, SkRect const&) + 132
6  Medial                         0x108e104 GrOp::execute(GrOpFlushState*, SkRect const&) + 232
7  Medial                         0x108dee4 skgpu::ganesh::OpsTask::onExecute(GrOpFlushState*) + 1036
8  Medial                         0xfed380 GrDrawingManager::executeRenderTasks(GrOpFlushState*) + 188
9  Medial                         0xfecd58 GrDrawingManager::flush(SkSpan<GrSurfaceProxy*>, SkSurfaces::BackendSurfaceAccess, GrFlushInfo const&, skgpu::MutableTextureState const*) + 1440
10 Medial                         0xfed58c GrDrawingManager::flushSurfaces(SkSpan<GrSurfaceProxy*>, SkSurfaces::BackendSurfaceAccess, GrFlushInfo const&, skgpu::MutableTextureState const*) + 168
11 Medial                         0xfe7d04 GrDirectContextPriv::flushSurfaces(SkSpan<GrSurfaceProxy*>, SkSurfaces::BackendSurfaceAccess, GrFlushInfo const&, skgpu::MutableTextureState const*) + 360
12 Medial                         0xfe6cdc GrDirectContext::flush(SkSurface*, SkSurfaces::BackendSurfaceAccess, GrFlushInfo const&) + 148
13 Medial                         0xedaaa8 SkSurface::flushAndSubmit(bool) + 84
14 Medial                         0x3ba160 kfun:androidx.compose.ui.window.MetalRedrawer.$draw$lambda$4$FUNCTION_REFERENCE$4.invoke#internal + 956 (Surface.kt:956)
15 Medial                         0x3bb75c kfun:androidx.compose.ui.window.MetalRedrawer.$draw$lambda$4$FUNCTION_REFERENCE$4.$<bridge-UNNB>invoke(kotlin.Boolean){}#internal + 441 (MetalRedrawer.kt:441)
16 Medial                         0x950eb0 kfun:kotlin.Function1#invoke(1:0){}1:1-trampoline + 1 ([K][Suspend]Functions:1)
17 Medial                         0x3bb92c kfun:androidx.compose.ui.window.MetalRedrawer.$draw$lambda$5$FUNCTION_REFERENCE$5.$<bridge-UNN>invoke(){}#internal + 140 (LocalUIKitInteropContext.kt:140)
18 Medial                         0x951530 kfun:kotlin.Function0#invoke(){}1:0-trampoline + 1 ([K][Suspend]Functions:1)
19 Medial                         0xdb64c4 ___6f72672e6a6574627261696e732e636f6d706f73652e75693a75692f6f70742f6275696c644167656e742f776f726b2f356234626566333562333562396631322f636f6d706f73652f75692f75692f7372632f75696b69744d61696e2f6b6f746c696e2f616e64726f6964782f636f6d706f73652f75692f77696e646f772f4d6574616c52656472617765722e6b74_knbridge130_block_invoke + 200
20 libdispatch.dylib              0x2320 _dispatch_call_block_and_release + 32
21 libdispatch.dylib              0x3eac _dispatch_client_callout + 20
22 libdispatch.dylib              0xb534 _dispatch_lane_serial_drain + 668
23 libdispatch.dylib              0xc0a4 _dispatch_lane_invoke + 384
24 libdispatch.dylib              0x16cdc _dispatch_workloop_worker_thread + 648
25 libsystem_pthread.dylib        0xddc _pthread_wqthread + 288
26 libsystem_pthread.dylib        0xb7c start_wqthread + 8
okushnikov commented 2 months ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.