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

Concurrency issues with map #1706

Closed
samueltardieu opened this issue Jun 1, 2012 · 8 comments
Closed

Concurrency issues with map #1706

samueltardieu opened this issue Jun 1, 2012 · 8 comments
Labels
Bug Issues classified as a bug Live Map Issues related to live map functionality Prio - High A significant malfunction of a feature/function. High user impact.

Comments

@samueltardieu
Copy link
Member

This may be a duplicate, but this may contain new information and updated traces.

On a Galaxy Tab running Android 4.0.4 and c:geo 2012.06.01, moving the live map quickly with a small zoom level and thus containing lots of caches will exhibit several concurrency issues.

It looks like we hide some of them in the logs and do not crash, but are still sensitive to a ConcurrentModificationException. We need to understand what thread modifies which information in the map. We cannot modify the overlay information while it may be used by the UI thread, so all the overlays modifications may have to occur through a handler to ensure we are indeed using the UI thread.

06-01 22:25:41.170 I/ActivityManager(182): START {cmp=cgeo.geocaching/.maps.google.GoogleMapActivity} from pid 27446
06-01 22:25:41.500 I/MapActivity(27446): Handling network change notification:CONNECTED
06-01 22:25:41.500 E/MapActivity(27446): Couldn't get connection factory client
06-01 22:25:41.590 I/ActivityManager(182): Displayed cgeo.geocaching/.maps.google.GoogleMapActivity: +398ms
06-01 22:25:43.830 W/cgeo    (27446): 204 [No Content] (608 ms) GET http://www.geocaching.com/map/map.info?x=31&y=32&z=6&ep=1&k=KFsD&st=5kHYumS3hkKfqqWvbLZV3HSwZqHBVBStobhKsu6iK6xydJzGnOL-6Csk1jqAV-RrpwGWZ0kEVGGhqkBstrVR1g2&_=1338582342652
06-01 22:25:43.830 E/cgeo    (27446): GCBase.searchByViewport: No data from server for tile (31/32)
06-01 22:25:48.680 E/cgeo    (27446): GoogleMapView.draw: java.lang.ArrayIndexOutOfBoundsException: length=340; index=340
06-01 22:25:49.070 E/cgeo    (27446): GoogleMapView.draw: java.lang.ArrayIndexOutOfBoundsException: length=170; index=174
06-01 22:25:49.210 E/cgeo    (27446): GoogleMapView.draw: java.lang.ArrayIndexOutOfBoundsException: length=220; index=220
06-01 22:25:49.350 E/cgeo    (27446): GoogleMapView.draw: java.lang.ArrayIndexOutOfBoundsException: length=250; index=250
06-01 22:25:49.630 E/cgeo    (27446): GoogleMapView.draw: java.lang.ArrayIndexOutOfBoundsException: length=300; index=300
06-01 22:25:49.730 E/cgeo    (27446): GoogleMapView.draw: java.lang.ArrayIndexOutOfBoundsException: length=320; index=320
06-01 22:25:49.830 E/cgeo    (27446): GoogleMapView.draw: java.lang.ArrayIndexOutOfBoundsException: length=340; index=340
06-01 22:25:53.670 W/cgeo    (27446): 204 [No Content] (9189 ms) GET http://www.geocaching.com/map/map.info?x=32&y=31&z=6&ep=1&k=KFsD&st=5kHYumS3hkKfqqWvbLZV3HSwZqHBVBStobhKsu6iK6xydJzGnOL-6Csk1jqAV-RrpwGWZ0kEVGGhqkBstrVR1g2&_=1338582343845
06-01 22:25:53.670 E/cgeo    (27446): GCBase.searchByViewport: No data from server for tile (32/31)
06-01 22:26:00.250 W/cgeo    (27446): 204 [No Content] (4596 ms) GET http://www.geocaching.com/map/map.info?x=32&y=32&z=6&ep=1&k=KFsD&st=5kHYumS3hkKfqqWvbLZV3HSwZqHBVBStobhKsu6iK6xydJzGnOL-6Csk1jqAV-RrpwGWZ0kEVGGhqkBstrVR1g2&_=1338582355017
06-01 22:26:00.250 E/cgeo    (27446): GCBase.searchByViewport: No data from server for tile (32/32)
06-01 22:26:01.560 E/cgeo    (27446): GCParser.searchByAny: No cache parsed
06-01 22:26:05.760 E/AndroidRuntime(27446): FATAL EXCEPTION: pool-3-thread-1
06-01 22:26:05.760 E/AndroidRuntime(27446): java.util.ConcurrentModificationException
06-01 22:26:05.760 E/AndroidRuntime(27446):     at java.util.LinkedHashMap$LinkedHashIterator.nextEntry(LinkedHashMap.java:350)
06-01 22:26:05.760 E/AndroidRuntime(27446):     at java.util.LinkedHashMap$ValueIterator.next(LinkedHashMap.java:374)
06-01 22:26:05.760 E/AndroidRuntime(27446):     at cgeo.geocaching.CacheCache.getInViewport(CacheCache.java:77)
06-01 22:26:05.760 E/AndroidRuntime(27446):     at cgeo.geocaching.cgData.loadInViewport(cgData.java:2296)
06-01 22:26:05.760 E/AndroidRuntime(27446):     at cgeo.geocaching.cgData.loadCachedInViewport(cgData.java:2269)
06-01 22:26:05.760 E/AndroidRuntime(27446):     at cgeo.geocaching.cgeoapplication.getCachedInViewport(cgeoapplication.java:293)
06-01 22:26:05.760 E/AndroidRuntime(27446):     at cgeo.geocaching.maps.CGeoMap$LoadRunnable.run(CGeoMap.java:1070)
06-01 22:26:05.760 E/AndroidRuntime(27446):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
06-01 22:26:05.760 E/AndroidRuntime(27446):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
06-01 22:26:05.760 E/AndroidRuntime(27446):     at java.lang.Thread.run(Thread.java:856)
06-01 22:26:05.770 W/ActivityManager(182):   Force finishing activity cgeo.geocaching/.maps.google.GoogleMapActivity
@rsudev
Copy link
Contributor

rsudev commented Jun 1, 2012

Tinkering and pondering on this, I don't think it is strictly related to modifying information on the map but 'modifying' the CacheCache through two concurrent read operations.

@mucek4
Copy link
Member

mucek4 commented Jun 2, 2012

Looking on Market it's new in 2012.06.01
Log from Market
java.util.ConcurrentModificationException
at java.util.LinkedHashMap$LinkedHashIterator.nextEntry(LinkedHashMap.java:355)
at java.util.LinkedHashMap$ValueIterator.next(LinkedHashMap.java:379)
at cgeo.geocaching.CacheCache.getInViewport(CacheCache.java:77)
at cgeo.geocaching.cgData.loadInViewport(cgData.java:2296)
at cgeo.geocaching.cgData.loadCachedInViewport(cgData.java:2269)
at cgeo.geocaching.cgeoapplication.getCachedInViewport(cgeoapplication.java:293)
at cgeo.geocaching.maps.CGeoMap$LoadRunnable.run(CGeoMap.java:1070)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1081)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:574)
at java.lang.Thread.run(Thread.java:1020)

@Portree-Kid
Copy link
Contributor

@rsudev I have a pull coming up where I split the member search. it is used by multiple runnables which gives me the creeps.

@rsudev
Copy link
Contributor

rsudev commented Jun 2, 2012

@mucek4 It occurred in master as well from time to time AFAIK, but no clear reproduction scenario is know to me. Do you have more ideas from support? (Couldn't reproduce the issue from @samueltardieu with the described actions either)

@Portree-Kid
Copy link
Contributor

@rsudev I just pushed. Have a look. It fixes #1668

@samueltardieu
Copy link
Member Author

@rsudev I think you're right about the CacheCache being modified while being accessed. I'm currently making it synchronized, in hope to fix this problem in the next maintenance release, waiting for its total nuke (as proposed elsewhere by @Bananeweizen) + possible rewrite.

samueltardieu added a commit that referenced this issue Jun 4, 2012
Concurrent modifications could occur, especially on very large displays
where we may have to draw a lot of caches at the same time while
fetching others. This could lead to ConcurrentModificationException
errors, as described in #1706.
@samueltardieu
Copy link
Member Author

@mucek4 The log in the market may be mine (and similar to this one), I pressed "report" when Android prompted me.

@Lineflyer
Copy link
Member

Why is this marked as high ?
For me this concurrency issue does not show up recently. The last experience is almost 6 weeks ago. So maybe this is solved or worked around by the commit of @samueltardieu ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Issues classified as a bug Live Map Issues related to live map functionality Prio - High A significant malfunction of a feature/function. High user impact.
Projects
None yet
Development

No branches or pull requests

5 participants