Skip to content
This repository has been archived by the owner. It is now read-only.

EXC_BAD_ACCESS on older iOS devices for first launch #267

Closed
leisim opened this issue Feb 13, 2022 · 9 comments
Closed

EXC_BAD_ACCESS on older iOS devices for first launch #267

leisim opened this issue Feb 13, 2022 · 9 comments
Assignees
Labels

Comments

@leisim
Copy link

leisim commented Feb 13, 2022

Hey,

I get the following error for older iPhones like the iPhone SE. It only happens when the app is launched for the first time. Any idea how to fix it?
Screenshot 2022-02-13 at 12 19 11

@erthink
Copy link
Owner

erthink commented Feb 13, 2022

I think it's some kind of defect in older versions of iOS or incompatibility with standards like POSIX.
Please set breakpoing above to the rc = alloc_page_buf(); and step into the mdbx_memalign_alloc().
This will allow you to understand exactly which function is called on the problematic OS and search for information about this trouble and methods to work around it.

@leisim
Copy link
Author

leisim commented Feb 13, 2022

Thanks! I will try that. But the device runs the latest iOS 15 🤔

@leisim
Copy link
Author

leisim commented Feb 13, 2022

This is what I get. me_pbuf already has a value.
Screenshot 2022-02-13 at 15 00 38

@erthink
Copy link
Owner

erthink commented Feb 13, 2022

I found potential bug that could trigger such access violation in some cases.
Please check out the current devel branch.

If the problem persists, then set the breakpoint inside the mdbx_memalign_alloc(). So you will catch the buffer allocation.

@leisim
Copy link
Author

leisim commented Feb 13, 2022

me_pbuf is still not 0 so mdbx_memalign_alloc is not called.

Could this code be problematic?
https://github.com/isar/isar-core/blob/8c3c2dd83f125501ac859e0b01ca39ae80f2f692/src/mdbx/env.rs#L35-L50

It is needed because iOS only grants a limited amount of virtual memory.

Also weird that it only affects the very first time the app is opened...

@leisim
Copy link
Author

leisim commented Feb 13, 2022

Oh, it is actually called but in the previous iteration of my loop.
Screenshot 2022-02-13 at 17 12 24

@erthink
Copy link
Owner

erthink commented Feb 13, 2022

Could this code be problematic? https://github.com/isar/isar-core/blob/8c3c2dd83f125501ac859e0b01ca39ae80f2f692/src/mdbx/env.rs#L35-L50

Yes.
This is a really strange solution, and the such case was overlooked.
However, I should fix this, i.e. make libmdbx code more idempotence.

@erthink
Copy link
Owner

erthink commented Feb 13, 2022

@leisim, Please check this and close issue on success.
Thank you for reporting.

@leisim
Copy link
Author

leisim commented Feb 13, 2022

@erthink It works! Thanks a lot. I know it is a bit unusual but mai.ru also uses this method in their app. I didn't find a better solution.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants