flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
166.19k stars 27.49k forks source link

[iOS] Crash on `impeller::TypographerContextSkia::CreateGlyphAtlas` [3.24.1] #154721

Closed tlb-brunoreginato closed 2 months ago

tlb-brunoreginato commented 2 months ago

Steps to reproduce

Mainly happening on old devices (iPhone 8, SE, X...) after we update to Flutter 3.24.1.

Expected results

Not Crash.

Actual results

Crash.

Code sample

Code sample ```dart [Paste your code here] ```

Screenshots or Video

Screenshots / Video demonstration Screenshot 2024-09-06 at 6 14 27 PM

Logs

Logs ```console Crashed: io.flutter.1.raster 0 Flutter 0x48dfec impeller::TypographerContextSkia::CreateGlyphAtlas(impeller::Context&, impeller::GlyphAtlas::Type, impeller::HostBuffer&, std::_fl::shared_ptr const&, std::_fl::unordered_map, std::_fl::equal_to, std::_fl::allocator>, std::_fl::hash, std::_fl::equal_to, std::_fl::allocator, std::_fl::equal_to, std::_fl::allocator>>>> const&) const + 528 (typographer_context_skia.cc:528) 1 Flutter 0x165438 impeller::TextContents::Render(impeller::ContentContext const&, impeller::Entity const&, impeller::RenderPass&) const + 801 (shared_ptr.h:801) 2 Flutter 0x16f64c impeller::EntityPass::RenderElement(impeller::Entity&, unsigned long, impeller::InlinePassContext&, int, impeller::ContentContext&, impeller::EntityPassClipStack&, impeller::TPoint) const + 832 (entity_pass.cc:832) 3 Flutter 0x16e718 impeller::EntityPass::OnRender(impeller::ContentContext&, impeller::TSize, impeller::EntityPassTarget&, impeller::TPoint, impeller::TPoint, unsigned int, impeller::EntityPassClipStack&, unsigned long, std::_fl::shared_ptr, std::_fl::optional const&) const + 984 (entity_pass.cc:984) 4 Flutter 0x111538 impeller::AiksContext::Render(impeller::Picture const&, impeller::RenderTarget&, bool) + 501 (entity_pass.cc:501) 5 Flutter 0x17ea4c impeller::Renderer::Render(std::_fl::unique_ptr>, std::_fl::function const&) const + 46 (renderer.cc:46) 6 Flutter 0x5f6874 std::_fl::__function::__func, std::_fl::allocator>, bool (flutter::SurfaceFrame&, flutter::DlCanvas*)>::operator()(flutter::SurfaceFrame&, flutter::DlCanvas*&&) + 192 (gpu_surface_metal_impeller.mm:192) 7 Flutter 0x4f3e64 flutter::SurfaceFrame::Submit() + 56 (surface_frame.cc:56) 8 Flutter 0x5a9f78 flutter::Rasterizer::DrawToSurfacesUnsafe(flutter::FrameTimingsRecorder&, std::_fl::vector>, std::_fl::allocator>>>) + 803 (rasterizer.cc:803) 9 Flutter 0x5aa464 std::_fl::__function::__func>, std::_fl::allocator>>>)::$_1, std::_fl::allocator>, std::_fl::allocator>>>)::$_1>, void ()>::operator()() + 597 (rasterizer.cc:597) 10 Flutter 0x7faac fml::SyncSwitch::Execute(fml::SyncSwitch::Handlers const&) const + 29 (shared_mutex.h:29) 11 Flutter 0x5a96a8 flutter::Rasterizer::DrawToSurfaces(flutter::FrameTimingsRecorder&, std::_fl::vector>, std::_fl::allocator>>>) + 470 (function.h:470) 12 Flutter 0x5ab2e4 std::_fl::__function::__func> const&)::$_0, std::_fl::allocator> const&)::$_0>, void (std::_fl::unique_ptr>)>::operator()(std::_fl::unique_ptr>&&) + 423 (vector:423) 13 Flutter 0x5aab00 flutter::Rasterizer::Draw(std::_fl::shared_ptr> const&) + 259 (unique_ptr.h:259) 14 Flutter 0x5c2384 std::_fl::__function::__func>)::$_0>, std::_fl::allocator>)::$_0>>, void ()>::operator()() + 1290 (shell.cc:1290) 15 Flutter 0x7e05c fml::MessageLoopImpl::FlushTasks(fml::FlushType) + 128 (message_loop_impl.cc:128) 16 Flutter 0x81660 fml::MessageLoopDarwin::OnTimerFire(__CFRunLoopTimer*, fml::MessageLoopDarwin*) + 86 (message_loop_darwin.mm:86) 17 CoreFoundation 0xc1bb0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 28 18 CoreFoundation 0x82de4 __CFRunLoopDoTimer + 884 19 CoreFoundation 0x2c0fc __CFRunLoopDoTimers + 284 20 CoreFoundation 0x755bc __CFRunLoopRun + 1940 21 CoreFoundation 0x79d20 CFRunLoopRunSpecific + 584 22 Flutter 0x8174c fml::MessageLoopDarwin::Run() + 52 (message_loop_darwin.mm:52) 23 Flutter 0x81394 std::_fl::__function::__func const&, fml::Thread::ThreadConfig const&)::$_0, std::_fl::allocator const&, fml::Thread::ThreadConfig const&)::$_0>, void ()>::operator()() + 94 (message_loop_impl.cc:94) 24 Flutter 0x81024 fml::ThreadHandle::ThreadHandle(std::_fl::function&&)::$_0::__invoke(void*) + 470 (function.h:470) 25 libsystem_pthread.dylib 0x30ec _pthread_start + 116 26 libsystem_pthread.dylib 0x172c thread_start + 8 ```

Flutter Doctor output

Doctor output ```console [✓] Flutter (Channel stable, 3.24.1, on macOS 14.4.1 23E224 darwin-arm64, locale en-AE) • Flutter version 3.24.1 on channel stable at /Users/brunoreginato/fvm/versions/3.24.1 • Upstream repository https://github.com/flutter/flutter.git • Framework revision 5874a72aa4 (2 weeks ago), 2024-08-20 16:46:00 -0500 • Engine revision c9b9d5780d • Dart version 3.5.1 • DevTools version 2.37.2 ```
huycozy commented 2 months ago

This seems to happen in production without reproduction. Some traces look similar to one reported at https://github.com/flutter/flutter/issues/150271.

jonahwilliams commented 2 months ago

We think this is fixed at ToT, the offending code was removed in a refactor

see https://github.com/flutter/engine/blob/main/impeller/typographer/backends/skia/typographer_context_skia.cc vs https://github.com/flutter/engine/blob/flutter-3.24-candidate.0/impeller/typographer/backends/skia/typographer_context_skia.cc#L522-L531

Closing as fixed

mnayef95-tlb commented 1 month ago

@jonahwilliams I can see you are mentioning it's fixed on flutter-3.24-candidate.0 but the issue still happens on 3.24.1 as stated in the issue description, does this mean flutter-3.24-candidate.0 is not part of 3.24.1 release?

github-actions[bot] commented 1 month ago

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.