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

Crash when calling pause(): IllegalStateException: cache is closed #147

Closed
glennschmidt opened this issue Oct 25, 2014 · 3 comments
Closed

Comments

@glennschmidt
Copy link

TileView causes a crash for me when i suspend my app and call the pause() method.

The TileView is being presented by a fragment and the sequence of events is:

  1. User presses device home button
  2. Activity.onPause()
  3. Fragment.onPause()
  4. TileView.pause()
  5. Crash

The crash doesn't happen if I don't call TileView.pause(), but i imagine that will lead to other problems.

Is there something i am forgetting to do? The trace is:

FATAL EXCEPTION: AsyncTask #2
    java.lang.RuntimeException: An error occured while executing doInBackground()
            at com.qozix.os.AsyncTask$3.done(AsyncTask.java:276)
            at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
            at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
            at java.util.concurrent.FutureTask.run(FutureTask.java:239)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
            at java.lang.Thread.run(Thread.java:841)
     Caused by: java.lang.IllegalStateException: cache is closed
            at com.jakewharton.DiskLruCache.checkNotClosed(DiskLruCache.java:583)
            at com.jakewharton.DiskLruCache.get(DiskLruCache.java:376)
            at com.qozix.tileview.tiles.TileCache.getBitmapFromDiskCache(TileCache.java:172)
            at com.qozix.tileview.tiles.TileCache.getBitmap(TileCache.java:79)
            at com.qozix.tileview.tiles.Tile.decode(Tile.java:66)
            at com.qozix.tileview.tiles.TileManager.decodeIndividualTile(TileManager.java:308)
            at com.qozix.tileview.tiles.TileRenderTask.doInBackground(TileRenderTask.java:51)
            at com.qozix.tileview.tiles.TileRenderTask.doInBackground(TileRenderTask.java:1)
            at com.qozix.os.AsyncTask$2.call(AsyncTask.java:262)
            at java.util.concurrent.FutureTask.run(FutureTask.java:234)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
            at java.lang.Thread.run(Thread.java:841)

I'm using
tileviewlib-1.0.12
disklrucache-1.3.1

@glennschmidt glennschmidt changed the title Crash after suspending app Crash when calling pause(): IllegalStateException: cache is closed Oct 25, 2014
@moagrius
Copy link
Owner

Thanks for posting. Looks like I'm not appropriately handling the cache at some point.

I'll try to get a patch pushed soon, but not sure when that'll be. For now, I'd suggest simply disabling cache if that a possibility for you.

Does this happen on a range of devices or images, or just one? Do you see it in the emulator, on a real device(s), or both?

@glennschmidt
Copy link
Author

It happens on both a real device and emulator.
I will disable caching for now.

@moagrius
Copy link
Owner

This is corrected in the latest commit (really just needed be less strict on what exceptions were caught). Note that I have not released a new .jar, you'll need to grab the source, nor have I updated the docs (just moved to AS from Eclipse, which had those tasks pretty well baked-in, still getting used to AS).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants