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

Android apps should catch & handle JNI crashes as exception #24

Closed
mhutti1 opened this issue Mar 18, 2017 · 18 comments · Fixed by #36
Closed

Android apps should catch & handle JNI crashes as exception #24

mhutti1 opened this issue Mar 18, 2017 · 18 comments · Fixed by #36
Assignees
Labels
enhancement New feature or request stale
Milestone

Comments

@mhutti1
Copy link

mhutti1 commented Mar 18, 2017

From @kelson42 on September 26, 2016 10:57

To avoid any wild crashes of the apps. Here is a how to:
http://blog.httrack.com/blog/2013/08/23/catching-posix-signals-on-android/

Copied from original issue: kiwix/kiwix-xulrunner#330

@stale
Copy link

stale bot commented Jun 26, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.

@stale stale bot added the stale label Jun 26, 2019
@macgills
Copy link
Contributor

This requires a kiwix-lib update, the native code must re-throw exceptions as java ones for the android app to begin handling them.

@stale stale bot removed the stale label Jul 15, 2019
@kelson42
Copy link
Contributor

@macgills I think:

  • Newer version of the libkiwix tends to generate exceptions (general approach)
  • The JNI tends to catch them already.

@mhutti1 @macgills Could you confirm? If the libkiwix does not behaves properly from your perspective, please open a ticket and linked it here. But, I believe this ticket can be closed.

@macgills
Copy link
Contributor

This ticket cannot be closed. When the native code causes an error we get fatal signals, such errors are present in 2.5.1
image
If Java Exceptions were getting thrown I would get a stacktrace for such an error but what actually happens is I get this
image
Once it is actually throwing exceptions then on the android side we must catch them.

@kelson42
Copy link
Contributor

I think this is a crash of the libzim, so a bug in it. You can not handle that neither in c++ nor in Java IMO. Do you have a reprocase for that?

@macgills
Copy link
Contributor

I have absolutely no idea how that crash happened but the library @mhutti1 linked to claims it can catch SIGSEGV signals and if that was the case I would have a stacktrace and at least some idea of what code execution caused it.

@kelson42
Copy link
Contributor

OK, thx for the explanation. Then, yes, if CoffeCatch works, then it should be setup.

@kelson42 kelson42 pinned this issue Jul 30, 2019
@macgills
Copy link
Contributor

@mgautierfr I believe this issue should be moved to kiwix-lib, can you confirm this?

@macgills
Copy link
Contributor

macgills commented Sep 3, 2019

I am moving this ticket to 3.1, @mgautierfr if you can review the information on this ticket and give your opinion on it's viability we can progress with it

@mgautierfr
Copy link
Member

Yes it is feasible. At least we will be able to have some trace and solve issues.

Next question will be : "What to do when native code crash ?" If we crash because of a sigsegv, the library is in an undefined state so unusable.

@macgills
Copy link
Contributor

macgills commented Sep 3, 2019

Is there much internal state of the library? Can we supply a method to reset the state of the library.
On android we can relaunch the process which is fairly nasty but gives you a guarantee there is no lingering state

@stale
Copy link

stale bot commented Nov 2, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.

@stale stale bot added the stale label Nov 2, 2019
@kelson42
Copy link
Contributor

kelson42 commented Nov 3, 2019

@macgills Your last comment would probably benefit of a dedicated ticket on the kiwix-lib repo.

@stale stale bot removed the stale label Nov 3, 2019
@kelson42
Copy link
Contributor

kelson42 commented Nov 6, 2019

@macgills We can not fix this ticket now. Postponing..

@kelson42 kelson42 unpinned this issue Nov 17, 2019
@stale
Copy link

stale bot commented Jan 5, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.

@stale stale bot added the stale label Jan 5, 2020
@kelson42
Copy link
Contributor

@mgautierfr @macgills I believe it would be good to implement this if this is the path to follow to be able to investigate properly crash reports. Does that sounds doable now?

@stale stale bot removed the stale label Aug 16, 2020
@stale
Copy link

stale bot commented Oct 17, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.

@stale stale bot added the stale label Oct 17, 2020
@kelson42 kelson42 transferred this issue from kiwix/kiwix-android Jul 2, 2022
@kelson42 kelson42 transferred this issue from kiwix/java-libkiwix Jul 2, 2022
@kelson42 kelson42 transferred this issue from kiwix/kiwix-android Dec 30, 2022
@kelson42
Copy link
Contributor

@mgautierfr @MohitMaliFtechiz This has to be fixed in new JNI binding. What is the status?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request stale
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants