baker icon indicating copy to clipboard operation
baker copied to clipboard

Download Asset Abandon issue

Open qutehoot007 opened this issue 13 years ago • 9 comments

hi,

I found a bug when downloading asset and the server is offline , the status of issue is downloading and progress bar appears, but it will never finish.

also after opening the app again, it still downloading , and I can't cancel it , also I can't download other issues even if I closed the app and run it again.

this is the console message ,

NewsstandKit: cleaning up abandoned asset downloads: ( "<NKAssetDownload: 0xce31b70> -> {identifier: 'CAE64516-D680-4863-BA3E-E0E8A0F26FF1/E6E2E96E-6E64-4977-846C-F617C43537FA' request: <NSURLRequest http://localhost:8888/Magazines/ArabicSupport/book.hpub> downloading: NO}"

qutehoot007 avatar Dec 17 '12 08:12 qutehoot007

While this is related to #582, it's probably worth to keep separate because it's not much about the connection status but about downloads. It might be that it will get solved at the same time, but there's a change it will not.

Thanks. :)

folletto avatar Dec 17 '12 12:12 folletto

I noticed a similar thing... I was able to create the issue while just trying to start the download when the iPad was offline. However when reconnecting to the Internet the download continued until it finished. I still think you are right though, there should be a way to cancel the download once it has started.

nin9creative avatar Dec 19 '12 00:12 nin9creative

Actually shouldn't this just fail? If the server is offline it should reach the didFailWithError... Is it just an issue with the progressbar still showing or is it actively trying to do something?

nin9creative avatar Dec 19 '12 01:12 nin9creative

I'll leave @Simbul answering, but as far as we tested it seems that that error isn't triggered. :/

folletto avatar Dec 19 '12 01:12 folletto

I am actually using the Reachability code in my shelf version to check that it's able to connect prior to kicking off the download, so I don't know about this case. It's weird that the error isn't triggered though.

nin9creative avatar Dec 19 '12 01:12 nin9creative

I just tried it with a bad url for the hpub, and the error did get triggered... Was anyone able to recreate this issue?

nin9creative avatar Dec 19 '12 01:12 nin9creative

A bad URL works, but despite a lot of testing I wasn't able to get a didFailWithError callback when there's no network (easily testable in Airplane Mode).

Even setting the timeout explicitly when instancing the NSURLRequest doesn't have any effect.

The next thing I want to try is a pre-flight check using canHandleRequest from the NSURLConnection, but that still wouldn't cover every possible case (e.g. connection dropping in the middle of a download).

Simbul avatar Dec 19 '12 08:12 Simbul

I had to go quite a long way deep down the rabbit hole, but I think I managed to figure this out.

First of all: commit ce30a1a adds support for resuming Newsstand downloads when reopening the app. There was indeed a bug in the code which could lead to an issue getting stuck in the "downloading" status.

As for the connection timeout, turns out that's expected behaviour for Newsstand. Basically, a Newsstand download never times out: it will simply be retried periodically until the device comes back online.

This means the issue is pretty much fixed now, but I'll keep it open as we are looking into ways of making this less confusing from a UI perspective.

Simbul avatar Dec 22 '12 16:12 Simbul

Better UI introduced in 48fa405.

Simbul avatar Dec 22 '12 17:12 Simbul