Monotouch sqlite crash when inserting a lot of rows

2

I've an app built with xamarin iOS. The database is sqlite. Both in simulator and device, after the app starts to work on data, it gives me a SIGSEGV error.

Stacktrace:

at (wrapper managed-to-native) Mono.Data.Sqlite.UnsafeNativeMethods.sqlite3_prepare (intptr,intptr,int,intptr&,intptr&) at Mono.Data.Sqlite.SQLite3.Prepare (Mono.Data.Sqlite.SqliteConnection,string,Mono.Data.Sqlite.SqliteStatement,uint,string&) [0x00044] in /Developer/MonoTouch/Source/mono/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLite3.cs:268 at Mono.Data.Sqlite.SqliteCommand.BuildNextCommand () [0x00019] in /Developer/MonoTouch/Source/mono/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteCommand.cs:230 at Mono.Data.Sqlite.SqliteCommand.GetStatement (int) [0x0000b] in /Developer/MonoTouch/Source/mono/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteCommand.cs:264 at (wrapper remoting-invoke-with-check) Mono.Data.Sqlite.SqliteCommand.GetStatement (int) at Mono.Data.Sqlite.SqliteDataReader.NextResult () [0x000cc] in /Developer/MonoTouch/Source/mono/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteDataReader.cs:896 at Mono.Data.Sqlite.SqliteDataReader..ctor (Mono.Data.Sqlite.SqliteCommand,System.Data.CommandBehavior) [0x00051] in /Developer/MonoTouch/Source/mono/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteDataReader.cs:89 at (wrapper remoting-invoke-with-check) Mono.Data.Sqlite.SqliteDataReader..ctor (Mono.Data.Sqlite.SqliteCommand,System.Data.CommandBehavior) at Mono.Data.Sqlite.SqliteCommand.ExecuteReader (System.Data.CommandBehavior) [0x00006] in /Developer/MonoTouch/Source/mono/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteCommand.cs:539 at Mono.Data.Sqlite.SqliteCommand.ExecuteDbDataReader (System.Data.CommandBehavior) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteCommand.cs:527 at System.Data.Common.DbCommand.ExecuteReader (System.Data.CommandBehavior) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/System.Data/System.Data.Common/DbCommand.cs:128 at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader (System.Data.CommandBehavior) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/System.Data/System.Data.Common/DbCommand.cs:145 at System.Data.Common.DbDataAdapter.Fill (System.Data.DataTable,System.Data.IDbCommand,System.Data.CommandBehavior) [0x00022] in /Developer/MonoTouch/Source/mono/mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs:297 at System.Data.Common.DbDataAdapter.Fill (System.Data.DataTable) [0x00011] in /Developer/MonoTouch/Source/mono/mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs:273 at (wrapper remoting-invoke-with-check) System.Data.Common.DbDataAdapter.Fill (System.Data.DataTable) at PL.Dati.TabellaDati..ctor (PL.Dati.ConnessioneDB,string,string) [0x000e8] in /Sviluppo/Librerie/Gestione Dati/PL.Dati.Mobile/Versioni/iOS/PL.Dati.iOS/TabellaDatiiOS.cs:26 at PL.Dati.ConnessioneDB.EseguiSelezione (string) [0x00000] in /Sviluppo/Librerie/Gestione Dati/PL.Dati.Mobile/Comune/ConnessioneDB.cs:206 at PL.Dati.ConnessioneDB.EseguiSelezione (string,string,string,bool,int,string[]) [0x00137] in /Sviluppo/Librerie/Gestione Dati/PL.Dati.Mobile/Comune/ConnessioneDB.cs:192 at PL.Dati.ConnessioneDB.EseguiSelezione (string,string,string,int) [0x00000] in /Sviluppo/Librerie/Gestione Dati/PL.Dati.Mobile/Comune/ConnessioneDB.cs:125 at PL.Dati.ConnessioneDB.EseguiInserimentoTabellaDati (string,PL.Dati.TabellaDati,string[]) [0x0004d] in /Sviluppo/Librerie/Gestione Dati/PL.Dati.Mobile/Comune/ConnessioneDB.cs:860 at PL.Dati.ConnessioneDB.EseguiInserimentoTabellaDati (string,PL.Dati.TabellaDati) [0x00000] in /Sviluppo/Librerie/Gestione Dati/PL.Dati.Mobile/Comune/ConnessioneDB.cs:828 at iSell.Core.GestioneTrasmissioni.ElaboraFileDati (PL.Dati.ConnessioneDB,string,string) [0x00295] in /Sviluppo/Procedure/iSell/Comune/Gestione/GestioneTrasmissioni.cs:681 at iSell.Core.GestioneTrasmissioni.ElaboraDatiDownload (bool) [0x002a0] in /Sviluppo/Procedure/iSell/Comune/Gestione/GestioneTrasmissioni.cs:888 at iSell.Core.GestioneTrasmissioni.ElaboraCartellaDownload (bool,string,string) [0x0007b] in /Sviluppo/Procedure/iSell/Comune/Gestione/GestioneTrasmissioni.cs:416 at iSell.Core.GestioneTrasmissioni.ElaboraCartellaDownload (bool) [0x00000] in /Sviluppo/Procedure/iSell/Comune/Gestione/GestioneTrasmissioni.cs:392 at iSell.Core.GestoreInterfacciaTrasmissioni.RichiestaElaborazioneComando (string,object,object) [0x000c5] in /Sviluppo/Procedure/iSell/Comune/Interfacce/Client/GestoreInterfacciaTrasmissioni.cs:69 at iSell.Core.RicevitoreComandi.RichiediElaborazioneComando () [0x00036] in /Sviluppo/Procedure/iSell/Comune/EngineDati/RicevitoreComandi.cs:97 at iSell.Core.RicevitoreComandi.RichiediElaborazioneComando (object) [0x00007] in /Sviluppo/Procedure/iSell/Comune/EngineDati/RicevitoreComandi.cs:111 at iSell.Core.GestoreInterfacciaVisualizzazioneSorgenteDati.NotificaChiusuraInterfaccia (iSell.Core.GestioneInterfacce/TipiChiusuraInterfaccia) [0x00012] in /Sviluppo/Procedure/iSell/Comune/Interfacce/Interazione utente/GestoreInterfacciaVisualizzazioneSorgenteDati.cs:54 at iSell.OS.ViewControllerStandard.ChiudiInterfaccia (iSell.Core.GestioneInterfacce/TipiChiusuraInterfaccia) [0x0009e] in /Sviluppo/Procedure/iSell/Versioni/iSelliOS/iOS/Interfaccie/Classi ausiliarie/ViewControllerStandard.cs:319 at iSell.OS.ViewControllerStandard.ChiudiInterfaccia () [0x000a1] in /Sviluppo/Procedure/iSell/Versioni/iSelliOS/iOS/Interfaccie/Classi ausiliarie/ViewControllerStandard.cs:277 at iSell.OS.ViewControllerStandard.Handle_GestoreInterfacciaStandardhandleRichiestaChiusuraInterfaccia () [0x00000] in /Sviluppo/Procedure/iSell/Versioni/iSelliOS/iOS/Interfaccie/Classi ausiliarie/ViewControllerStandard.cs:62 at iSell.Core.GestoreInterfacciaStandard.ChiudiInterfaccia () [0x0000b] in /Sviluppo/Procedure/iSell/Comune/Interfacce/Client/GestoreInterfacciaStandard.cs:77 at iSell.Core.GestoreInterfacciaVisualizzazioneSorgenteDati.Handle_SorgenteDatiInVisualizzazionehandleIndiceElementoDatiCorrenteInSezioneModificato (PL.Dati.SorgenteDati,PL.Dati.IndiceElementoDati) [0x0004b] in /Sviluppo/Procedure/iSell/Comune/Interfacce/Interazione utente/GestoreInterfacciaVisualizzazioneSorgenteDati.cs:39 at (wrapper delegate-invoke) .invoke_void_thisSorgenteDati_IndiceElementoDati (PL.Dati.SorgenteDati,PL.Dati.IndiceElementoDati) at PL.Dati.SorgenteDati.HandleIndiceElementoDatiCorrenteInSezioneModificato (PL.Dati.SezioneSorgenteDati,int) [0x00026] in /Sviluppo/Librerie/Gestione Dati/PL.Dati.Mobile/Comune/SorgenteDati.cs:145 at PL.Dati.SezioneSorgenteDati.HandleIndiceElementoDatiCorrenteModificato (PL.Dati.SezioneSorgenteDati,int) [0x0000b] in /Sviluppo/Librerie/Gestione Dati/PL.Dati.Mobile/Comune/SezioneSorgenteDati.cs:143 at PL.Dati.SezioneSorgenteDati.ImpostaIndiceElementoDatiCorrente (int,bool) [0x000e2] in /Sviluppo/Librerie/Gestione Dati/PL.Dati.Mobile/Comune/SezioneSorgenteDati.cs:723 at PL.Dati.SorgenteDati.ImpostaIndiceElementoDatiCorrenteInSezione (int,int,bool) [0x00063] in /Sviluppo/Librerie/Gestione Dati/PL.Dati.Mobile/Comune/SorgenteDati.cs:616 at PL.Dati.SorgenteDati.ImpostaIndiceElementoDatiCorrenteInSezione (int,int) [0x00000] in /Sviluppo/Librerie/Gestione Dati/PL.Dati.Mobile/Comune/SorgenteDati.cs:594 at iSell.OS.SorgenteTableViewStandard.RowSelected (MonoTouch.UIKit.UITableView,MonoTouch.Foundation.NSIndexPath) [0x00000] in /Sviluppo/Procedure/iSell/Versioni/iSelliOS/iOS/Interfaccie/Classi ausiliarie/SorgenteTableViewStandard.cs:298 at (wrapper runtime-invoke) .runtime_invoke_void__this_object_object (object,intptr,intptr,intptr) at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) at MonoTouch.UIKit.UIApplication.Main (string[],string,string) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38 at MonoTouch.UIKit.UIApplication.Main (string[]) [0x00000] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:43 at iSell.OS.Application.Main (string[]) [0x00000] in /Sviluppo/Procedure/iSell/Versioni/iSelliOS/Main.cs:13 at (wrapper runtime-invoke) .runtime_invoke_void_object (object,intptr,intptr,intptr)

Native stacktrace:

0   iSell                               0x0007b09c mono_handle_native_sigsegv + 284
1   iSell                               0x00004f38 mono_sigsegv_signal_handler + 248
2   libsystem_c.dylib                   0x9c3ba59b _sigtramp + 43
3   ???                                 0xffffffff 0x0 + 4294967295
4   libsqlite3.dylib                    0x04284f81 sqlite3ExprAlloc + 257
5   libsqlite3.dylib                    0x04284a5b selectExpander + 2859
6   libsqlite3.dylib                    0x042817d8 sqlite3WalkSelect + 104
7   libsqlite3.dylib                    0x04280b0c sqlite3SelectPrep + 76
8   libsqlite3.dylib                    0x0426d448 sqlite3Select + 424
9   libsqlite3.dylib                    0x04261cdd yy_reduce + 8301
10  libsqlite3.dylib                    0x0425f535 sqlite3Parser + 245
11  libsqlite3.dylib                    0x042264ac sqlite3RunParser + 396
12  libsqlite3.dylib                    0x042a50fa sqlite3Prepare + 634
13  libsqlite3.dylib                    0x0422564e sqlite3LockAndPrepare + 270
14  libsqlite3.dylib                    0x04225205 sqlite3_prepare + 53
15  ???                                 0x19ef1687 0x0 + 435099271
16  ???                                 0x19ef0960 0x0 + 435095904
17  ???                                 0x19ef0455 0x0 + 435094613
18  ???                                 0x19ef0164 0x0 + 435093860
19  ???                                 0x19ef00e4 0x0 + 435093732
20  ???                                 0x19eefaa4 0x0 + 435092132
21  ???                                 0x19eef5f2 0x0 + 435090930
22  ???                                 0x19eef468 0x0 + 435090536
23  ???                                 0x19eee884 0x0 + 435087492
24  ???                                 0x19ef8ea8 0x0 + 435130024
25  ???                                 0x19ef8e63 0x0 + 435129955
26  ???                                 0x19ef8e10 0x0 + 435129872
27  ???                                 0x19ef8cab 0x0 + 435129515
28  ???                                 0x19ef8946 0x0 + 435128646
29  ???                                 0x19ef8864 0x0 + 435128420
30  ???                                 0x19ef7c40 0x0 + 435125312
31  ???                                 0x19ef76c4 0x0 + 435123908
32  ???                                 0x1a1c9c04 0x0 + 438082564
33  ???                                 0x1a1c9770 0x0 + 438081392
34  ???                                 0x1cb20058 0x0 + 481427544
35  ???                                 0x1cb1fd7c 0x0 + 481426812
36  ???                                 0x1c8c6610 0x0 + 478963216
37  ???                                 0x19e990e8 0x0 + 434737384
38  ???                                 0x19e9470c 0x0 + 434718476
39  ???                                 0x19e94494 0x0 + 434717844
40  ???                                 0x1c7dcd8c 0x0 + 478006668
41  ???                                 0x1c7dc8d8 0x0 + 478005464
42  ???                                 0x1c7dc7c8 0x0 + 478005192
43  ???                                 0x1c7dc6a8 0x0 + 478004904
44  ???                                 0x1c7db70b 0x0 + 478000907
45  ???                                 0x1c7dd755 0x0 + 478009173
46  ???                                 0x1c7dd4cf 0x0 + 478008527
47  ???                                 0x1c7dd46e 0x0 + 478008430
48  ???                                 0x1c7dd413 0x0 + 478008339
49  ???                                 0x1a1ef511 0x0 + 438236433
50  ???                                 0x1a1eef87 0x0 + 438235015
51  ???                                 0x1a1eeea6 0x0 + 438234790
52  ???                                 0x1a1eedcc 0x0 + 438234572
53  ???                                 0x1a1ee91c 0x0 + 438233372
54  ???                                 0x1a1ee740 0x0 + 438232896
55  ???                                 0x1a1ee34c 0x0 + 438231884
56  ???                                 0x1a1ee6dd 0x0 + 438232797
57  iSell                               0x00009282 mono_jit_runtime_invoke + 722
58  iSell                               0x00152a8e mono_runtime_invoke + 126
59  iSell                               0x00200ff6 monotouch_trampoline + 3686
60  UIKit                               0x019fb285 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1194
61  UIKit                               0x019fb4ed -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 201
62  Foundation                          0x00a415b3 __NSFireDelayedPerform + 380
63  CoreFoundation                      0x03e81376 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
64  CoreFoundation                      0x03e80e06 __CFRunLoopDoTimer + 534
65  CoreFoundation                      0x03e68a82 __CFRunLoopRun + 1810
66  CoreFoundation                      0x03e67f44 CFRunLoopRunSpecific + 276
67  CoreFoundation                      0x03e67e1b CFRunLoopRunInMode + 123
68  GraphicsServices                    0x04e177e3 GSEventRunModal + 88
69  GraphicsServices                    0x04e17668 GSEventRun + 104
70  UIKit                               0x0194bffc UIApplicationMain + 1211
71  ???                                 0x0edecc8d 0x0 + 249482381
72  ???                                 0x0edec790 0x0 + 249481104
73  ???                                 0x0edec56c 0x0 + 249480556
74  ???                                 0x0edec3a4 0x0 + 249480100
75  ???                                 0x0edec516 0x0 + 249480470
76  iSell                               0x00009282 mono_jit_runtime_invoke + 722
77  iSell                               0x00152a8e mono_runtime_invoke + 126
78  iSell                               0x00156db4 mono_runtime_exec_main + 420
79  iSell                               0x00157125 mono_runtime_run_main + 725
80  iSell                               0x000641d5 mono_jit_exec + 149
81  iSell                               0x001f63a4 main + 1988
82  iSell                               0x00002be5 start + 53
83  ???                                 0x00000004 0x0 + 4

================================================================= 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.

Can someone help me?

sqlite
xamarin.ios
asked on Stack Overflow Jun 10, 2013 by Matteo

1 Answer

2

It might very well be a problem with the garbage collector. Make sure you dispose and set to null your SQLCommand and reader. Take a look at this: http://www.aaronheise.com/2012/12/monotouch-sqlite-sigsegv/#comment-10

answered on Stack Overflow Dec 17, 2013 by user3112189

User contributions licensed under CC BY-SA 3.0