Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[macos]EXC_BAD_ACCESS GrGLGpu::deleteSync #109032

Open
cuishijie1991 opened this issue Aug 5, 2022 · 10 comments
Open

[macos]EXC_BAD_ACCESS GrGLGpu::deleteSync #109032

cuishijie1991 opened this issue Aug 5, 2022 · 10 comments
Labels
a: production Issues experienced in live production apps c: crash Stack traces logged to the console engine flutter/engine repository. See also e: labels. needs repro info Automated crash report whose cause isn't yet known P2 Important issues not at the top of the work list platform-mac Building on or for macOS specifically team-engine Owned by Engine team triaged-engine Triaged by Engine team

Comments

@cuishijie1991
Copy link

cuishijie1991 commented Aug 5, 2022

this is a crash info from sentry with my app production

OS Version: macOS 10.13.6 (17G14042)
Report Version: 104

Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: BUS_NOOP at 0x0000000000000058
Crashed Thread: 3

Application Specific Information:
Exception 1, Code 88, Subcode 8 >
Attempted to dereference garbage pointer 0x58.

Thread 3 Crashed:
0   FlutterMacOS                    0x10ce009bd         GrGLGpu::deleteSync
1   FlutterMacOS                    0x10ce09829         GrGLSemaphore::~GrGLSemaphore
2   FlutterMacOS                    0x10cc8aac5         SkNVRefCnt<T>::unref
3   FlutterMacOS                    0x10cc8abfa         GrBackendTextureImageGenerator::~GrBackendTextureImageGenerator
4   FlutterMacOS                    0x10cb8835e         SkImage_Lazy::~SkImage_Lazy
5   FlutterMacOS                    0x10cf3737c         flutter::DisposeOps
6   FlutterMacOS                    0x10cf37591         flutter::DisplayList::~DisplayList
7   FlutterMacOS                    0x10cf344a5         flutter::SkiaUnrefQueue::Drain
8   FlutterMacOS                    0x10c8fae60         fml::MessageLoopImpl::FlushTasks
9   FlutterMacOS                    0x10c90351c         fml::MessageLoopDarwin::OnTimerFire
10  CoreFoundation                  0xfffe55a46484      __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
11  CoreFoundation                  0xfffe55a46104      __CFRunLoopDoTimer
12  CoreFoundation                  0xfffe55a45bfa      __CFRunLoopDoTimers
13  CoreFoundation                  0xfffe55a3d39b      __CFRunLoopRun
14  CoreFoundation                  0xfffe55a3c787      CFRunLoopRunSpecific
15  FlutterMacOS                    0x10c90378e         fml::MessageLoopDarwin::Run
16  FlutterMacOS                    0x10c8fac74         fml::MessageLoopImpl::DoRun
17  FlutterMacOS                    0x10c9025ca         std::__1::__thread_proxy<T>
18  libsystem_pthread.dylib         0xfffea60dc661      _pthread_body
19  libsystem_pthread.dylib         0xfffea60dc50d      _pthread_start
20  libsystem_pthread.dylib         0xfffea60dbbf9      thread_start

