Bug 1008 - App crashes when making a sqlite connection (only on the device)
Summary: App crashes when making a sqlite connection (only on the device)
Status: RESOLVED NORESPONSE
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: 4.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2011-09-22 13:53 UTC by Sebastien Pouliot
Modified: 2013-12-05 18:34 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 NORESPONSE

Description Sebastien Pouliot 2011-09-22 13:53:33 UTC
note: Copy/pasted from assistly #2166

a) your initial report was a (native) SIGSEGV occurring when calling "conn.Open();"

Initially i was having the issue when calling a.Fill(d);

b) then a "crashing with a null exception " - was that a SIGSEGV like (a) or a NullReferenceException like (c) ?

it was a NullReferenceException like (c)

c) followed by a (managed) NullReferenceException occurring in "System.Data.Common.DbParameterCollection..ctor ()" if the application is redeployed to the device.

Yes this is true

d) all of this occurs only on devices (but not always) and never on the simulator;

Yes, this only ever happens on the device and never in the simulator. The really strange thing is ive found that if I restore the device it will sometimes run fine on the device straight after restoring it. Other times ives had to reinstall monodevelop and restore the ipod to get it to work but i have never had to make any code changes to get it to start working.

e) it occurs with the same source code that you shared with us;

Correct

f) which version of MonoTouch are you using ?

I am on monotouch 4.2 with monodevelop 2.8 beta 2

g) does this happens if the hardware is connected ? or not connected ? (we do not have the hardware so maybe the code being executed differs a bit and make this easier to reproduce).

it happens regardless of the hardware being attached or not and im also getting it on two different mac's running the same setup of monotouch and monodevelop
Comment 1 Jonathon bullock 2011-09-22 15:00:27 UTC
Its worth noting that most of the time I can over come this issue by doing one or all of the following, restoring the ipod, reinstalling monotouch, monodevelop and mono framework.

The solution can then normally be deployed to the device once and work but then each time after that it crashes on the device with either the null exception or at the conn.Open() line or a.Fill(d) line.

