kiwix / kiwix-xulrunner

[ARCHIVED] Legacy Kiwix desktop solution for Windows/macOS/Linux
https://download.kiwix.org/release/kiwix-xulrunner/
GNU General Public License v3.0
111 stars 28 forks source link

File not visible on the SD card on Galaxy Tab #323

Closed kelson42 closed 7 years ago

kelson42 commented 7 years ago

Device is a:

Thre content on the SD card (in sub directories):

But the "Local" Tab is empty.

"Settings" > "Storage" display many entries (odd)

It looks like the SD card is detected (4) but not the content files

mhutti1 commented 7 years ago

Can you test if you set the storage device to the SD card and then download thorough the file manager. Can you see the zim?

kelson42 commented 7 years ago

User has tried and it seems to work.

kelson42 commented 7 years ago

He has also moved the old files to the new created directory and they are now visible.

mhutti1 commented 7 years ago

Should just be a simple fix then. The thanks for the feedback. As for the duplicate storage options is this critical for 2.0? I don't have device to test on and it would be very hard to do without device. It's a product of the same SD card being mounted in multiple places. It shouldn't be that hard to fix but I have nothing to debug it.

kelson42 commented 7 years ago

@mhutti1 Maybe you can fix the problem of undetected ZIM files and publish a new APK, I would then open a separate bug for the duplicates entries to be fixed later, does not sounds to critical to me.

mhutti1 commented 7 years ago

It was a more tricky problem that I had anticipated as we have limited access to the sd card but I think I have done it.

mhutti1 commented 7 years ago

Here is the duplicated issue: https://github.com/mhutti1/android-storage-devices/issues/1

kelson42 commented 7 years ago

I seems it crashes now (feedback from the user): I can open kiwix, but as soon as I go to Get Content, it searches for about half a second and then crashes. I've tried rebooting but it makes no difference.

kelson42 commented 7 years ago

I have also tried on my galaxy tab and everything seems to work good with build 37

mhutti1 commented 7 years ago

Could I have a stack trace?

mhutti1 commented 7 years ago

Never mind I think I can see it. It's weird though

mhutti1 commented 7 years ago

So the result of this is we have learned that our download process can in certain unknown circumstances result in some 4GB chunks that cause the app to crash. Manually deleting and re-downloading appears to fix. I have given the once over of the code that @rashiq wrote but It looks sound so without reproduction steps I think this might not be fixable.

kelson42 commented 7 years ago

@mhutti1 @rashiq It's only an idea, but the fact that the new file seems to make pretty exactly the double of 2GB, it seems to me that for some reason, the MB counter is reseted (or maybe this is the file chunks counter)... maybe by an app restart or something like this.

mhutti1 commented 7 years ago

The issue was that when I implemented a system to allow files to continue downloading though internet connection issues I used two variables that I thought were the start and end bytes of the chunk. They were actually the start and end bytes of the next chunk. This caused chunks to download themselves and the next chunk on internet issues. I don't think this caused a crash when opening the file and this was why it was never discovered however it does crash the app when performing certain reader methods. We only implemented these methods later and so the issue slipped through the cracks, To fix I simply made a chunks start and end bytes its actual start and end bytes.