amal-kronz-orch / osmdroid

Automatically exported from code.google.com/p/osmdroid
0 stars 0 forks source link

org.osmdroid.util.TileLooper.loop not terminating, causing an ANR #291

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Zoom all the way in somewhere, in my case near Copenhagen (55.66f, 12.59)
2. Call zoomToSpan(1676626, 6040010) or with something that will cause the map 
to zoom out the same amount of levels.
3.

What is the expected output? What do you see instead?
I expect the map to just zoom out to show the required span. Instead the phone 
enters and endless loop somewhere within zoomToSpan and I get an ANR. 

What version of the product are you using? On what operating system?
This happens with revisions after 1010 I think, and at least on my Desire 
running CM7 (android 2.3)

Please provide any additional information below.
These are some of the repeated call stacks I can see when doing an inspection 
on the running thread in DDMS:

org.osmdroid.tileprovider.MapTile.<init>
org.osmdroid.tileprovider.MapTileProviderBase$ZoomOutTileLooper.handleTile
org.osmdroid.tileprovider.MapTileProviderBase$ScaleTileLooper.handleTile
org.osmdroid.util.TileLooper.loop
org.osmdroid.tileprovider.MapTileProviderBase.rescaleCache
org.osmdroid.views.MapView.setZoomLevel
org.osmdroid.views.MapController.zoomToSpan

java.util.concurrent.locks.ReentrantReadWriteLock$Sync.tryReleaseShared
java.util.concurrent.locks.AbstractQueuedSynchronizer.releaseShared
java.util.concurrent.locks.ReentrantReadWriteLock$ReadLock.unlock
org.osmdroid.tileprovider.MapTileCache.getMapTile
org.osmdroid.tileprovider.MapTileProviderBase$ZoomOutTileLooper.handleTile
org.osmdroid.tileprovider.MapTileProviderBase$ScaleTileLooper.handleTile
org.osmdroid.util.TileLooper.loop
org.osmdroid.tileprovider.MapTileProviderBase.rescaleCache
org.osmdroid.views.MapView.setZoomLevel
org.osmdroid.views.MapController.zoomToSpan

Let me know if you need more information, or are unable to reproduce. Thanks 
for a great API by the way!

Original issue reported on code.google.com by DuneL...@gmail.com on 5 Jan 2012 at 10:58

GoogleCodeExporter commented 9 years ago
I had a similar problem. IIRC before using zoomToSpan you should try to set a 
zoom level manually. HTH.

Original comment by dirk.hol...@gmail.com on 6 Feb 2012 at 2:29

GoogleCodeExporter commented 9 years ago
The problem is in ZoomOutTileLooper.handleTile which will take multiple tiles 
and scale them down into a single tile. If the zoom difference (mDiff) is too 
large, then it tries to make a single tile out of a large number of tiles.

So the fix would be that if the zoom difference is larger than one (mDiff>1), 
the tiles should not be scaled.

Original comment by ivkovic....@gmail.com on 26 Mar 2012 at 5:53

GoogleCodeExporter commented 9 years ago
Soulds like the same is issue 315 
http://code.google.com/p/osmdroid/issues/detail?id=315 where I have posted code 
that will fix the issue by restricting the scaling to only a small number of 
levels.

Original comment by iforpow...@gmail.com on 26 Mar 2012 at 6:34

GoogleCodeExporter commented 9 years ago
Patch applied in revision 1084.
See issue 315.

Original comment by neilboyd on 30 Mar 2012 at 8:38