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

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

Closed
MohitMaliFtechiz opened this issue Mar 14, 2023 · 5 comments
Milestone

Comments

@MohitMaliFtechiz
Copy link
Collaborator

Describe the issue

  • I'm creating new test cases according to latest libkiwix.
  • I have create a test case named testBookMark() in Fixes of Broken CI #27 . Inside this test case i'm saving the bookmark in library and then getting the saved bookmarks with help of getBookmarks function, it's returning the empty array which means bookmarks is not saved in the library.

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

@mgautierfr
Copy link
Member

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

@mgautierfr
Copy link
Member

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
Copy link
Collaborator Author

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
Copy link
Member

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
Copy link
Collaborator Author

@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 #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.

@kelson42 kelson42 added this to the 1.0.0 milestone Jul 18, 2023
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

3 participants