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

Random native exception #3392

Closed
papafe opened this issue Jul 24, 2023 · 5 comments
Closed

Random native exception #3392

papafe opened this issue Jul 24, 2023 · 5 comments
Assignees

Comments

@papafe
Copy link
Contributor

papafe commented Jul 24, 2023

We are using realm in our Xamarin Forms project. Its working good but randomly we are getting few issues which actually we are not able to identify the cause.
Here is scenario:
we are adding and updating items in to different realm tables using for loop. It works fine and out of 10 actions, it fails in 1 or 2 actions and app crashes and doesn't provide any info that from where it is actually breaking.
I tried with all exceptions ON in visual studio (VS 2022, Professional on Windows) but still it doesn't break and doesn't provides and stack trace. . Below is the error we are getting :
[libc++abi] terminating with uncaught exception of type realm::WrongTransactionState: Not a read transaction

I have subscribed the error event but it is not coming into that block

Realm().Error+=(s,e)=>{
     Debug.WriteLine($"Error: {e.Exception.Message} and stack : {e.Exception.StackTrace}");
}

Is there any way I can catch this exception and prevent app from crashing ? Not only this but I want to catch any other unhandled exception from the Realm which crashes the App?

Originally posted by @dharamhbtik in #3390

@papafe
Copy link
Contributor Author

papafe commented Jul 24, 2023

Hi @dharamhbtik, sorry to hear to you're experiencing this. I've copied this into an issue so we can track it better.
Unfortunately I think what you're seeing is a native crash that is not wrapped up in a .NET exception, and so it cannot be caught and it will crash the application.
Would it be possible for you to share your application or maybe a small example so we can take a look? I can provide a link to a private channel where you can upload your code so you don't need to post it publicly

@dharamhbtik
Copy link

Hello @papafe . Yes I can share the scenario with you somewhere in private channel. I cannot upload the project or code here as it is huge and some privacy policy issue.
We have huge dependancy with Realm and we are struggling with the crashes mostly related with Realm.
Also if you can suggest some good practices for using Realm in multithreaded applications specially handling transaction with multithreading . We tried Nito library for async context but that is degrading overall performance of the App and at many places it is blocking the main thread. So we have removed the Nito package.

@papafe
Copy link
Contributor Author

papafe commented Aug 3, 2023

Hi @dharamhbtik, I can understand you prefer not to upload publicly. Do you have an email that I can use so that we can continue our conversation? I will also send you info about where to upload your code.

Regarding multithreading... I suppose it depends on the kind of work that you are doing on the background threads. Can you provide some more specifications?

@dharamhbtik
Copy link

Yes, I can explain you the overall flow of the Realm we are using, and hope you might be able to help us to use it in correct way if we are doing anything wrong. If you can send a test email on [email protected] then we can start a conversation

@papafe
Copy link
Contributor Author

papafe commented Oct 3, 2023

I'm closing this issue since it has been inactive for some time. Feel free to reopen it if you still need help from us.

@papafe papafe closed this as completed Oct 3, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants