-
Notifications
You must be signed in to change notification settings - Fork 1.3k
GPU/CPU usage problem - updateFromDisplayLink deadlock #15342
Comments
Hi, we face the same bug and this is truly a huge issue. We can't upgrade to SDK 5.x+ anymore because of this bug and insets bug (already opened somewhere else). This issue is not present on SDK 5.0. It appears on 5.1 and still there in 5.3.0 |
Thanks for the report @JustinGanzer. |
You're welcome. I deactivate user tracking so nothing should force the map to render once done. Tested on your sample app from the framework sources, seems that there is an infinite loop somewhere. |
Seems that |
Thanks for the detailed investigation - what lat/lons are you zooming in/out on? |
South West of Paris, France |
Are you able to try with a default Mapbox style? |
|
Thanks @RomainQuidet, @pozdnyakov is now going to investigate. |
I confirm that |
@RomainQuidet Thank you very much for your report and the investigation! I am looking at the issue. Meanwhile, would it be possible for you to try out a preliminary fix at #15600 and tell if it helps? Thanks! |
Of course I'll patch my version and see if the issue is still visible. Tomorrow for me it's the end of the day in France ;) |
@RomainQuidet @julianrex , In the original post I provided a small ViewController with nothing but a MapView and a SymbolStyleLayer (which seems to be the cause for the reaction) inside. No matter what tiles or what style is used, the issue will arise once zoomed in and out again. Thanks for the detailed investigation @RomainQuidet. It's a huge issue for us as well and hinders us from updating to 5.x. |
Hi @pozdnyakov, your patch #15600 seems to work on my tests. I don't see anymore the dead loop consuming CPU. |
@RomainQuidet Thanks! @JustinGanzer does #15600 solve the problem for you too? |
bad news, I can't reproduce the issue on my demo app but on our production app, the renderer is still stuck in a loop using 100% CPU... And there is a memory issue associated, it's creating data until the app is killed by the system. I'm investigating. @pozdnyakov This time the |
That's a different issue, investigating.. |
@RomainQuidet could you give some more details on how to reproduce #15342 (comment) ? |
I wish I could help you more on this one, but I can't reproduce it on my demo app. I'm trying. |
My speculative guess is that
|
Hi, Thanks for investigating this strange issue. |
Hi, neither 1st nor 2nd suggestions work. I can't apply your #15308 patch on my 5.3.0 branch there is too many conficts from the master branch. |
What is the inset bug blocking the upgrade? |
Could you please submit an issue with problem description: which API is used and, if possible a video presenting the issue? |
My intention in filing #15233 was to report the bug that the |
@RomainQuidet Hi, do you have any updates on the issue? #15308 has landed, is it feasible for you to try out current master branch? |
Hi, I was able to take some time to merge the master on our branch, unfortunately the infinite loop is still there, using 110+% of CPU. @pozdnyakov after further investigations, I was not able to reproduce the issue on a sample but our production app. |
@venkatchm - thanks for the report. do you have the same implementation as others in this thread? if not: in 5.4.0, we published a PR (#15308) as well as other performance improvements (e.g. #15600) that are intended to alleviate this problem. would you mind testing out 5.4.0 and seeing if you can reproduce the same problem? @RomainQuidet - thanks for the information, sorry to hear that your issue isn't fully resolved, we'll keep digging and we appreciate the help. |
@RomainQuidet it's hard to guess the exact reason just from the screen shot, however #15086 could be a speculative fix, in case the problem is caused with infinite loop of the map update inside a transition handler. Could you pls try it out? |
Hi
I tried the 5.4.0 release and had the same incorrect behavior (not an manual map usage but during Gps session). The cpu usage is too high and the app can’t update correctly.
I’ll try your patch as soon as possible.
Romain
… Le 22 oct. 2019 à 14:11, Mikhail Pozdnyakov ***@***.***> a écrit :
@RomainQuidet it's hard to guess the exact reason just from the screen shot, however #15086 could be a speculative fix, in case the problem is caused with infinite loop of the map update inside a transition handler. Could you pls try it out?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Could you please share the code for this - values used for insets and tracking before and after. Are both called from callbacks? How frequent the change of values happens?
Do you use navigation SDK here?
Do you still see updateFromDisplayLink called all the time? Thanks. |
Is your code also doing this? |
@astojilj We are not using navigation mapView. We render custom layers (MGLLineStyleLayer, MGLSymbolStyleLayer ) on the Map and we set the @chloekraw We see this issue in the 5.4.0 SDK. Here are the screenshots of Xcode Energy Organiser |
@venkatchm I am especially interested if there is tilt/pitch set, if edgePadding is supplied to setVisibleCoordinateBounds and if large top contentInset is used. Thanks. |
@JustinGanzer, To verify it, Swift code from original report is ported to ObjC and used in iosapp (it was convenient way for me to reproduce and debug it):
When using 5.1 release branch code, the issue is reproducible - with no interaction with the map, GPU consumption is high all the time: When using the latest master, this looks resolved. There is a chance that the issue you are facing is not related to the issue here: it is about constant GPU re-rendering and high GPU energy consumption (green boxes at the diagram), even there is no user interaction. Once you stop interaction with the map, does it still has high CPU/GPU usage like it was in initial report? if not, we would likely need to address the other issues as a new one and provide further information needed to reproduce them. The fact that you see the same code in trace is just about the fact that it is the hottest code path and it is expected - we need to figure out why it is triggered more than expected. Could you please provide more details about the style and layers your map has? If you could share this and some code, it would help us focusing on the problem. Thanks. |
@astojilj Funny coincidence but I had just tested the newest release on various devices from ios 12.0 all the way to 13.2 with xcode 11 and 11.2. The problem appears resolved as I can not reproduce the issue in the test controller provided in my original issue message, neither in our production app. Great job! I have however noticed a much much higher cpu usage now than before when applying a custom contentInset to the MGLMapView and animating the camera. I only mention this since you have expressed interest about it to venkatchm. I'll open a new issue once I've managed to create a reproduce-able instance of it. |
@JustinGanzer, |
Hello Mapbox community and team!
I'll be providing sample code of a ViewController with a MapView that when zoomed in to the lowest tiles and back up again somehow initiates a very odd behaviour starting with the Mapbox-iOS-SDK 5.1.0. Lower versions will not result in this error, higher versions such as 5.2.0 still do.
After zooming in and back out the gpu and cpu are constantly at roughly 60% usage and will never cease to go below this even though the I'm not interacting with the device in any way.
Due to the update being called over over, all MapAnnotations are constantly updated as well, which makes it impossible to use drag and drop as they flicker between the new and old position, which in comparison is only a minor inconvenience.
This error does not appear on an empty MapView. It only appears after adding a source and layer that I'd normally use to show icons on the map. I'll follow up this thread once I figure out what exactly is causing this issue. Do note however, that the very same code runs into no issues with any SDK version below 5.1.0 Hopefully someone can figure out what changed. As always, I'm happy to help try out whatever I can to help nail down the reason for error.
Steps to reproduce
Expected behavior
MapView will stop rendering things once no more updates are made, such as movement.
Actual behavior
MapView is called/calls updateFromDisplayLink over and over.
Configuration
Mapbox SDK versions:
5.1.0+ and up
iOS/macOS versions:
Tested only on 12.3 and up, sorry i didn't have older versions available.
Device/simulator models:
iPhone 5S simulated with 12.3.1
Xcode version:
Version 10.2.1 (10E1001)
Here the inverted call stack:
Result in SDK versions 5.1.0 and up:
Result in SDK versions 5.0.0 and lower:
The ViewController which lets this error be reproduced every single time once zoomed in all the way and back out:
The text was updated successfully, but these errors were encountered: