You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sadly we can't reproduce that but in prod, there are 10% of the traces of our MainActivity which have invalid duration (more than 10min up to 30h) ...
No, we didn't disable io.sentry.traces.activity.auto-finish.enable.
@marandaneto It seems to be because the lib wait for the child traces to finish before stoping the transaction (waitForChildren) and the child trace from FragmentLifecycleIntegration never ends.
It's due to NavDeepLinkBuilder, when the deep link is triggered, the destination and all of its parents will be on the back stack. But for its parents, only onCreate is called but not onResume. So the HomeFragment transaction never finished.
but in LaunchActivity, you set .setDestination(R.id.navigation_fragment_home), so HomeFragment isn't even visible or anything, looks like a wrong setup of the navigation-ui rather than the bug in Sentry SDK.
do setDestination and app:startDestination must match or not? didn't find docs for that, if they don't have to, maybe fixing on the SDK would make more sense.
but in LaunchActivity, you set .setDestination(R.id.navigation_fragment_home), so HomeFragment isn't even visible or anything, looks like a wrong setup of the navigation-ui rather than the bug in Sentry SDK.
I don't understand what you mean, I set .setDestination(R.id.navigation_fragment_chat) no .setDestination(R.id.navigation_fragment_home) so it's normal if HomeFragment isn't visible
do setDestination and app:startDestination must match or not? didn't find docs for that, if they don't have to, maybe fixing on the SDK would make more sense.
No, the purpose is to navigate to a specific destination (not the start destination) while adding the start destination to the backstack.
When this deep link is triggered:
The task is cleared.
The destination and all of its parents will be on the back stack.
[...]
The parent of the destination is the start destination of the containing navigation graph.
sorry it was a typo, .setDestination(R.id.navigation_fragment_chat) indeed.
No, the purpose is to navigate to a specific destination (not the start destination) while adding the start destination to the backstack.
got it, that makes sense, since the fragment does not trigger any other lifecycle, I don't really know how to finish the span automatically for that case, ideas?
But I think there are others issues with the auto tracing activity that doesn't seem to be related to waitForChildren. For now I didn't managed to reproduce this case
or
App Startup - MainActivity#onCreate is a custom child span added to measure our onCreate implementation
@LouisYubo it could be related to opening the App thru notifications, mind testing that out? at least the sample that you have given is fixed, please raise a new issue with more detailed use case for the other one, also a minimal reproducible example would help as it did with this one, thanks a lot.
Activity
marandaneto commentedon Oct 29, 2021
@LouisFN thanks for reporting.
can you reproduce that?
https://docs.sentry.io/platforms/android/performance/instrumentation/automatic-instrumentation/#androids-activity-instrumentation
did you disable the
io.sentry.traces.activity.auto-finish.enableconfig or is it enabled as it is by default?can you give some more context? thanks
louis-fri commentedon Oct 29, 2021
Sadly we can't reproduce that but in prod, there are 10% of the traces of our MainActivity which have invalid duration (more than 10min up to 30h) ...
No, we didn't disable
io.sentry.traces.activity.auto-finish.enable.marandaneto commentedon Oct 29, 2021
@LouisFN did you find any pattern from this 10% of traces? like OS version, Device brand, or something.
I can't reproduce it either.
LouisYubo commentedon Oct 29, 2021
No, we didn't find any pattern, it occurs on different android version and devices.
marandaneto commentedon Nov 5, 2021
@LouisYubo I can't really reproduce it, not sure how to proceed, any ideas on how to reproduce otherwise I'd have to close it.
marandaneto commentedon Nov 16, 2021
@LouisFN does your app have notifications? is it possible that users open your app via notification?
louis-fri commentedon Nov 16, 2021
@marandaneto Completely, I can reproduce it by opening the app from notification
marandaneto commentedon Nov 16, 2021
@LouisFN ok thats a good start, can you tell me the exact steps to reproduce it? or provide a minimal reproducible example? thanks
louis-fri commentedon Nov 16, 2021
@marandaneto It seems to be because the lib wait for the child traces to finish before stoping the transaction (waitForChildren) and the child trace from FragmentLifecycleIntegration never ends.
It's due to NavDeepLinkBuilder, when the deep link is triggered, the destination and all of its parents will be on the back stack. But for its parents, only onCreate is called but not onResume. So the HomeFragment transaction never finished.
You can find a reproducible example here:
https://github.com/LouisFn/SentryFrozenFrame
BTW, I think it would be usefull to add an option to disable "waitForChildren"
marandaneto commentedon Nov 16, 2021
will have a look, thanks
2 remaining items
marandaneto commentedon Nov 17, 2021
I can confirm that
HomeFragmentisn't callingonFragmentResumedmarandaneto commentedon Nov 17, 2021
@LouisFN in your use case, maybe there's a bug in your example as well, you set:
app:startDestination="@id/navigation_fragment_home"but in
LaunchActivity, you set.setDestination(R.id.navigation_fragment_home), soHomeFragmentisn't even visible or anything, looks like a wrong setup of thenavigation-uirather than the bug in Sentry SDK.marandaneto commentedon Nov 17, 2021
do
setDestinationandapp:startDestinationmust match or not? didn't find docs for that, if they don't have to, maybe fixing on the SDK would make more sense.LouisYubo commentedon Nov 18, 2021
I don't understand what you mean, I set
.setDestination(R.id.navigation_fragment_chat)no.setDestination(R.id.navigation_fragment_home)so it's normal if HomeFragment isn't visibleNo, the purpose is to navigate to a specific destination (not the start destination) while adding the start destination to the backstack.
From the docs: https://developer.android.com/reference/androidx/navigation/NavDeepLinkBuilder
marandaneto commentedon Nov 18, 2021
sorry it was a typo,
.setDestination(R.id.navigation_fragment_chat)indeed.got it, that makes sense, since the fragment does not trigger any other lifecycle, I don't really know how to finish the span automatically for that case, ideas?
marandaneto commentedon Nov 18, 2021
even if I provide a custom
waitForChildren, how would you know ifHomeFragmentwas just added to the back stack but never visible, programmatically?LouisYubo commentedon Nov 18, 2021
I think, you might check if fragment
isAddedin onCreate before starting the trace ?marandaneto commentedon Nov 18, 2021
indeed @LouisYubo that's totally possible and it works, thanks for the tip, See PR #1813
LouisYubo commentedon Nov 18, 2021
@marandaneto Thanks a lot for the fix :)
But I think there are others issues with the auto tracing activity that doesn't seem to be related to
waitForChildren. For now I didn't managed to reproduce this caseor
App Startup - MainActivity#onCreate is a custom child span added to measure our onCreate implementation
marandaneto commentedon Nov 18, 2021
@LouisYubo it could be related to opening the App thru notifications, mind testing that out? at least the sample that you have given is fixed, please raise a new issue with more detailed use case for the other one, also a minimal reproducible example would help as it did with this one, thanks a lot.