The setup i am using is monodevelop 2.8 beta 2, monotouch 4.2, mono framework 2.10.5, OSX Lion, xcode 3.2.6
Comment 2 Sebastien Pouliot 2011-09-23 16:54:16 UTC
I was (and still am, a bit) nearly convinced that this was a corruption (e.g. memory) maybe leading to a corruption of the data[base] which would explain why the problem seems to move and reinstalling the application helps (but I can't see how re-installing monotouch/monodevelop/mono would change anything).

Another bug report, also using LineaSDK and SQLite (but with a very different issue), was fixed by using "Link SDK assemblies" (intead of "Don't link"). I wondered what you were using when building your application ?

If you're using "Don't link" could you try "Link SDK assemblies" and report if the same issue occurs (or not) ? Thanks!
Comment 3 Jonathon bullock 2011-09-25 04:45:49 UTC
My project is currently set to "Link all assemblies" should i try "Link SDK assemblies"?

Also, reinstalling the app never fixes the issue only restoring the device or reinstalling monotouch/monodevelop/mono fixes the issue and generally only for the first build after that.
Comment 4 Jonathon bullock 2011-10-06 07:53:11 UTC
I am getting the same issue when using

"Link all assemblies" or "Link SDK assemblies"
Comment 5 Jonathon bullock 2011-10-06 13:00:51 UTC
Today I've started experiencing the same issue when calling a web service. I have tried reinstalling monotouch, monodevelop and restoring the iPod multiple times but it keeps producing the below.

Again this only happens on physical devices not on the simulator



  at System.Xml.Serialization.XmlReflectionImporter..cctor () <0x0001b>
  at System.Web.Services.Protocols.SoapTypeStubInfo..ctor (System.Web.Services.Protocols.LogicalTypeInfo) <0x0009b>
  at System.Web.Services.Protocols.LogicalTypeInfo.GetTypeStub (string) <0x0016f>
  at System.Web.Services.Protocols.TypeStubManager.GetTypeStub (System.Type,string) <0x0002f>
  at System.Web.Services.Protocols.SoapHttpClientProtocol..ctor () <0x0003b>
  at MTBarcodeExample.webreference.SwipeITWebService..ctor () <IL 0x00001, 0x0007f>
  at MTBarcodeExample.ExternalSQL.WriteMCBMember (int,System.DateTime,int,int,int,string) [0x0000b] in /Users/galacoral/Projects/MTBarcodeExample-2/MTBarcodeExample/ExternalSQL.cs:19
  at MTBarcodeExample.BackgroundUpload.Upload () [0x000b5] in /Users/galacoral/Projects/MTBarcodeExample-2/MTBarcodeExample/BackgroundUpload.cs:31
  at MTBarcodeExample.AppDelegate.<HandleTElapsed>m__1 (object,System.ComponentModel.DoWorkEventArgs) [0x00000] in /Users/galacoral/Projects/MTBarcodeExample-2/MTBarcodeExample/Main.cs:114
  at System.ComponentModel.BackgroundWorker.OnDoWork (System.ComponentModel.DoWorkEventArgs) <0x0003f>
  at System.ComponentModel.BackgroundWorker.ProcessWorker (object,System.ComponentModel.AsyncOperation,System.Threading.SendOrPostCallback) <0x0007b>
  at (wrapper runtime-invoke) object.runtime_invoke_dynamic (intptr,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:

	0   MTBarcodeExample                    0x006ec5f4 mono_handle_native_sigsegv + 412
	1   MTBarcodeExample                    0x006c5918 mono_sigsegv_signal_handler + 360
	2   libsystem_c.dylib                   0x3690872f _sigtramp + 42
	3   MTBarcodeExample                    0x0061e51c wrapper_managed_to_native_object___icall_wrapper_mono_object_new_fast_intptr + 60
	4   MTBarcodeExample                    0x0061e51c wrapper_managed_to_native_object___icall_wrapper_mono_object_new_fast_intptr + 60
	5   MTBarcodeExample                    0x006c5580 mono_jit_runtime_invoke + 2800
	6   MTBarcodeExample                    0x007cf6f0 mono_runtime_invoke + 140
	7   MTBarcodeExample                    0x007c8498 mono_runtime_class_init_full + 1920
	8   MTBarcodeExample                    0x007c7d10 mono_runtime_class_init + 28
	9   MTBarcodeExample                    0x006c3008 mono_jit_compile_method_inner + 216
	10  MTBarcodeExample                    0x006c4248 mono_jit_compile_method_with_opt + 612
	11  MTBarcodeExample                    0x006c445c mono_jit_compile_method + 52
	12  MTBarcodeExample                    0x006e1510 mono_aot_plt_resolve + 316
	13  MTBarcodeExample                    0x006eed2c mono_aot_plt_trampoline + 92
	14  MTBarcodeExample                    0x00656e60 generic_trampoline_aot_plt + 136
	15  MTBarcodeExample                    0x00032e28 System_Web_Services_Protocols_LogicalTypeInfo_GetTypeStub_string + 368
	16  MTBarcodeExample                    0x0003c674 System_Web_Services_Protocols_TypeStubManager_GetTypeStub_System_Type_string + 48
	17  MTBarcodeExample                    0x00037a0c System_Web_Services_Protocols_SoapHttpClientProtocol__ctor + 60
	18  MTBarcodeExample                    0x000c4af8 MTBarcodeExample_webreference_SwipeITWebService__ctor + 128
	19  MTBarcodeExample                    0x000b1ce0 MTBarcodeExample_ExternalSQL_WriteMCBMember_int_System_DateTime_int_int_int_string + 296
	20  MTBarcodeExample                    0x0009a560 MTBarcodeExample_BackgroundUpload_Upload + 1752
	21  MTBarcodeExample                    0x0009997c MTBarcodeExample_AppDelegate__HandleTElapsedm__1_object_System_ComponentModel_DoWorkEventArgs + 148
	22  MTBarcodeExample                    0x0016714c System_ComponentModel_BackgroundWorker_OnDoWork_System_ComponentModel_DoWorkEventArgs + 64
	23  MTBarcodeExample                    0x00166c68 System_ComponentModel_BackgroundWorker_ProcessWorker_object_System_ComponentModel_AsyncOperation_System_Threading_SendOrPostCallback + 124
	24  MTBarcodeExample                    0x006193c0 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 200
	25  MTBarcodeExample                    0x006c5580 mono_jit_runtime_invoke + 2800
	26  MTBarcodeExample                    0x007cf6f0 mono_runtime_invoke + 140
	27  MTBarcodeExample                    0x007d30b0 mono_runtime_invoke_array + 2100
	28  MTBarcodeExample                    0x007d71a4 mono_message_invoke + 628
	29  MTBarcodeExample                    0x00805420 mono_async_invoke + 272
	30  MTBarcodeExample                    0x00807f1c async_invoke_thread + 1044
	31  MTBarcodeExample                    0x0080a938 start_wrapper_internal + 672
	32  MTBarcodeExample                    0x0080aa30 start_wrapper + 24
	33  MTBarcodeExample                    0x008398ec thread_start_routine + 228
	34  MTBarcodeExample                    0x00876948 GC_start_routine + 132
	35  libsystem_c.dylib                   0x368fd311 _pthread_start + 248
	36  libsystem_c.dylib                   0x368febbc start_wqthread + 0

=================================================================
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.
=================================================================
Comment 6 James Scheibel 2011-10-07 13:09:09 UTC
I'm having the same problem connecting to a sqlite 3 database with monotouch 4.2.2 except for me it happens in the simulator as well as the device. To reproduce It is as easy as creating a connection. blows up on .open everytime. I rolled back to the previous monotouch and the problem went away (without changing anything else). I can provide any code/ crash logs you want just let me know.
Comment 7 Sebastien Pouliot 2011-10-07 13:21:39 UTC
James, please fill a separate bug report and include a self-contained test case. We'll look into it asap and merge it back with this one if it's a duplicate. Please also state which previous version of MonoTouch did not exhibit the issue. Thanks.
Comment 8 Sebastien Pouliot 2011-10-10 13:30:19 UTC
The above (comment #6) was unrelated (simulator-only) and caused by the use of an old (4.2) iOS SDK that did not include the symbols required for simlauncher-4. This case is device-only and does not use simlauncher-4 (never used on devices).

Jonathon, I'm not sure if comment #5 is related to the previous crashes. In fact the crashes are so varied that it's hard to find a single explanation to cover them all - the only one (not new) I can come up with is some memory/data corruption. 

Would it be possible to try to split your app into two test cases, one where only sqlite is used (lineapro commented / not linked) and one where lineapro only is used (sqlite commented) ? If we can isolate this further we can, hopefully, come up with a smaller test case that we can duplicate.
Comment 9 PJ 2013-11-19 17:04:20 UTC
This bug has been in the NEEDINFO state with no changes for the last 90 days. Can we put this back into the NEW or CONFIRMED state, or are we still awaiting response?

If there is no change in the status of this bug over the next two weeks, this bug will be marked as NORESPONSE.
Comment 10 PJ 2013-12-05 18:34:21 UTC
This bug has not been changed from the NEEDINFO state since my previous comment, marking as RESOLVED NORESPONSE.

Please feel free to REOPEN this bug at any time if you are still experiencing the issue. Please add the requested information and set the bug back to the NEW (or CONFIRMED) state.