Thread 0
0   libsystem_kernel.dylib          0xfffea5d33a16      __psynch_cvwait
1   FlutterMacOS                    0x10d1edd7e         dart::Monitor::Wait
2   FlutterMacOS                    0x10d1631f0         dart::Dart::WaitForIsolateShutdown
3   FlutterMacOS                    0x10d1633fe         dart::Dart::Cleanup
4   FlutterMacOS                    0x10d0f1e3b         DartVMInitializer::Cleanup
5   FlutterMacOS                    0x10d0f0db7         flutter::DartVM::~DartVM
6   FlutterMacOS                    0x10d0f10c5         std::__1::__shared_ptr_pointer<T>::__on_zero_shared
7   FlutterMacOS                    0x10d0f22d1         flutter::DartVMRef::~DartVMRef
8   FlutterMacOS                    0x10cf5f03e         flutter::Shell::~Shell
9   FlutterMacOS                    0x10d11c01b         flutter::EmbedderEngine::CollectShell
10  FlutterMacOS                    0x10d10b433         FlutterEngineDeinitialize
11  FlutterMacOS                    0x10c8a90c8         -[FlutterEngine shutDownEngine]
12  FlutterMacOS                    0x10c8bea43         -[FlutterViewController applicationWillTerminate:]
13  CoreFoundation                  0xfffe55a5239c      __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__
14  CoreFoundation                  0xfffe55a5226a      _CFXRegistrationPost
15  CoreFoundation                  0xfffe55a51fa1      ___CFXNotificationPost_block_invoke
16  CoreFoundation                  0xfffe55a10b32      -[_CFXNotificationRegistrar find:object:observer:enumerator:]
17  CoreFoundation                  0xfffe55a0fbc3      _CFXNotificationPost
18  Foundation                      0xfffe59cba047      -[NSNotificationCenter postNotificationName:object:userInfo:]
19  AppKit                          0xfffe50777ddc      -[NSApplication terminate:]
20  AppKit                          0xfffe50959008      -[NSApplication _terminateFromSender:askIfShouldTerminate:saveWindows:]
21  AppKit                          0xfffe508f3a8b      __79-[NSApplication _scheduleCheckForTerminateAfterLastWindowClosed]_block_invoke
22  CoreFoundation                  0xfffe55a46484      __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
23  CoreFoundation                  0xfffe55a46104      __CFRunLoopDoTimer
24  CoreFoundation                  0xfffe55a45bfa      __CFRunLoopDoTimers
25  CoreFoundation                  0xfffe55a3d39b      __CFRunLoopRun
26  CoreFoundation                  0xfffe55a3c787      CFRunLoopRunSpecific
27  HIToolbox                       0xfffe5404ed96      RunCurrentEventLoopInMode
28  HIToolbox                       0xfffe5404ea0f      ReceiveNextEventCommon
29  HIToolbox                       0xfffe5404e884      _BlockUntilNextEventMatchingListInModeWithFilter
30  AppKit                          0xfffe50596a3b      _DPSNextEvent
31  AppKit                          0xfffe50d2ce34      -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]
32  AppKit                          0xfffe5058b84d      -[NSApplication run]
33  AppKit                          0xfffe5055aa3a      NSApplicationMain
34  label_pc                        0x20c56d0b9         <redacted>
35  libdyld.dylib                   0xfffea5aae015      start

Thread 1 name: io.flutter.ui
0   libsystem_kernel.dylib          0xfffea5d2a1fa      mach_msg_trap
1   CoreFoundation                  0xfffe55a3ddc5      __CFRunLoopServiceMachPort
2   CoreFoundation                  0xfffe55a3d117      __CFRunLoopRun
3   CoreFoundation                  0xfffe55a3c787      CFRunLoopRunSpecific
4   FlutterMacOS                    0x10c90378e         fml::MessageLoopDarwin::Run
5   FlutterMacOS                    0x10c8fac74         fml::MessageLoopImpl::DoRun
6   FlutterMacOS                    0x10c9025ca         std::__1::__thread_proxy<T>
7   libsystem_pthread.dylib         0xfffea60dc661      _pthread_body
8   libsystem_pthread.dylib         0xfffea60dc50d      _pthread_start
9   libsystem_pthread.dylib         0xfffea60dbbf9      thread_start

Thread 2 name: io.flutter.raster
0   libsystem_kernel.dylib          0xfffea5d2a1fa      mach_msg_trap
1   CoreFoundation                  0xfffe55a3ddc5      __CFRunLoopServiceMachPort
2   CoreFoundation                  0xfffe55a3d117      __CFRunLoopRun
3   CoreFoundation                  0xfffe55a3c787      CFRunLoopRunSpecific
4   FlutterMacOS                    0x10c90378e         fml::MessageLoopDarwin::Run
5   FlutterMacOS                    0x10c8fac74         fml::MessageLoopImpl::DoRun
6   FlutterMacOS                    0x10c9025ca         std::__1::__thread_proxy<T>
7   libsystem_pthread.dylib         0xfffea60dc661      _pthread_body
8   libsystem_pthread.dylib         0xfffea60dc50d      _pthread_start
9   libsystem_pthread.dylib         0xfffea60dbbf9      thread_start

Thread 3 name: io.flutter.io Crashed:
0   FlutterMacOS                    0x10ce009bd         GrGLGpu::deleteSync
1   FlutterMacOS                    0x10ce09829         GrGLSemaphore::~GrGLSemaphore
2   FlutterMacOS                    0x10cc8aac5         SkNVRefCnt<T>::unref
3   FlutterMacOS                    0x10cc8abfa         GrBackendTextureImageGenerator::~GrBackendTextureImageGenerator
4   FlutterMacOS                    0x10cb8835e         SkImage_Lazy::~SkImage_Lazy
5   FlutterMacOS                    0x10cf3737c         flutter::DisposeOps
6   FlutterMacOS                    0x10cf37591         flutter::DisplayList::~DisplayList
7   FlutterMacOS                    0x10cf344a5         flutter::SkiaUnrefQueue::Drain
8   FlutterMacOS                    0x10c8fae60         fml::MessageLoopImpl::FlushTasks
9   FlutterMacOS                    0x10c90351c         fml::MessageLoopDarwin::OnTimerFire
10  CoreFoundation                  0xfffe55a46484      __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
11  CoreFoundation                  0xfffe55a46104      __CFRunLoopDoTimer
12  CoreFoundation                  0xfffe55a45bfa      __CFRunLoopDoTimers
13  CoreFoundation                  0xfffe55a3d39b      __CFRunLoopRun
14  CoreFoundation                  0xfffe55a3c787      CFRunLoopRunSpecific
15  FlutterMacOS                    0x10c90378e         fml::MessageLoopDarwin::Run
16  FlutterMacOS                    0x10c8fac74         fml::MessageLoopImpl::DoRun
17  FlutterMacOS                    0x10c9025ca         std::__1::__thread_proxy<T>
18  libsystem_pthread.dylib         0xfffea60dc661      _pthread_body
19  libsystem_pthread.dylib         0xfffea60dc50d      _pthread_start
20  libsystem_pthread.dylib         0xfffea60dbbf9      thread_start

Thread 4 name: io.worker.1
0   libsystem_kernel.dylib          0xfffea5d33a16      __psynch_cvwait
1   FlutterMacOS                    0x10c8c8d04         std::__1::condition_variable::wait
2   FlutterMacOS                    0x10c8f4ea3         fml::ConcurrentMessageLoop::WorkerMain
3   FlutterMacOS                    0x10c8f5bba         std::__1::__thread_proxy<T>
4   libsystem_pthread.dylib         0xfffea60dc661      _pthread_body
5   libsystem_pthread.dylib         0xfffea60dc50d      _pthread_start
6   libsystem_pthread.dylib         0xfffea60dbbf9      thread_start

Thread 5 name: io.worker.2
0   libsystem_kernel.dylib          0xfffea5d33a16      __psynch_cvwait
1   FlutterMacOS                    0x10c8c8d04         std::__1::condition_variable::wait
2   FlutterMacOS                    0x10c8f4ea3         fml::ConcurrentMessageLoop::WorkerMain
3   FlutterMacOS                    0x10c8f5bba         std::__1::__thread_proxy<T>
4   libsystem_pthread.dylib         0xfffea60dc661      _pthread_body
5   libsystem_pthread.dylib         0xfffea60dc50d      _pthread_start
6   libsystem_pthread.dylib         0xfffea60dbbf9      thread_start

Thread 6 name: io.worker.3
0   libsystem_kernel.dylib          0xfffea5d33a16      __psynch_cvwait
1   FlutterMacOS                    0x10c8c8d04         std::__1::condition_variable::wait
2   FlutterMacOS                    0x10c8f4ea3         fml::ConcurrentMessageLoop::WorkerMain
3   FlutterMacOS                    0x10c8f5bba         std::__1::__thread_proxy<T>
4   libsystem_pthread.dylib         0xfffea60dc661      _pthread_body
5   libsystem_pthread.dylib         0xfffea60dc50d      _pthread_start
6   libsystem_pthread.dylib         0xfffea60dbbf9      thread_start

Thread 7 name: io.worker.4
0   libsystem_kernel.dylib          0xfffea5d33a16      __psynch_cvwait
1   FlutterMacOS                    0x10c8c8d04         std::__1::condition_variable::wait
2   FlutterMacOS                    0x10c8f4ea3         fml::ConcurrentMessageLoop::WorkerMain
3   FlutterMacOS                    0x10c8f5bba         std::__1::__thread_proxy<T>
4   libsystem_pthread.dylib         0xfffea60dc661      _pthread_body
5   libsystem_pthread.dylib         0xfffea60dc50d      _pthread_start
6   libsystem_pthread.dylib         0xfffea60dbbf9      thread_start

Thread 8 name: dart:io EventHandler
0   libsystem_kernel.dylib          0xfffea5d34bea      kevent
1   FlutterMacOS                    0x10d0e4336         dart::bin::ThreadStart
2   libsystem_pthread.dylib         0xfffea60dc661      _pthread_body
3   libsystem_pthread.dylib         0xfffea60dc50d      _pthread_start
4   libsystem_pthread.dylib         0xfffea60dbbf9      thread_start

Thread 9 name: com.apple.NSEventThread
0   libsystem_kernel.dylib          0xfffea5d2a1fa      mach_msg_trap
1   CoreFoundation                  0xfffe55a3ddc5      __CFRunLoopServiceMachPort
2   CoreFoundation                  0xfffe55a3d117      __CFRunLoopRun
3   CoreFoundation                  0xfffe55a3c787      CFRunLoopRunSpecific
4   AppKit                          0xfffe506d3fc4      _NSEventThread
5   libsystem_pthread.dylib         0xfffea60dc661      _pthread_body
6   libsystem_pthread.dylib         0xfffea60dc50d      _pthread_start
7   libsystem_pthread.dylib         0xfffea60dbbf9      thread_start

Thread 10
0   libsystem_kernel.dylib          0xfffea5d33d82      __semwait_signal
1   libsystem_c.dylib               0xfffea5bc9586      sleep
2   Sentry                          0x10c5ca292         monitorCachedData
3   libsystem_pthread.dylib         0xfffea60dc661      _pthread_body
4   libsystem_pthread.dylib         0xfffea60dc50d      _pthread_start
5   libsystem_pthread.dylib         0xfffea60dbbf9      thread_start

Thread 11 name: SentryCrash Exception Handler (Secondary)
0   libsystem_kernel.dylib          0xfffea5d2a1fa      mach_msg_trap
1   Sentry                          0x10c5d7727         handleExceptions
2   libsystem_pthread.dylib         0xfffea60dc661      _pthread_body
3   libsystem_pthread.dylib         0xfffea60dc50d      _pthread_start
4   libsystem_pthread.dylib         0xfffea60dbbf9      thread_start

Thread 13 name: com.apple.NSURLConnectionLoader
0   libsystem_kernel.dylib          0xfffea5d2a1fa      mach_msg_trap
1   CoreFoundation                  0xfffe55a3ddc5      __CFRunLoopServiceMachPort
2   CoreFoundation                  0xfffe55a3d117      __CFRunLoopRun
3   CoreFoundation                  0xfffe55a3c787      CFRunLoopRunSpecific
4   CFNetwork                       0xfffe53af7158      -[__CoreSchedulingSetRunnable runForever]
5   Foundation                      0xfffe59ce29d8      __NSThread__start__
6   libsystem_pthread.dylib         0xfffea60dc661      _pthread_body
7   libsystem_pthread.dylib         0xfffea60dc50d      _pthread_start
8   libsystem_pthread.dylib         0xfffea60dbbf9      thread_start

Thread 14
0   libsystem_kernel.dylib          0xfffea5d3428a      __workq_kernreturn
1   libsystem_pthread.dylib         0xfffea60dbbe9      start_wqthread

Thread 15
0   libsystem_kernel.dylib          0xfffea5d3428a      __workq_kernreturn
1   libsystem_pthread.dylib         0xfffea60dbbe9      start_wqthread

Thread 16
0   FlutterMacOS                    0x10cf9545b         minikin::LayoutCache::operator()
1   FlutterMacOS                    0x10cf9568e         android::LruCache<T>::clear
2   FlutterMacOS                    0x10cf951af         minikin::Layout::purgeCaches
3   FlutterMacOS                    0x10cf9aef1         txt::FontCollection::~FontCollection
4   FlutterMacOS                    0x10cfa5fba         txt::ParagraphTxt::~ParagraphTxt
5   FlutterMacOS                    0x10cfa603c         txt::ParagraphTxt::~ParagraphTxt
6   FlutterMacOS                    0x10d0ae3b8         flutter::Paragraph::~Paragraph
7   FlutterMacOS                    0x10d2d5fd8         dart::FinalizablePersistentHandle::Finalize
8   FlutterMacOS                    0x10d170cad         dart::IsolateGroup::~IsolateGroup
9   FlutterMacOS                    0x10d17151d         dart::IsolateGroup::Shutdown
10  FlutterMacOS                    0x10d234b88         dart::ThreadPool::WorkerLoop
11  FlutterMacOS                    0x10d234eaf         dart::ThreadPool::Worker::Main
12  FlutterMacOS                    0x10d1ed2a5         dart::ThreadStart
13  libsystem_pthread.dylib         0xfffea60dc661      _pthread_body
14  libsystem_pthread.dylib         0xfffea60dc50d      _pthread_start
15  libsystem_pthread.dylib         0xfffea60dbbf9      thread_start



EOF
@cuishijie1991
Copy link
Author

cuishijie1991 commented Aug 5, 2022

This crash occurs multiple times on different versions of the Mac。
this is the flutter info of my package Mac

flutter doctor -v
[✓] Flutter (Channel stable, 3.0.5, on macOS 11.6.1 20G224 darwin-x64, locale zh-Hans-CN)
    • Flutter version 3.0.5 at /Users/mac/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f1875d570e (3 周前), 2022-07-13 11:24:16 -0700
    • Engine revision e85ea0e79c
    • Dart version 2.17.6
    • DevTools version 2.12.2
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[!] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/mac/Library/Android/sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

[✓] Xcode - develop for iOS and macOS (Xcode 13.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] IntelliJ IDEA Ultimate Edition (version 2019.3.3)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin version 45.1.2
    • Dart plugin version 193.7547

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 11.6.1 20G224 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 103.0.5060.134

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.

@danagbemava-nc danagbemava-nc added the in triage Presently being triaged by the triage team label Aug 5, 2022
@danagbemava-nc
Copy link
Member

danagbemava-nc commented Aug 5, 2022

Hi @cuishijie1991, are you able to reproduce this locally?

Labeling for further investigation

@danagbemava-nc danagbemava-nc added engine flutter/engine repository. See also e: labels. c: crash Stack traces logged to the console platform-mac Building on or for macOS specifically a: production Issues experienced in live production apps needs repro info Automated crash report whose cause isn't yet known and removed engine flutter/engine repository. See also e: labels. in triage Presently being triaged by the triage team labels Aug 5, 2022
@cuishijie1991
Copy link
Author

Hi @cuishijie1991, are you able to reproduce this locally?

Labeling for further investigation

I'm sorry I can't reproduce it locally, but it's there. Now hopefully, people with the same problem will see more information about the bug

@zanderso zanderso added the P2 Important issues not at the top of the work list label Aug 8, 2022
@dnfield
Copy link
Contributor

dnfield commented Aug 8, 2022

@iskakaushik do you know why OpenGL would be used here? I was under the impression Metal is the default for macOS.

This is a bug that likely would not exist in the Metal backend and is GL specific. I think we're on a path to getting rid of GL support entirely from macOS.

@dnfield
Copy link
Contributor

dnfield commented Aug 8, 2022

FWIW, this is a crash happening at engine shutdown. We shouldn't let this happen but it's likely not severely impacting your users.

@iskakaushik
Copy link
Contributor

Just checked, Metal is the default on macOS versions >= 10.14, see: https://github.com/flutter/engine/blob/main/shell/platform/darwin/macos/framework/Source/FlutterRenderingBackend.mm#L14.

Seems like this is an issue on:

OS Version: macOS 10.13.6 (17G14042)
Report Version: 104

@iskakaushik
Copy link
Contributor

@dnfield I think the direction we should head towards is to delete the support of OpenGL on macOS. I am not sure what the timeline for it should be though.

@dnfield
Copy link
Contributor

dnfield commented Aug 8, 2022

Yes, @cbracken has an RFC somewhere to drop support for macOS 10.13. Although perhaps this is an example of why we can't do that?

I'm not familiar enough with Metal on macOS to know why/whether we could lower support there, although if we're dropping support for 10.13 it won't make sense to...

@jmagman might have good thoughts on this too.

@jmagman
Copy link
Member

jmagman commented Aug 8, 2022

go/flutter-deprecating-old-platforms would be the RFC template for dropping 10.13, which I'm guessing is what @cbracken is working on. Dropping macOS 10.11-10.12 had no such process, I believe decision was entirely driven by updating libcxx flutter/buildroot#588, and I only became aware of it after coming back from vacation and seeing some old chat messages about it, so I filed #107741 to track the work more closely.

See more thoughts re dropping macOS 10.13 at flutter/engine#34919 (comment)

@cbracken
Copy link
Member

Yep - I am indeed working on an RFC for bumping the supported minimum macOS to 10.14, which would then permit us to drop GL support while still supporting hardware back to 2012. Based on the numbers, it looks like pre-10.14 users make up between 2.5-5% of machines.

In terms of tool telemetry, which admittedly only covers developers and not end users, I found zero hits from 10.14 machines since January.

@flutter-triage-bot flutter-triage-bot bot added team-engine Owned by Engine team triaged-engine Triaged by Engine team labels Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: production Issues experienced in live production apps c: crash Stack traces logged to the console engine flutter/engine repository. See also e: labels. needs repro info Automated crash report whose cause isn't yet known P2 Important issues not at the top of the work list platform-mac Building on or for macOS specifically team-engine Owned by Engine team triaged-engine Triaged by Engine team
Projects
None yet
Development

No branches or pull requests

7 participants