kiwix / java-libkiwix

Libkiwix binding for Java & Kotlin
https://central.sonatype.com/artifact/org.kiwix/libkiwix
GNU General Public License v3.0
3 stars 4 forks source link

```addBookmark``` function of ```Library class``` is not saving the Bookmark in latest libkiwix #28

Closed MohitMaliFtechiz closed 1 year ago

MohitMaliFtechiz commented 1 year ago

Describe the issue

@mgautierfr , can you please have a look on it.

mgautierfr commented 1 year ago

Have you used the writeBookmarksToFile(https://github.com/kiwix/libkiwix/blob/main/include/library.h#L262) to save the bookmarks ?

mgautierfr commented 1 year ago

getBookmarks (with true argument) return only valid bookmarks, which are bookmarks associated to books in the library. You must add the book to the library to make the bookmark "valid". (Or use false to get all bookmarks)

MohitMaliFtechiz commented 1 year ago

Or use false to get all bookmarks

@mgautierfr , i have tried with false but it fails with error SIGSEGV (0xb) at pc=0x00007fb7d83ff8e4, pid=69025, tid=69026 Full error logs logs.log

You must add the book to the library to make the bookmark "valid"

When i'm creating Bookmark object and use addBook method in same test it's giving error. Error logs logs.log

can you please have a look on it.

mgautierfr commented 1 year ago

If you look in the logs, you can see in Internal exceptions section :

Event: 0.454 Thread 0x00007f3de4017000 Exception <a 'java/lang/NoClassDefFoundError'{0x00000007166215c0}: org/kiwix/libkiwx/Bookmark> (0x00000007166215c0) thrown at [src/hotspot/share/classfile/systemDictionary.cpp, line 219]

So it seems there is a bug in the scrapper searching for org/kiwix/libkiwx/Bookmark. And you can see in the Java frames section that the error is in org.kiwix.libkiwix.Library.getBookmarks. The bug is probably the typo in this line https://github.com/kiwix/java-libkiwix/blob/main/lib/src/main/cpp/libkiwix/library.cpp#L101 (And it is a good thing as this is exactly the kind of bug we want to catch with the testing of the scrapper)

MohitMaliFtechiz commented 1 year ago

@mgautierfr , thanks for your explanation i'm closing this issue. After your fix, now it's saving bookmark in library. I have added test cases for saving bookmarks in https://github.com/kiwix/java-libkiwix/pull/27.

for the error logs

Java VM: OpenJDK 64-Bit Server VM (11.0.18+10-post-Ubuntu-0ubuntu120.04.1, mixed mode, sharing, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x8f3d75]

i have debug it and find it's my System error with JDK 11 after upgrading the system now this error is gone.