-
Notifications
You must be signed in to change notification settings - Fork 27.2k
-
Notifications
You must be signed in to change notification settings - Fork 27.2k
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
Comments
Thanks for the report. Below is the observed result after verifying the code sample on all latest versions:
Indicating the expected result currently works only on latest stable but not on other latest versions: stable, master and beta flutter doctor -v
Labeling it as regression. |
Thanks for the good repro @fuzzybinary |
The reproduction code is using an apple private API, edit: don't forget |
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. |
Here's an example that calls the |
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. |
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 Patchdiff --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
Master
|
I put a breakpoint in
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 |
@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. |
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 |
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.
The text was updated successfully, but these errors were encountered: