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

Fixed: Error on opening a split zim file on external storage. #3803

Merged
merged 6 commits into from
May 8, 2024

Conversation

MohitMaliFtechiz
Copy link
Collaborator

@MohitMaliFtechiz MohitMaliFtechiz commented Apr 23, 2024

Fixes #3605

  • Added test cases for testing whether the ZimFileReader can open the splitted zim file or not.
  • Capturing the better exception when getting the mediaCount and articleCount because it was throwing java.lang.Exception with splitted zim file when the zim file is corrupted. If there is any zim file is corrupted and libzim throws this exception then our UI will not show the other zim file on LocalLibraryScreen due to the getting zim files process being crashed.

@MohitMaliFtechiz MohitMaliFtechiz marked this pull request as draft April 23, 2024 11:06
@kelson42 kelson42 self-requested a review April 30, 2024 08:08
@kelson42
Copy link
Collaborator

@mgautierfr will release new version of libzim and java-libkiwix in the next hours.
@MohitMaliDeveloper Be ready to use and put this PR in review.

@kelson42
Copy link
Collaborator

kelson42 commented May 2, 2024

@MohitMaliFtechiz I have implemented libzim 9.2.1 in java-libkiwix. Does that solve the problem?

@MohitMaliFtechiz
Copy link
Collaborator Author

MohitMaliFtechiz commented May 3, 2024

@kelson42 Thanks for integrating the libzim 9.2.1 in the java-libkiwix. I have tried to load the splitted zim files with the latest bindings on java-libkiwix and now splitted zim files are loading. However, I have encountered an error in Android with zim-tools' splitted zim file, it was throwing the Corrupted block detected error when getting the articleCount and mediaCount of this splitted zim file, and due to this it was not showing in the LibraryScreen. I have placed a fix for this on the Android side, and now it starts showing the zim file in the library screen but without the media and article count.

Zim chunks:

  1. wikipedia_ar_all_nopic_2023-11.zimaa (2.1 GB (2,14,74,74,503 bytes)
  2. wikipedia_ar_all_nopic_2023-11.zimab (2.1 GB (2,14,74,71,095 bytes)
  3. wikipedia_ar_all_nopic_2023-11.zimac (1.3 GB (1,28,14,26,182 bytes)
  4. wikipedia_ar_all_nopic_2023-11.zimad (3.1 GB (3,14,05,16,010 bytes)
  5. wikipedia_ar_all_nopic_2023-11.zimae (0 bytes)

This error was due to there is a wikipedia_ar_all_nopic_2023-11.zimae part with 0 bytes. Because of this, libzim was throwing a Corrupted block detected error. However, we can read the zim file content. I have tried to delete this part from the device and after that, libzim starts returning the mediaCount and articleCount` for this splitted zim file.

With 0 bytes file Without 0 bytes file
BeforeDeleting0bytesFile AfterDeleting0BytesZimFilePart
java.lang.Exception: Corrupted block detected
2024-05-03 12:11:37.364 14087-14279 System.err              pid-14087                            W  	at org.kiwix.libzim.Archive.getArticleCount(Native Method)
2024-05-03 12:11:37.365 14087-14279 System.err              pid-14087                            W  	at org.kiwix.kiwixmobile.core.reader.ZimFileReader.getArticleCount(ZimFileReader.kt:169)
2024-05-03 12:11:37.365 14087-14279 System.err              pid-14087                            W  	at org.kiwix.kiwixmobile.core.reader.ZimFileReader.toBook(ZimFileReader.kt:324)
2024-05-03 12:11:37.365 14087-14279 System.err              pid-14087                            W  	at org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem$BookOnDisk.<init>(BooksOnDiskListItem.kt:67)
2024-05-03 12:11:37.365 14087-14279 System.err              pid-14087                            W  	at org.kiwix.kiwixmobile.core.StorageObserver$convertToBookOnDisk$1.invokeSuspend(StorageObserver.kt:59)
2024-05-03 12:11:37.365 14087-14279 System.err              pid-14087                            W  	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
2024-05-03 12:11:37.365 14087-14279 System.err              pid-14087                            W  	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
2024-05-03 12:11:37.366 14087-14279 System.err              pid-14087                            W  	at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:279)
2024-05-03 12:11:37.366 14087-14279 System.err              pid-14087                            W  	at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
2024-05-03 12:11:37.367 14087-14279 System.err              pid-14087                            W  	at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
2024-05-03 12:11:37.367 14087-14279 System.err              pid-14087                            W  	at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source:1)
2024-05-03 12:11:37.367 14087-14279 System.err              pid-14087                            W  	at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
2024-05-03 12:11:37.367 14087-14279 System.err              pid-14087                            W  	at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source:1)
2024-05-03 12:11:37.367 14087-14279 System.err              pid-14087                            W  	at org.kiwix.kiwixmobile.core.StorageObserver.convertToBookOnDisk(StorageObserver.kt:57)
2024-05-03 12:11:37.367 14087-14279 System.err              pid-14087                            W  	at org.kiwix.kiwixmobile.core.StorageObserver.getBooksOnFileSystem$lambda-0(StorageObserver.kt:45)
2024-05-03 12:11:37.367 14087-14279 System.err              pid-14087                            W  	at org.kiwix.kiwixmobile.core.StorageObserver.$r8$lambda$J3Q4dPQVOFEOgCBh9ahA4Ca-Zak(Unknown Source:0)
2024-05-03 12:11:37.368 14087-14279 System.err              pid-14087                            W  	at org.kiwix.kiwixmobile.core.StorageObserver$$ExternalSyntheticLambda1.apply(Unknown Source:4)
2024-05-03 12:11:37.368 14087-14279 System.err              pid-14087                            W  	at io.reactivex.internal.operators.flowable.FlowableMap$MapConditionalSubscriber.onNext(FlowableMap.java:106)
2024-05-03 12:11:37.368 14087-14279 System.err              pid-14087                            W  	at io.reactivex.subscribers.SerializedSubscriber.onNext(SerializedSubscriber.java:100)
2024-05-03 12:11:37.368 14087-14279 System.err              pid-14087                            W  	at io.reactivex.internal.operators.flowable.FlowableWithLatestFrom$WithLatestFromSubscriber.tryOnNext(FlowableWithLatestFrom.java:94)
2024-05-03 12:11:37.368 14087-14279 System.err              pid-14087                            W  	at io.reactivex.internal.operators.flowable.FlowableWithLatestFrom$WithLatestFromSubscriber.onNext(FlowableWithLatestFrom.java:76)
2024-05-03 12:11:37.368 14087-14279 System.err              pid-14087                            W  	at io.reactivex.internal.operators.flowable.FlowableSubscribeOn$SubscribeOnSubscriber.onNext(FlowableSubscribeOn.java:97)
2024-05-03 12:11:37.368 14087-14279 System.err              pid-14087                            W  	at io.reactivex.internal.operators.flowable.FlowableCombineLatest$CombineLatestCoordinator.drainAsync(FlowableCombineLatest.java:374)
2024-05-03 12:11:37.369 14087-14279 System.err              pid-14087                            W  	at io.reactivex.internal.operators.flowable.FlowableCombineLatest$CombineLatestCoordinator.drain(FlowableCombineLatest.java:406)
2024-05-03 12:11:37.369 14087-14279 System.err              pid-14087                            W  	at io.reactivex.internal.operators.flowable.FlowableCombineLatest$CombineLatestCoordinator.innerValue(FlowableCombineLatest.java:250)
2024-05-03 12:11:37.369 14087-14279 System.err              pid-14087                            W  	at io.reactivex.internal.operators.flowable.FlowableCombineLatest$CombineLatestInnerSubscriber.onNext(FlowableCombineLatest.java:521)
2024-05-03 12:11:37.369 14087-14279 System.err              pid-14087                            W  	at io.reactivex.internal.operators.flowable.FlowableSubscribeOn$SubscribeOnSubscriber.onNext(FlowableSubscribeOn.java:97)
2024-05-03 12:11:37.369 14087-14279 System.err              pid-14087                            W  	at io.reactivex.internal.subscriptions.DeferredScalarSubscription.complete(DeferredScalarSubscription.java:132)
2024-05-03 12:11:37.370 14087-14279 System.err              pid-14087                            W  	at io.reactivex.internal.operators.flowable.FlowableFromCallable.subscribeActual(FlowableFromCallable.java:50)
2024-05-03 12:11:37.370 14087-14279 System.err              pid-14087                            W  	at io.reactivex.Flowable.subscribe(Flowable.java:14935)
2024-05-03 12:11:37.370 14087-14279 System.err              pid-14087                            W  	at io.reactivex.Flowable.subscribe(Flowable.java:14882)
2024-05-03 12:11:37.370 14087-14279 System.err              pid-14087                            W  	at io.reactivex.internal.operators.flowable.FlowableSubscribeOn$SubscribeOnSubscriber.run(FlowableSubscribeOn.java:82)
2024-05-03 12:11:37.370 14087-14279 System.err              pid-14087                            W  	at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66)
2024-05-03 12:11:37.370 14087-14279 System.err              pid-14087                            W  	at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
2024-05-03 12:11:37.371 14087-14279 System.err              pid-14087                            W  	at java.util.concurrent.FutureTask.run(FutureTask.java:264)
2024-05-03 12:11:37.371 14087-14279 System.err              pid-14087                            W  	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:307)

Apart from this, the test case of reading splitted zim is also passing locally.

@MohitMaliFtechiz
Copy link
Collaborator Author

I just saw that this issue with zim-tool has now been fixed openzim/zim-tools#401

@kelson42
Copy link
Collaborator

kelson42 commented May 3, 2024

@MohitMaliFtechiz The bug of creating surnumerous empty chunk has been fixed, see openzim/zim-tools#401. But, the fact that the libzim does not deliver properly if there is such an empty chunk is a bug. Please open an issue for that at openzim/libzim.

Regarding the workaround, you have developed to handle this libzim bug. Please keep it and put clear comment it should be removed once the libzim bug fixed. Open a dedicated issue to do that in next release.

... and the put this PR in review so we can mergw.

@MohitMaliFtechiz
Copy link
Collaborator Author

MohitMaliFtechiz commented May 3, 2024

@MohitMaliFtechiz The bug of creating surnumerous empty chunk has been fixed, see openzim/zim-tools#401. But, the fact that the libzim does not deliver properly if there is such an empty chunk is a bug. Please open an issue for that at openzim/libzim.

@kelson42 Okay.

Regarding the workaround, you have developed to handle this libzim bug. Please keep it and put clear comment it should be removed once the libzim bug fixed. Open a dedicated issue to do that in next release.

I have just captured the error thrown by the libzim to not crash the rendering process ac7e0f6 there is no other code changes I have done, okay I am putting the comments for this.

... and the put this PR in review so we can merge.

Please merge this PR after the latest java-libkiwix is integrated into the project.

@MohitMaliFtechiz MohitMaliFtechiz marked this pull request as ready for review May 3, 2024 08:48
@mgautierfr
Copy link
Member

Agree with @kelson42, libzim should be able to read split file even with a empty part at the end (or in the middle). I personally can open such split file without any issue (not using kiwix-android)

I have encountered an error in Android with zim-tools' splitted zim file, it was throwing the Corrupted block detected error when getting the

Corrupted block deteted is not a libzim error. We have to investigate this but it may be not a libzim issue.

@MohitMaliFtechiz
Copy link
Collaborator Author

MohitMaliFtechiz commented May 3, 2024

Agree with @kelson42, libzim should be able to read split file even with a empty part at the end (or in the middle). I personally can open such split file without any issue (not using kiwix-android)
I have encountered an error in Android with zim-tools' splitted zim file, it was throwing the Corrupted block detected error when getting the
Corrupted block deteted is not a libzim error. We have to investigate this but it may be not a libzim issue.

@mgautierfr The error was throwing when I was trying to get the mediaCount and articleCount which are the Archive's functions.

Corrupted block deteted is not a libzim error. We have to investigate this but it may be not a libzim issue.

If it is not a libzim error, and you can open the zim file of this type. Then it is probably the error of java-libkiwix binding. We should test this scenario with java-libkiwix.

@mgautierfr
Copy link
Member

Corrupted block detected is not a libzim error. We have to investigate this but it may be not a libzim issue.

This may be a zstd error (facebook/zstd#2852). If it is the case, it means that we are passing corrupted data to be decompressed. It would be surprising that libzim pass a wrong value (assuming file is actually not corrupted), especially that a zim split made with zimsplit doesn't cut in the middle of a cluster.

However, your test split zim file creator is (potentially) splitting in the middle of cluster and I have identified a race condition. Are you sure the error is with a extra empty part or it is with the testing split file ?

@MohitMaliFtechiz
Copy link
Collaborator Author

However, your test split zim file creator is (potentially) splitting in the middle of cluster and I have identified a race condition. Are you sure the error is with a extra empty part or it is with the testing split file ?

@mgautierfr The problem is with the empty part, the test case is passing successfully without any error with the latest bindings of java-libkiwix, The test case opens the zim file and reads the content, there is no error in the test case. However, zimsplit zim file is also now opening in the kiwix and reads the content, but when there is an empty part then the getArticleCount() and getMediaCount() methods throw this error. Moreover, if I delete that empty part from my device it starts giving the value from these methods and there is no error.

I have identified a race condition.

We can improve this test part to avoid this type of situation.

@mgautierfr
Copy link
Member

Ok, let's me try to resume the issue:

  • In all case, you open zim file passing the path wikipedia_ar_all_nopic_2023-11.zim
  • Split zim file with extra 0 sized part:
    . libzim 9.2.0, you have a crash
    . libzim 9.2.1, you don't have a crash
  • Split zim file without extra 0 sized part:
    . It works with both version of libzim.

Are we agree on this ?

@MohitMaliFtechiz
Copy link
Collaborator Author

MohitMaliFtechiz commented May 3, 2024

@mgautierfr Let me correct few things then you can resume the issue.

In all case, you open zim file passing the path wikipedia_ar_all_nopic_2023-11.zim

I am opening the wikipedia_ar_all_nopic_2023-11.zimaa not wikipedia_ar_all_nopic_2023-11.zim.

Split zim file with extra 0 sized part:
. libzim 9.2.0, you have a crash
. libzim 9.2.1, you don't have a crash

Libzim 9.2.0 does not opens in both situations whether there is extra 0 size zim file present or not.
With Libzim 9.2.1 there is a crash(when getting the value from these two methods getArticleCount() and getMediaCount()) when there is extra 0 size zim file present in storage, and without this 0 size zim file there is no crash.

Split zim file without extra 0 sized part:
. It works with both version of libzim.

No, in version 9.2.1 it working and in version 9.2.0 it is failing to open the zim file.

@kelson42
Copy link
Collaborator

kelson42 commented May 4, 2024

@MohitMaliFtechiz I have released java-libkiwix 2.1.1, configured in kiwix-android and rebase this PR… but the CI is still red!

@mgautierfr
Copy link
Member

Thank @MohitMaliFtechiz for the explanation.
How the split files are generated ? With zimsplit ? (Which version ?).
Can you run a sha256sum (or any other checksum tool) on them ?

@MohitMaliFtechiz
Copy link
Collaborator Author

MohitMaliFtechiz commented May 6, 2024

Thank @MohitMaliFtechiz for the explanation.
How the split files are generated ? With zimsplit ? (Which version ?).

@mgautierfr I am using zim-tools 3.1.0 for splitting the zim file.

zim-tools 3.1.0

libzim 7.2.0
+ libzstd 1.4.8
+ liblzma 5.2.5
+ libxapian 1.4.18
+ libicu 70.1.0

@kelson42
Copy link
Collaborator

kelson42 commented May 6, 2024

@MohitMaliFtechiz Please redo the operation wirh latest version of zim-tools, your version is already a bit old... maybe there a bug arounf this

@MohitMaliFtechiz
Copy link
Collaborator Author

Can you run a sha256sum (or any other checksum tool) on them ?

@mgautierfr Here are the all details from beginning.

  • First I have tried to split the zim file. I have run the zimsplit wikipedia_ar_all_nopic_2024-03.zim command.
    The output is:
acerpc@acerpc-Aspire-Lite-AL15-51:~/Documents$ zimsplit wikipedia_ar_all_nopic_2024-03.zim 
opening new file wikipedia_ar_all_nopic_2024-03.zimaa
opening new file wikipedia_ar_all_nopic_2024-03.zimab
opening new file wikipedia_ar_all_nopic_2024-03.zimac
opening new file wikipedia_ar_all_nopic_2024-03.zimad
WARNING: Part wikipedia_ar_all_nopic_2024-03.zimad is bigger that max part size. (3187373325>2147483648)
opening new file wikipedia_ar_all_nopic_2024-03.zimae
  • Checksum report:
    Sha256sum
acerpc@acerpc-Aspire-Lite-AL15-51:~/Documents$ sha256sum wikipedia_ar_all_nopic_2024-03.zim
f744022ed8208a50a1ce191cd5af946debc4012d36c41f7c338e8ae904b86303  wikipedia_ar_all_nopic_2024-03.zim
acerpc@acerpc-Aspire-Lite-AL15-51:~/Documents$ sha256sum wikipedia_ar_all_nopic_2024-03.zimaa
8fd91f8f328ca1a5c77129fd7e4d7435f663fa632e9c0078c3d38d0bccdea366  wikipedia_ar_all_nopic_2024-03.zimaa
acerpc@acerpc-Aspire-Lite-AL15-51:~/Documents$ sha256sum wikipedia_ar_all_nopic_2024-03.zimab
eb1892b3bfee9876626a12bff57d90c6663ab143e74d88e8ebddc6084f167e82  wikipedia_ar_all_nopic_2024-03.zimab
acerpc@acerpc-Aspire-Lite-AL15-51:~/Documents$ sha256sum wikipedia_ar_all_nopic_2024-03.zimac
33729314abe6b640d918770cfd9146a13b49eac537a52b00e6568e3a358d1ce5  wikipedia_ar_all_nopic_2024-03.zimac
acerpc@acerpc-Aspire-Lite-AL15-51:~/Documents$ sha256sum wikipedia_ar_all_nopic_2024-03.zimad
b17e5f6fbbc140486cab4c19adc8970364796acdbd06a8a9439e501d02cfb040  wikipedia_ar_all_nopic_2024-03.zimad
acerpc@acerpc-Aspire-Lite-AL15-51:~/Documents$ sha256sum wikipedia_ar_all_nopic_2024-03.zimae
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855  wikipedia_ar_all_nopic_2024-03.zimae
acerpc@acerpc-Aspire-Lite-AL15-51:~/Documents$ 

md5sum

acerpc@acerpc-Aspire-Lite-AL15-51:~/Documents$ md5sum wikipedia_ar_all_nopic_2024-03.zim
66bb7f6ca0008b304231040a53b71ab4  wikipedia_ar_all_nopic_2024-03.zim
acerpc@acerpc-Aspire-Lite-AL15-51:~/Documents$ md5sum wikipedia_ar_all_nopic_2024-03.zimaa
981bff8a335e0e13ac2a9fd1af25df43  wikipedia_ar_all_nopic_2024-03.zimaa
acerpc@acerpc-Aspire-Lite-AL15-51:~/Documents$ md5sum wikipedia_ar_all_nopic_2024-03.zimab
4ff359e0dbdd1af19ce39353f198e31d  wikipedia_ar_all_nopic_2024-03.zimab
acerpc@acerpc-Aspire-Lite-AL15-51:~/Documents$ md5sum wikipedia_ar_all_nopic_2024-03.zimac
6504996d96eacc34e9c504c1ca4d0acb  wikipedia_ar_all_nopic_2024-03.zimac
acerpc@acerpc-Aspire-Lite-AL15-51:~/Documents$ md5sum wikipedia_ar_all_nopic_2024-03.zimad
a909742cd7df2e8aa7dffe9f9d74dd3f  wikipedia_ar_all_nopic_2024-03.zimad
acerpc@acerpc-Aspire-Lite-AL15-51:~/Documents$ md5sum wikipedia_ar_all_nopic_2024-03.zimae
d41d8cd98f00b204e9800998ecf8427e  wikipedia_ar_all_nopic_2024-03.zimae

cksum

acerpc@acerpc-Aspire-Lite-AL15-51:~/Documents$ cksum wikipedia_ar_all_nopic_2024-03.zim
3675923895 9262630633 wikipedia_ar_all_nopic_2024-03.zim
acerpc@acerpc-Aspire-Lite-AL15-51:~/Documents$ cksum wikipedia_ar_all_nopic_2024-03.zimaa
1205357161 2147459163 wikipedia_ar_all_nopic_2024-03.zimaa
acerpc@acerpc-Aspire-Lite-AL15-51:~/Documents$ cksum wikipedia_ar_all_nopic_2024-03.zimab
3126437707 2147376980 wikipedia_ar_all_nopic_2024-03.zimab
acerpc@acerpc-Aspire-Lite-AL15-51:~/Documents$ cksum wikipedia_ar_all_nopic_2024-03.zimac
3803321215 1780421165 wikipedia_ar_all_nopic_2024-03.zimac
acerpc@acerpc-Aspire-Lite-AL15-51:~/Documents$ cksum wikipedia_ar_all_nopic_2024-03.zimad
2606185103 3187373325 wikipedia_ar_all_nopic_2024-03.zimad
acerpc@acerpc-Aspire-Lite-AL15-51:~/Documents$ cksum wikipedia_ar_all_nopic_2024-03.zimae
4294967295 0 wikipedia_ar_all_nopic_2024-03.zimae
  • One more thing the last chunk of the zim file is text document type, other zim chunks are Binary type.
  1. wikipedia_ar_all_nopic_2023-11.zimaa (2.1 GB (2,14,74,74,503 bytes) Type = Binary (application/octet-stream)
  2. wikipedia_ar_all_nopic_2023-11.zimab (2.1 GB (2,14,74,71,095 bytes) Type = Binary (application/octet-stream)
  3. wikipedia_ar_all_nopic_2023-11.zimac (1.3 GB (1,28,14,26,182 bytes) Type = Binary (application/octet-stream)
  4. wikipedia_ar_all_nopic_2023-11.zimad (3.1 GB (3,14,05,16,010 bytes) Type = Binary (application/octet-stream)
  5. wikipedia_ar_all_nopic_2023-11.zimae (0 bytes) Type = plain text document (text/plain)

Screenshot from 2024-05-06 12-21-13

@MohitMaliFtechiz
Copy link
Collaborator Author

@MohitMaliFtechiz Please redo the operation wirh latest version of zim-tools, your version is already a bit old... maybe there a bug arounf this

@kelson42 The latest version of zim-tools is available for my current version of Ubuntu(Ubuntu 22.04.4 LTS) is 3.1.0-3 which I am using.

The latest version of zim-tools requires Ubuntu 23.10 or 24.04 https://manpages.ubuntu.com/manpages/mantic/man1/zimsplit.1.html. Is it any other way to use the latest zim-tools without upgrading the ubuntu.

@mgautierfr
Copy link
Member

You can get the last version of zim-tools here : https://download.openzim.org/release/zim-tools/

But anyway, the checksum of you file are same as mine, so it is not a problem of zim-tools version.

@mgautierfr
Copy link
Member

You can get the last version of zim-tools here : https://download.openzim.org/release/zim-tools/

But anyway, the checksum of you file are same as mine, so it is not a problem of zim-tools version.

I have add a simple (java) test opening split files (with an extra 0 part) on my computer and it works. So it seems it is a android only issue.

@mgautierfr
Copy link
Member

Can you try to run the application under strace (https://source.android.com/docs/core/tests/debug/strace) please ?

@MohitMaliFtechiz
Copy link
Collaborator Author

You can get the last version of zim-tools here : https://download.openzim.org/release/zim-tools/
But anyway, the checksum of you file are same as mine, so it is not a problem of zim-tools version.
I have add a simple (java) test opening split files (with an extra 0 part) on my computer and it works. So it seems it is a android only issue.

@mgautierfr Thanks.

@MohitMaliFtechiz
Copy link
Collaborator Author

MohitMaliFtechiz commented May 6, 2024

@mgautierfr Thanks for your testing, I have also added the test case in Android with 0 bytes zim file, and my test case is passed without any error as well, it is returning the articleCount and mediaCount both in my test case(Also, if I try to load this test's zim splitted zim file in my application then there is no error). However, the error is with the zim-tools(version 3.3.0) splitted zim file remains the same.

Copy link

codecov bot commented May 6, 2024

Codecov Report

Attention: Patch coverage is 0% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 53.24%. Comparing base (4a5033f) to head (2074e55).
Report is 1 commits behind head on main.

❗ Current head 2074e55 differs from pull request most recent head ecf74ed. Consider uploading reports for the commit ecf74ed to get more accurate results

Files Patch % Lines
...org/kiwix/kiwixmobile/core/reader/ZimFileReader.kt 0.00% 4 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #3803      +/-   ##
============================================
- Coverage     53.30%   53.24%   -0.06%     
+ Complexity     1319     1313       -6     
============================================
  Files           292      292              
  Lines         11067    11060       -7     
  Branches       1471     1471              
============================================
- Hits           5899     5889      -10     
+ Misses         4195     4194       -1     
- Partials        973      977       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kelson42
Copy link
Collaborator

kelson42 commented May 8, 2024

@MohitMaliFtechiz The handling of this edge case is dlowing down the release. Please create dedicated issue to continue the work, so we can merge this one.

@MohitMaliFtechiz
Copy link
Collaborator Author

@MohitMaliFtechiz The handling of this edge case is dlowing down the release. Please create dedicated issue to continue the work, so we can merge this one.

@kelson42 I have created a separate ticket for this edge case #3827.

@MohitMaliFtechiz MohitMaliFtechiz marked this pull request as ready for review May 8, 2024 09:48
@kelson42
Copy link
Collaborator

kelson42 commented May 8, 2024

@MohitMaliFtechiz Please don't call a PR by the error... but by the solution! Here this PR has an issue title!

 * Added test cases for testing that the ZimFileReader can open the splitted zim file or not.
…icleCount` because it was throwing `java.lang.Exception` with splitted zim file when the zim file is corrupted. If there is any zim file is corrupted and libzim throws this exception then our UI will not show the other zim file on `LocalLibraryScreen` due to the getting zim files process being crashed.
…unt this will necessary to catch the all exception thrown by libzim to prevent the aborting of the rendering process of other zim files.
@kelson42 kelson42 merged commit 36d8ae9 into main May 8, 2024
8 checks passed
@kelson42 kelson42 deleted the Issue#3605 branch May 8, 2024 12:08
@MohitMaliFtechiz MohitMaliFtechiz changed the title Error on opening a split zim file on external storage. Fixed: Error on opening a split zim file on external storage. May 8, 2024
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

Successfully merging this pull request may close these issues.

v. 3.8.1+3.9.0: Error on opening a split zim file on external storage
4 participants