Bug 30144 - Use of MonoPInvokeCallback on ARM64 causes SIGSEGV
Summary: Use of MonoPInvokeCallback on ARM64 causes SIGSEGV
Status: RESOLVED ANSWERED
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: XI 8.10
Hardware: Macintosh Mac OS
: Normal major
Target Milestone: Untriaged
Assignee: Zoltan Varga
URL:
Depends on:
Blocks:
 
Reported: 2015-05-15 15:16 UTC by Tom Philpot
Modified: 2015-05-18 16:09 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description Tom Philpot 2015-05-15 15:16:44 UTC
Similar to 28673, except we are not PInvoke'ing directly into sqlite3_log.

Repro:
1) Clone https://github.com/tjphilpot/System.Data.SQLite/tree/xamarin_bug
2) Open System.Data.SQLite.sln in Xamarin Studio
3) Set configuration to "Debug | iPhone"
4) Debug "System.Data.SQLite.Tests-Xamarin.iOS" on an AMD64 device
5) Click "Run All Tests" in the tests app.

Behavior:
The app will crash only when running on an AMD64 device.

Changing the architecture to ARM7 only does not cause the app to crash. The test that crashes is https://github.com/tjphilpot/System.Data.SQLite/blob/xamarin_bug/tests/System.Data.SQLite.Tests/SqliteTests.cs#L324

Work around: 
Comment out https://github.com/tjphilpot/System.Data.SQLite/blob/xamarin_bug/src/System.Data.SQLite/SQLiteLog.cs#L32 and the test will work as expected.
Comment 1 Zoltan Varga 2015-05-18 12:49:28 UTC
We should probably apply the workaround from #28673 to the System.Data.SQLite sources.
Comment 2 Tom Philpot 2015-05-18 13:32:36 UTC
Zoltan, I'm not sure the fix for #28673 will work IIUC. The crash has to do with the reverse P/Invoke, not the varags call that #28673 did.
Comment 3 Zoltan Varga 2015-05-18 14:06:12 UTC
The problem is still with the call to the sqlite3_config_log method, which calls the vararg sqlite_config () c function.
Comment 4 Tom Philpot 2015-05-18 14:17:37 UTC
D'oh. Thanks Zoltan.