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 16KB: Crash on ISQLite3Provider.sqlite3_open_v2 #621

Open
phillippschmedt opened this issue Feb 21, 2025 · 7 comments
Open

Android 16KB: Crash on ISQLite3Provider.sqlite3_open_v2 #621

phillippschmedt opened this issue Feb 21, 2025 · 7 comments

Comments

@phillippschmedt
Copy link

phillippschmedt commented Feb 21, 2025

We are using .NET 9 MAUI with the following packages:

        <PackageReference Include="SQLitePCLRaw.provider.sqlite3" Version="2.1.10" />
        <PackageReference Include="SQLitePCLRaw.bundle_green" Version="2.1.10" />
        <PackageReference Include="SQLitePCLRaw.provider.dynamic_cdecl" Version="2.1.10" />
        <PackageReference Include="SQLitePCLRaw.bundle_e_sqlcipher" Version="2.1.10" />

I am using SQLitePCL.Batteries_V2.Init() and then a call to ISQLite3Provider.sqlite3_open_v2 will crash on an Android Device (Pixel 8a, Pixel 8, Android 15) with page size set to 16kb. Crashes won't happen if 16kb is not enabled.


=================================================================
	Native Crash Reporting
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

No native Android stacktrace (see debuggerd output).

=================================================================
	Basic Fault Address Reporting
=================================================================
Memory around native instruction pointer (0x75cf786456e0):0x75cf786456d0  00 81 c1 3c 49 01 00 d0 4a 01 00 d0 29 e1 21 91  ...<I...J...).!.
0x75cf786456e0  a0 42 87 3c 00 81 c2 3c 4a 21 29 91 49 01 89 9a  .B.<...<J!).I...
0x75cf786456f0  a9 c2 05 f8 a0 42 88 3c 00 81 c3 3c 0a a1 40 a9  .....B.<...<..@.
0x75cf78645700  a0 42 89 3c aa 42 06 f8 bf 3b 03 d5 a8 c2 06 f8  .B.<.B...;......

=================================================================
	Managed Stacktrace:
=================================================================
	  at <unknown> <0xffffffff>
	  at NativeMethods:sqlite3_open_v2 <0x000ba>
	  at SQLitePCL.SQLite3Provider_e_sqlcipher:SQLitePCL.ISQLite3Provider.sqlite3_open_v2 <0x0007c>
	  at SQLitePCL.raw:sqlite3_open_v2 <0x0005a>
	  at SQLitePCL.raw:sqlite3_open_v2 <0x00058>
@phillippschmedt phillippschmedt changed the title Android 16KB: Crash on SQLitePCL.Batteries_V2.Init(); Android 16KB: Crash on SQLitePCL.Batteries_V2.Init() Feb 21, 2025
@phillippschmedt phillippschmedt changed the title Android 16KB: Crash on SQLitePCL.Batteries_V2.Init() Android 16KB: Crash on ISQLite3Provider.sqlite3_open_v2 Feb 21, 2025
@pictos
Copy link

pictos commented Feb 21, 2025

@phillippschmedt can you create a github repo with a small project that reproduces this issue? That would help the investigation

@ericsink
Copy link
Owner

I've seen this Android 16KB problem before, and I thought I had fixed it, but perhaps I'm mis-remembering, or perhaps I fixed it and never shipped a release with it, or something. I'm in the middle of something else right now, but I'll figure out what happened as soon as I can.

@phillippschmedt
Copy link
Author

I've seen this Android 16KB problem before, and I thought I had fixed it, but perhaps I'm mis-remembering, or perhaps I fixed it and never shipped a release with it, or something. I'm in the middle of something else right now, but I'll figure out what happened as soon as I can.

Thank you! You shipped a fix with this release https://github.com/ericsink/SQLitePCL.raw/releases/tag/v2.1.10 and it solved the general warnings with wrong alignment for 16kb page sizes but the problem described here will remain with 2.1.10 and only when 16kb is enabled.

@JeroenBer
Copy link

Hi,
I also get this warning, how do you test with 16kb page size ? Can that be done in the emulator ? If so how do you enable that ?

@phillippschmedt
Copy link
Author

Hi, I also get this warning, how do you test with 16kb page size ? Can that be done in the emulator ? If so how do you enable that ?

Hi. You use an 16kb emulator or enable it on an device that supports 16kb page sizes: https://developer.android.com/guide/practices/page-sizes#16kb-emulator

@ericsink
Copy link
Owner

ericsink commented Mar 7, 2025

So this problem still needs to be figured out, right? Unless I'm missing something, we don't yet know what the right fix is.

@phillippschmedt
Copy link
Author

phillippschmedt commented Mar 9, 2025

So this problem still needs to be figured out, right? Unless I'm missing something, we don't yet know what the right fix is.

Hi Eric! Yes the problem exists. Thanks for trying to help! I don't know if it helps you but initially I came across the problem when working with https://github.com/praeclarum/sqlite-net and sqlite-net-sqlcipher. Unfortunately that library seems to be not really maintaned anymore. So I tried to dig through it and figure out where the problem is and ended up here.

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

4 participants