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

[Regression][iOS]: os.activity library is broken in Flutter 2.13 (beta and master) #102330

Closed
fuzzybinary opened this issue Apr 21, 2022 · 12 comments
Labels
c: regression It was better in the past than it is now engine flutter/engine repository. See also e: labels. found in release: 2.13 Found to occur in 2.13 has reproducible steps The issue has been confirmed reproducible and is ready to work on P2 Important issues not at the top of the work list platform-ios iOS applications specifically r: invalid Issue is closed as not valid

Comments

@fuzzybinary
Copy link
Contributor

We use the os.activity library in a plugin on iOS, and when testing with Flutter 2.13 I've found that calls to os_activity_get_identifier(OS_ACTIVITY_CURRENT) no longer properly returns the current activity (it always returns zero).

Minimal example is here:
https://github.com/fuzzybinary/flutter_os_activity_example

In testing, it appears that immediate calls to os_activity_get_identifier(OS_ACTIVITY_CURRENT) work, but something about the transition from native to dart and back causes the current activity to get lost.

I've not tested with anything other than stable channel and beta channel, so I don't know when exactly this might have broken.

@darshankawar darshankawar added the in triage Presently being triaged by the triage team label Apr 22, 2022
@darshankawar
Copy link
Member

Thanks for the report. Below is the observed result after verifying the code sample on all latest versions:

  1. Master 2.13.0-0.0.pre.680:
flutter: Results:
Created activity 9223372036854856084
Result with that activity in scope: [0, 0]
Created activity 9223372036854856218
Result with that activity in scope [0, 0]
  1. Stable (2.10.5):
flutter: Results:
Created activity 9223372036854870724
Result with that activity in scope: [9223372036854870724, 0]
Created activity 9223372036854870733
Result with that activity in scope [9223372036854870733, 9223372036854870724]
  1. Beta (2.13.0-0.1.pre and 2.13.0-0.2.pre):
flutter: Results:
Created activity 9223372036854886740
Result with that activity in scope: [0, 0]
Created activity 9223372036854886742
Result with that activity in scope [0, 0]



flutter: Results:
Created activity 9223372036854906484
Result with that activity in scope: [0, 0]
Created activity 9223372036854906486
Result with that activity in scope [0, 0]

Indicating the expected result currently works only on latest stable but not on other latest versions:

stable, master and beta flutter doctor -v

[✓] Flutter (Channel stable, 2.10.5, on macOS 12.2.1 21D62 darwin-x64, locale
    en-GB)
    • Flutter version 2.10.5 at /Users/dhs/documents/fluttersdk/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 5464c5bac7 (12 hours ago), 2022-04-18 09:55:37 -0700
    • Engine revision 57d3bac3dd
    • Dart version 2.16.2
    • DevTools version 2.9.2

[!] Xcode - develop for iOS and macOS (Xcode 12.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    ! Flutter recommends a minimum Xcode version of 13.
      Download the latest version or update via the Mac App Store.
    • CocoaPods version 1.11.2

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

[✓] VS Code (version 1.62.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.21.0

[✓] Connected device (5 available)
    • SM G975F (mobile)       • RZ8M802WY0X • android-arm64   • Android 11 (API 30)
    • Darshan's iphone (mobile)  • 21150b119064aecc249dfcfe05e259197461ce23 •
      ios            • iOS 14.4.1 18D61
    • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729     •
      ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
    • macOS (desktop)            • macos                                    •
      darwin-x64     • Mac OS X 10.15.4 19E2269 darwin-x64
    • Chrome (web)               • chrome                                   •
      web-javascript • Google Chrome 98.0.4758.80

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

! Doctor found issues in 1 category.

[✓] Flutter (Channel master, 2.13.0-0.0.pre.680, on macOS 12.2.1 21D62
    darwin-x64, locale en-GB)
    • Flutter version 2.13.0-0.0.pre.680 at
      /Users/dhs/documents/fluttersdk/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 0d9c51c732 (2 hours ago), 2022-04-21 22:49:07 -0400
    • Engine revision c6ea046c2c
    • Dart version 2.18.0 (build 2.18.0-43.0.dev)
    • DevTools version 2.12.2
    
[!] Xcode - develop for iOS and macOS (Xcode 12.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    ! Flutter recommends a minimum Xcode version of 13.
      Download the latest version or update via the Mac App Store.
    • CocoaPods version 1.11.2

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

[✓] VS Code (version 1.62.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.21.0

[✓] Connected device (5 available)
    • SM G975F (mobile)       • RZ8M802WY0X • android-arm64   • Android 11 (API 30)
    • Darshan's iphone (mobile)  • 21150b119064aecc249dfcfe05e259197461ce23 •
      ios            • iOS 14.4.1 18D61
    • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729     •
      ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
    • macOS (desktop)            • macos                                    •
      darwin-x64     • Mac OS X 10.15.4 19E2269 darwin-x64
    • Chrome (web)               • chrome                                   •
      web-javascript • Google Chrome 98.0.4758.80

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

! Doctor found issues in 1 category.

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, 2.13.0-0.1.pre, on macOS 12.2.1 21D62 darwin-x64,
    locale en-GB)
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
[✓] Chrome - develop for the web
[✓] IntelliJ IDEA Ultimate Edition (version 2021.3.2)
[✓] VS Code (version 1.62.0)
[✓] Connected device (3 available)
[✓] HTTP Host Availability



Labeling it as regression.

@darshankawar darshankawar added platform-ios iOS applications specifically framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on found in release: 2.13 Found to occur in 2.13 c: regression It was better in the past than it is now engine flutter/engine repository. See also e: labels. and removed in triage Presently being triaged by the triage team labels Apr 22, 2022
@darshankawar darshankawar changed the title iOS os.activity library is broken in Flutter 2.13 (beta) [Regression][iOS]: os.activity library is broken in Flutter 2.13 Apr 22, 2022
@darshankawar darshankawar changed the title [Regression][iOS]: os.activity library is broken in Flutter 2.13 [Regression][iOS]: os.activity library is broken in Flutter 2.13 (beta and master) Apr 22, 2022
@jmagman
Copy link
Member

jmagman commented Apr 22, 2022

Thanks for the good repro @fuzzybinary
Bisected to engine roll #96542. @gaaclarke that included flutter/engine#30697

@jmagman jmagman removed the framework flutter/packages/flutter repository. See also f: labels. label Apr 22, 2022
@gaaclarke
Copy link
Member

gaaclarke commented Apr 22, 2022

The reproduction code is using an apple private API, _os_activity_create. Can you recreate the problem when using public APIs?

edit: don't forget _os_activity_current too which is private.

@gaaclarke
Copy link
Member

I put print statements around those handlers and nothing seems out of line or on a weird thread. That bisected engine roll also contains an update to the mac sdk, so if we are doing something cheesy with private APIs, that could have been broken too. Having reproduction code on public APIs will clear that up.

@jmagman
Copy link
Member

jmagman commented Apr 22, 2022

Having reproduction code on public APIs will clear that up.

Here's an example that calls the os_activity_create and OS_ACTIVITY_CURRENT macros from Objective-C:
fuzzybinary/flutter_os_activity_example#1

@chinmaygarde
Copy link
Member

Is this an engine issue? The PR @jmagman linked changes the thread on which platform channels code is executed but the default is remains the same. There could be changes related to timing however.

@chinmaygarde chinmaygarde added the P2 Important issues not at the top of the work list label Apr 25, 2022
@gaaclarke
Copy link
Member

Is this an engine issue? The PR @jmagman linked changes the thread on which platform channels code is executed but the default is remains the same. There could be changes related to timing however.

It's not a timing issue since I've verified with print statements they are happening in the correct order. It's not a data transmission problem since the results getting sent to Dart are the same that the native function are returning. I suspect something weird happened when we updated the SDK. I plan on giving it another look this afternoon with jen's code.

@gaaclarke
Copy link
Member

I ran the sample code with the following patch to Jenn's sample code. I separately verified that all handlers are happening on the main thread. This is not matter of platform channels misbehaving, they are receiving and reporting data correctly and in order. It's just that OS_ACTIVITY_CURRENT isn't giving us the values we would have expected.

Patch

diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift
index 45d2855..917a6e3 100644
--- a/ios/Runner/AppDelegate.swift
+++ b/ios/Runner/AppDelegate.swift
@@ -42,7 +42,8 @@ class ActivityReference {
 
       let activityIdString = String(activityIdInt)
       activityMap[activityIdString] = activityRef
-
+            
+      NSLog("createActivity: ()=>(%@, %@)", String(describing: activityRef.activity), activityIdString);
       result(activityIdString)
 
     case "enterScope":
@@ -50,6 +51,7 @@ class ActivityReference {
       if let activityId = args["activityId"] as? String,
          let activityRef = activityMap[activityId] {
         os_activity_scope_enter(activityRef.activity!, &activityRef.activityState)
+        NSLog("enterScope: (%@, %@)=>nil", String(describing: activityRef.activity), String(describing: activityRef.activityState));
       }
       result(nil)
 
@@ -57,6 +59,7 @@ class ActivityReference {
       var parentIdent: os_activity_id_t = 0
       let activityIdent = os_activity_get_identifier(CurrentActivity(), &parentIdent)
 
+      NSLog("getCurrentActivity: (%@)=>[%@, %@]", String(describing: CurrentActivity()), String(activityIdent), String(parentIdent));
       result([String(activityIdent), String(parentIdent)])
 
     case "leaveScope":
@@ -64,6 +67,7 @@ class ActivityReference {
       if let activityId = args["activityId"] as? String,
          let activityRef = activityMap[activityId] {
         os_activity_scope_leave(&activityRef.activityState)
+        NSLog("leaveScope: (%@, %d)=>nil", activityId, ObjectIdentifier(activityRef).hashValue)
       }
       result(nil)

Stable

2022-04-25 15:18:29.857292-0700 Runner[83132:3625610] createActivity: ()=>(Optional(<OS_voucher: voucher[0x2821d8230] = { xref = 7, ref = 1, activity 0x80000000003c0d15 (pid: 0x           144bc, parent 0x0) }>), 9223372036858711317)
2022-04-25 15:18:30.053558-0700 Runner[83132:3625610] enterScope: (Optional(<OS_voucher: voucher[0x2821d8230] = { xref = 8, ref = 1, activity 0x80000000003c0d15 (pid: 0x           144bc, parent 0x0) }>), os_activity_scope_state_s(opaque: (9223372036858711317, 0)))=>nil
2022-04-25 15:18:30.075010-0700 Runner[83132:3625610] getCurrentActivity: (Optional(<OS_os_activity: 0x1ee7dfb70>))=>[9223372036858711317, 0]
2022-04-25 15:18:32.084012-0700 Runner[83132:3625610] createActivity: ()=>(Optional(<OS_voucher: voucher[0x2821bcc30] = { xref = 7, ref = 1, activity 0x80000000003c0d1c (pid: 0x           144bc, parent 0x80000000003c0d15) }>), 9223372036858711324)
2022-04-25 15:18:32.085343-0700 Runner[83132:3625610] enterScope: (Optional(<OS_voucher: voucher[0x2821bcc30] = { xref = 8, ref = 1, activity 0x80000000003c0d1c (pid: 0x           144bc, parent 0x80000000003c0d15) }>), os_activity_scope_state_s(opaque: (9223372036858711324, 10772906544)))=>nil
2022-04-25 15:18:32.085970-0700 Runner[83132:3625610] getCurrentActivity: (Optional(<OS_os_activity: 0x1ee7dfb70>))=>[9223372036858711324, 9223372036858711317]
2022-04-25 15:18:34.094171-0700 Runner[83132:3625610] leaveScope: (9223372036858711324, 637274227)=>nil
2022-04-25 15:18:34.094471-0700 Runner[83132:3625610] leaveScope: (9223372036858711317, -922885012)=>nil

Master

2022-04-25 15:11:55.321264-0700 Runner[83079:3622373] createActivity: ()=>(Optional(<OS_voucher: voucher[0x283a6c320] = { xref = 7, ref = 1, activity 0x80000000003bfab5 (pid: 0x           14487, parent 0x0) }>), 9223372036858706613)
2022-04-25 15:11:55.496882-0700 Runner[83079:3622373] enterScope: (Optional(<OS_voucher: voucher[0x283a6c320] = { xref = 8, ref = 1, activity 0x80000000003bfab5 (pid: 0x           14487, parent 0x0) }>), os_activity_scope_state_s(opaque: (9223372036858706613, 0)))=>nil
2022-04-25 15:11:55.498809-0700 Runner[83079:3622373] getCurrentActivity: (Optional(<OS_os_activity: 0x1ee7dfb70>))=>[0, 0]
2022-04-25 15:11:57.506428-0700 Runner[83079:3622373] createActivity: ()=>(Optional(<OS_voucher: voucher[0x283a314a0] = { xref = 7, ref = 1, activity 0x80000000003bfab9 (pid: 0x           14487, parent 0x0) }>), 9223372036858706617)
2022-04-25 15:11:57.510017-0700 Runner[83079:3622373] enterScope: (Optional(<OS_voucher: voucher[0x283a314a0] = { xref = 8, ref = 1, activity 0x80000000003bfab9 (pid: 0x           14487, parent 0x0) }>), os_activity_scope_state_s(opaque: (9223372036858706617, 0)))=>nil
2022-04-25 15:11:57.510568-0700 Runner[83079:3622373] getCurrentActivity: (Optional(<OS_os_activity: 0x1ee7dfb70>))=>[0, 0]
2022-04-25 15:11:59.517760-0700 Runner[83079:3622373] leaveScope: (9223372036858706617, -1492277356)=>nil
2022-04-25 15:11:59.518329-0700 Runner[83079:3622373] leaveScope: (9223372036858706613, -2029376843)=>nil

@gaaclarke
Copy link
Member

I put a breakpoint in rbreak ^os_activity.* and found out there is other code setting the os_activity. This API deals with global data so this is expected, here is an example call to os_activity_scope_enter:

(lldb) bt
* thread #9, name = 'io.flutter.1.raster', queue = 'compiler request queue', stop reason = breakpoint 2.14
  * frame #0: 0x00000001afbcd848 libsystem_trace.dylib`os_activity_scope_enter
    frame #1: 0x00000001af751914 Metal`XPCCompilerConnection::BuildRequestInternal(MTLCompilerRequest*, char const*, NSObject<OS_dispatch_data>*, int, bool, void (unsigned int, void const*, unsigned long, char const*) block_pointer) + 120
    frame #2: 0x00000001af763974 Metal`invocation function for block in XPCCompilerConnection::BuildRequest(MTLCompilerRequest*, char const*, NSObject<OS_dispatch_data>*, int, bool, void (unsigned int, void const*, unsigned long, char const*) block_pointer) + 64
    frame #3: 0x00000001047de7bc libdispatch.dylib`_dispatch_client_callout + 20
    frame #4: 0x00000001047efca8 libdispatch.dylib`_dispatch_lane_barrier_sync_invoke_and_complete + 172
    frame #5: 0x00000001af760abc Metal`XPCCompilerConnection::BuildRequest(MTLCompilerRequest*, char const*, NSObject<OS_dispatch_data>*, int, bool, void (unsigned int, void const*, unsigned long, char const*) block_pointer) + 136
    frame #6: 0x00000001af76baa0 Metal`MTLCompilerConnectionManagerPrivate::buildRequest(unsigned int, MTLCompilerRequest*, bool, void (MTLCompilerError, NSObject<OS_dispatch_data>*, char const*) block_pointer) + 392
    frame #7: 0x00000001af752c08 Metal`-[MTLCompiler compileRequest:pipelineCache:sync:completionHandler:] + 616
    frame #8: 0x0000000207274d98 AGXMetalA13`___lldb_unnamed_symbol1138$$AGXMetalA13 + 1908
    frame #9: 0x000000020722f614 AGXMetalA13`___lldb_unnamed_symbol357$$AGXMetalA13 + 1512
    frame #10: 0x0000000207224bf4 AGXMetalA13`___lldb_unnamed_symbol282$$AGXMetalA13 + 1408
    frame #11: 0x00000002072295fc AGXMetalA13`___lldb_unnamed_symbol307$$AGXMetalA13 + 132
    frame #12: 0x00000001f67bea20 MetalTools`-[MTLDebugBlitCommandEncoder copyFromBuffer:sourceOffset:sourceBytesPerRow:sourceBytesPerImage:sourceSize:toTexture:destinationSlice:destinationLevel:destinationOrigin:] + 408
    frame #13: 0x0000000106f421b8 Flutter`GrMtlGpu::onWritePixels(GrSurface*, SkIRect, GrColorType, GrColorType, GrMipLevel const*, int, bool) + 1000
    frame #14: 0x0000000106e5e788 Flutter`GrGpu::writePixels(GrSurface*, SkIRect, GrColorType, GrColorType, GrMipLevel const*, int, bool) + 420
    frame #15: 0x0000000106e6c5c0 Flutter`GrResourceProvider::createTexture(SkISize, GrBackendFormat const&, GrTextureType, GrColorType, GrRenderable, int, SkBudgeted, GrMipmapped, GrProtected, GrMipLevel const*) + 1236
    frame #16: 0x0000000106e64dd8 Flutter`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&) + 196
    frame #17: 0x0000000106e702a4 Flutter`GrSurfaceProxyPriv::doLazyInstantiation(GrResourceProvider*) + 156
    frame #18: 0x0000000106eb37c4 Flutter`make_bmp_proxy(GrProxyProvider*, SkBitmap const&, GrColorType, GrMipmapped, SkBackingFit, SkBudgeted) + 1592
    frame #19: 0x0000000106eb3910 Flutter`GrMakeUncachedBitmapProxyView(GrRecordingContext*, SkBitmap const&, GrMipmapped, SkBackingFit, SkBudgeted) + 184
    frame #20: 0x0000000106eefdac Flutter`skgpu::v1::ShadowRRectOp::Make(GrRecordingContext*, unsigned int, SkMatrix const&, SkRRect const&, float, float) + 632
    frame #21: 0x0000000106f0d4a8 Flutter`skgpu::v1::Device::drawShadow(SkPath const&, SkDrawShadowRec const&) + 1448
    frame #22: 0x0000000106d24828 Flutter`SkCanvas::private_draw_shadow_rec(SkPath const&, SkDrawShadowRec const&) + 200
    frame #23: 0x0000000107167628 Flutter`flutter::DisplayListCanvasDispatcher::DrawShadow(SkCanvas*, SkPath const&, unsigned int, float, bool, float) + 484
    frame #24: 0x0000000107157e10 Flutter`flutter::PhysicalShapeLayer::Paint(flutter::Layer::PaintContext&) const + 84
    frame #25: 0x0000000107153558 Flutter`flutter::ContainerLayer::PaintChildren(flutter::Layer::PaintContext&) const + 72
    frame #26: 0x0000000107157f54 Flutter`flutter::PhysicalShapeLayer::Paint(flutter::Layer::PaintContext&) const + 408
    frame #27: 0x0000000107153558 Flutter`flutter::ContainerLayer::PaintChildren(flutter::Layer::PaintContext&) const + 72
    frame #28: 0x0000000107159a80 Flutter`flutter::TransformLayer::Paint(flutter::Layer::PaintContext&) const + 92
    frame #29: 0x0000000107153558 Flutter`flutter::ContainerLayer::PaintChildren(flutter::Layer::PaintContext&) const + 72
    frame #30: 0x0000000107159a80 Flutter`flutter::TransformLayer::Paint(flutter::Layer::PaintContext&) const + 92
    frame #31: 0x0000000107153558 Flutter`flutter::ContainerLayer::PaintChildren(flutter::Layer::PaintContext&) const + 72
    frame #32: 0x0000000107159a80 Flutter`flutter::TransformLayer::Paint(flutter::Layer::PaintContext&) const + 92
    frame #33: 0x0000000107153558 Flutter`flutter::ContainerLayer::PaintChildren(flutter::Layer::PaintContext&) const + 72
    frame #34: 0x00000001071500a8 Flutter`flutter::CompositorContext::ScopedFrame::Raster(flutter::LayerTree&, bool, flutter::FrameDamage*) + 3252
    frame #35: 0x0000000107095f6c Flutter`flutter::Rasterizer::DrawToSurfaceUnsafe(flutter::FrameTimingsRecorder&, flutter::LayerTree&) + 884
    frame #36: 0x000000010709696c Flutter`std::__1::__function::__func<flutter::Rasterizer::DrawToSurface(flutter::FrameTimingsRecorder&, flutter::LayerTree&)::$_8, std::__1::allocator<flutter::Rasterizer::DrawToSurface(flutter::FrameTimingsRecorder&, flutter::LayerTree&)::$_8>, void ()>::operator()() + 28
    frame #37: 0x0000000106fbab3c Flutter`fml::SyncSwitch::Execute(fml::SyncSwitch::Handlers const&) const + 72
    frame #38: 0x0000000107095ad8 Flutter`flutter::Rasterizer::DrawToSurface(flutter::FrameTimingsRecorder&, flutter::LayerTree&) + 296
    frame #39: 0x0000000107097a90 Flutter`std::__1::__function::__func<flutter::Rasterizer::Draw(std::__1::unique_ptr<flutter::FrameTimingsRecorder, std::__1::default_delete<flutter::FrameTimingsRecorder> >, std::__1::shared_ptr<flutter::Pipeline<flutter::LayerTree> >, std::__1::function<bool (flutter::LayerTree&)>)::$_2, std::__1::allocator<flutter::Rasterizer::Draw(std::__1::unique_ptr<flutter::FrameTimingsRecorder, std::__1::default_delete<flutter::FrameTimingsRecorder> >, std::__1::shared_ptr<flutter::Pipeline<flutter::LayerTree> >, std::__1::function<bool (flutter::LayerTree&)>)::$_2>, void (std::__1::unique_ptr<flutter::LayerTree, std::__1::default_delete<flutter::LayerTree> >)>::operator()(std::__1::unique_ptr<flutter::LayerTree, std::__1::default_delete<flutter::LayerTree> >&&) + 160
    frame #40: 0x0000000107096c60 Flutter`flutter::Rasterizer::Draw(std::__1::unique_ptr<flutter::FrameTimingsRecorder, std::__1::default_delete<flutter::FrameTimingsRecorder> >, std::__1::shared_ptr<flutter::Pipeline<flutter::LayerTree> >, std::__1::function<bool (flutter::LayerTree&)>) + 628
    frame #41: 0x00000001070a1548 Flutter`std::__1::__function::__func<fml::internal::CopyableLambda<flutter::Shell::OnAnimatorDraw(std::__1::shared_ptr<flutter::Pipeline<flutter::LayerTree> >, std::__1::unique_ptr<flutter::FrameTimingsRecorder, std::__1::default_delete<flutter::FrameTimingsRecorder> >)::$_13>, std::__1::allocator<fml::internal::CopyableLambda<flutter::Shell::OnAnimatorDraw(std::__1::shared_ptr<flutter::Pipeline<flutter::LayerTree> >, std::__1::unique_ptr<flutter::FrameTimingsRecorder, std::__1::default_delete<flutter::FrameTimingsRecorder> >)::$_13> >, void ()>::operator()() + 164
    frame #42: 0x0000000106fb93a4 Flutter`fml::MessageLoopImpl::FlushTasks(fml::FlushType) + 1608
    frame #43: 0x0000000106fbcf94 Flutter`fml::MessageLoopDarwin::OnTimerFire(__CFRunLoopTimer*, fml::MessageLoopDarwin*) + 32
    frame #44: 0x0000000194e1a168 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 32
    frame #45: 0x0000000194d9e144 CoreFoundation`__CFRunLoopDoTimer + 1064
    frame #46: 0x0000000194d988f0 CoreFoundation`__CFRunLoopDoTimers + 320
    frame #47: 0x0000000194d76fa0 CoreFoundation`__CFRunLoopRun + 1936
    frame #48: 0x0000000194d8a6b8 CoreFoundation`CFRunLoopRunSpecific + 600
    frame #49: 0x0000000106fbce64 Flutter`fml::MessageLoopDarwin::Run() + 88
    frame #50: 0x0000000106fbbe94 Flutter`void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, fml::Thread::Thread(std::__1::function<void (fml::Thread::ThreadConfig const&)> const&, fml::Thread::ThreadConfig const&)::$_0> >(void*) + 208
    frame #51: 0x0000000205e129ac libsystem_pthread.dylib`_pthread_start + 148

I'm going to close this as works as intended since the engine is working as expected and the difference in expected output is an artifact of using an API that operates with global variables that may be accessed by anyone at any time. In this case it looks like maybe the Metal shader compiler. The compiler is placing that in our binary, the call to os_activity_scope_enter doesn't actually exist in the source code for the engine.

@fuzzybinary
Copy link
Contributor Author

@gaaclarke Just so I'm clear -- what you're saying is that this isn't a bug in the Flutter engine, since you aren't using the os.actvity library, but more likely a bug in the iOS SDK / Metal Shader Compiler that broke with the most recent SDK update?

@darshankawar darshankawar added the r: invalid Issue is closed as not valid label Apr 26, 2022
@gaaclarke
Copy link
Member

@gaaclarke Just so I'm clear -- what you're saying is that this isn't a bug in the Flutter engine, since you aren't using the os.actvity library, but more likely a bug in the iOS SDK / Metal Shader Compiler that broke with the most recent SDK update?

It's true that the fiddling of that global data isn't happening explicitly in our code, it is something that is happening without our direction as a result of shader compilation. I'm not certain if Apple would consider it a bug.

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
c: regression It was better in the past than it is now engine flutter/engine repository. See also e: labels. found in release: 2.13 Found to occur in 2.13 has reproducible steps The issue has been confirmed reproducible and is ready to work on P2 Important issues not at the top of the work list platform-ios iOS applications specifically r: invalid Issue is closed as not valid
Projects
None yet
Development

No branches or pull requests

5 participants