System.Data.SQLite

Artifact [297db459dc]
Login

Artifact 297db459dc66c0c6db1d977eb9b23c9cb4f21dbb:

Ticket change [297db459dc] - Ticket [e30b820248] API called with finalized prepared statement status still Open with 1 other change by mistachkin 2011-11-17 00:49:26.
D 2011-11-17T00:49:26.721
J comment When\sI\scall\s.Close()\son\sthe\sdatabase\sconnection,\si\ssee\sthese\serrors:\r\n\r\nSQLite\serror\s(21):\sAPI\scalled\swith\sfinalized\sprepared\sstatement\r\nSQLite\serror\s(21):\smisuse\sat\sline\s61617\sof\s[3e0da808d2]\r\nSQLite\serror\s(21):\sAPI\scalled\swith\sfinalized\sprepared\sstatement\r\nSQLite\serror\s(21):\smisuse\sat\sline\s61617\sof\s[3e0da808d2]\r\nSQLite\serror\s(21):\sAPI\scalled\swith\sfinalized\sprepared\sstatement\r\nSQLite\serror\s(21):\smisuse\sat\sline\s61617\sof\s[3e0da808d2]\r\nSQLite\serror\s(21):\sAPI\scalled\swith\sfinalized\sprepared\sstatement\r\nSQLite\serror\s(21):\smisuse\sat\sline\s61617\sof\s[3e0da808d2]\r\nSQLite\serror\s(21):\sAPI\scalled\swith\sfinalized\sprepared\sstatement\r\nSQLite\serror\s(21):\smisuse\sat\sline\s61617\sof\s[3e0da808d2]\r\n\r\nCan\sI\ssafely\signore\sthem\sor\swhat\sdo\sthey\smean?\r\n\r\n<hr\s/><i>mistachkin\sadded\son\s2011-10-21\s10:41:20\sUTC:</i><br\s/>\r\nCould\syou\sprovide\ssome\sC#\scode\sthat\sdemonstrates\sthis\sissue?\r\n\r\n\r\n<hr\s/><i>anonymous\sadded\son\s2011-10-21\s13:21:00\sUTC:</i><br\s/>\r\nI\scan\ssee\sif\sI\scan\sprepare\sa\stest-case\sfor\syou,\sbut\smy\scode\sis\svery\sstraight-forward.\sI\screate\sa\stransaction,\screate\sa\sdbcommand,\sdispose\sthe\sdbcommand,\scommit\sthe\stransaction,\sdispose\sthe\stransaction.\r\n\r\nDo\syou\shave\sany\sidea\swhat\skind\sof\sproblems\scan\sgive\sthese\smessages?\sI\sdid\snot\ssee\sthem\swith\sthe\sdll\sof\sPHX\sSoftware,\sand\smy\scode\sdid\snot\schange.\r\n\r\n<hr\s/><i>mistachkin\sadded\son\s2011-10-22\s00:30:21\sUTC:</i><br\s/>\r\nSince\sI\shave\snot\sbeen\sable\sto\sreproduce\sthe\sproblem\swith\sany\sof\sthe\sexisting\stest\scode,\sit\swould\sbe\suseful\sto\shave\sany\sadditional\sinformation\syou\scould\sprovide.\r\n\r\n<hr\s/><i>anonymous\sadded\son\s2011-10-22\s16:33:42\sUTC:</i><br\s/>\r\nI\sjust\ssee\sthe\sabove\slines\sin\sthe\soutput\swindow\sof\sVisual\sStudio,\sthere\sis\sno\sexception\sraised,\sso\sthe\sexisting\stest-code\swill\snever\sfind\sthis\serror.\r\n\r\nI\stried\sto\sdebug\sit\sa\slittle\stoday,\sand\swhenever\smy\scode\sdid\ssome\scommits\swith\sparametrized\sinserts\s(.CreateParameter,\s.Parameters.Add,\setc)\sI\salways\ssee\sthese\smessages\supon\s.Close()\sof\sthe\sdb\sconnection.\r\n\r\nSo\sI\sthink\sthe\sparameters\sare\salready\sgarbage\scollected\sby\sthe\s.Net\sruntime,\sand\sthe\slibrary\sis\strying\sto\sdispose\sthem\sfor\sthe\ssecond\stime?\r\n\r\n<hr\s/><i>mistachkin\sadded\son\s2011-11-06\s21:10:11\sUTC:</i><br\s/>\r\nThis\sticket\sis\spending\sadditional\sinformation\sby\sthe\soriginal\sreporter.\r\n\r\n<hr\s/><i>anonymous\sadded\son\s2011-11-10\s21:49:06\sUTC:</i><br\s/>\r\nI\sthink\sI\sfound\sout\sthe\scause,\si\swas\sdoing:\r\n\r\n-\sDispose\sDbCommand\sobject\r\n-\sCommit\sTransaction\sobject\s\r\n-\sDispose\sTransaction\sobject\r\n\r\nWhen\sI\schange\sthe\sorder\sinto:\r\n\r\n-\sCommit\sTransaction\sobject\s\r\n-\sDispose\sTransaction\sobject\r\n-\sDispose\sDbCommand\sobject\r\n\r\nI\sdon't\ssee\sany\serror\smessages.\r\n\r\n<hr\s/><i>anonymous\sadded\son\s2011-11-13\s02:21:38\sUTC:</i><br\s/>\r\nI\sdon't\sthink\sthis\sticket\sshould\sbe\sclosed.\sIt's\sperfectly\slegal\sto\sdispose\sa\sDbCommand\sbefore\scommitting\sthe\stransaction?\r\n\r\nAlso,\sI\sfound\sthat\sI\scan\sreproduce\sthe\sissue\swithout\stransactions\sat\sall.\sWhen\sI\sopen\sthe\sdatabase,\sdo\sa\ssingle\scall\sto\sExecuteReader(),\sand\sclose\sthe\sdatabase,\sI\ssee\sthe\ssame\smessage\sif\sthe\sDbCommand\sis\salready\sdisposed\sor\sgarbage\scollected.\r\n\r\nI\swill\stry\sto\sfind\ssome\stime\sto\screate\ssome\sexample\scode\sthat\sreproduces\sthe\sissue.\s\r\n\r\n<hr\s/><i>mistachkin\sadded\son\s2011-11-13\s08:05:38\sUTC:</i><br\s/>\r\nThe\smessages\syou\sare\sseeing\sare\sgenerated\swhen\sthe\sconnection\sis\sclosed\sand\sare\sharmless.\s\sHowever,\sif\sthe\sSQLiteDataReader\sobject\sassociated\swith\sthe\sSQLiteCommand\sobject\sis\sexplicitly\sdisposed\sprior\sto\sthe\sconnection\sbeing\sclosed\s(or\sdisposed),\syou\sshould\snot\ssee\sthese\smessages.\r\n\r\n\r\n<hr\s/><i>anonymous\sadded\son\s2011-11-13\s13:55:43\sUTC:</i><br\s/>\r\nIf\syou\sare\ssure\sthat\sthese\smessages\sare\sharmless\s(no\smemory\sleaks\sor\sdata\sloss),\sthen\sthis\sticket\scan\sbe\sclosed.\r\n\r\n<hr\s/><i>mistachkin\sadded\son\s2011-11-13\s21:30:24\sUTC:</i><br\s/>\r\nI've\sbeen\sattempting\sto\sreproduce\sthis\sissue\shere,\ssee\scheck-in\s[68d2140bad].\s\sIs\sthis\sapproximately\swhat\syou\sare\sdoing?\r\n\r\nHere\sis\sa\slink\sto\sthe\slatest\sversion\sof\sthe\stest\scase\sI\sam\sworking\son\sfor\sthis\sissue:\s<a\shref="/index.html/artifact?ci=tip&filename=Tests/tkt-e30b820248.eagle">tkt-e30b820248.eagle</a>\r\n\r\nYou'll\snotice\ssome\sC#\scode\sembedded\sin\sthe\stest\sscript,\sthis\sis\swhat\sI\swould\slike\syour\sopinion\son.\r\n\r\n\r\n<hr\s/><i>mistachkin\sadded\son\s2011-11-13\s21:52:18\sUTC:</i><br\s/>\r\nThis\sticket\shas\sbeen\spromoted\sto\sa\sblocker\sfor\sthe\snext\srelease\s(77).\r\n\r\n<hr\s/><i>anonymous\sadded\son\s2011-11-14\s11:56:41\sUTC:</i><br\s/>\r\nThe\stest\sdoesnt\sneed\sany\stransactions,\sI\scan\sreproduce\swith\ssomething\slike\sthis:\r\n\r\nclass\sSqlDb\r\n{\r\nprivate\sDbConnection\sCon;\r\n\r\nvoid\sOpen\r\n{\r\n\s\s\s\sCon\s=\sFact.CreateConnection();\r\n\s\s\s\sCon.Open();\r\n}\r\n\r\nDbDatareader\sGetReader(string\ssCommand)\r\n{\r\n\s\s\s\sDbCommand\sCom\s=\sCon.CreateCommand();\r\n\s\s\s\sCom.CommandText\s=\ssCommand;\r\n\s\s\s\sreturn\sCom.ExecuteReader();\r\n}\r\n\r\nvoid\sClose()\r\n{\r\n\s\s\s\sCon.Close();\r\n\s\s\s\sCon.Dispose();\s\s\r\n}\r\n\r\n\r\nAnd\sthe\scode\sthat\striggers\sthe\sissue\sdoes\sthis:\r\n\r\n\r\nvoid\sExample()\r\n{\r\n\s\s\s\r\n\s\s\sDbDatareader\sRead\s=\sSqlDb.GetReader(query)\r\n\r\n\s\s\s[WORK]\r\n\r\n\r\n\s\s\sRead.Close()\r\n\s\s\sSqlDb.Close()\r\n\r\n}\r\n\r\n\r\n\r\nSo\swhat\sI\sthink\swhat\shappens\sis\sthat\sthe\soriginal\sDbCommand\sis\salready\sdisposed,\ssince\sGetReader()\sonly\sreturns\sthe\sDbDatareader,\snot\sthe\soriginal\scommand.\sThen\swhen\sthe\sdatabase\sis\sclosed,\sit\scannot\sfind\sthe\sreference\sto\sDbCommand\sanymore?\s\r\n\r\n<hr\s/><i>mistachkin\sadded\son\s2011-11-14\s23:50:33\sUTC:</i><br\s/>\r\nAre\syou\susing\sthe\sSQLite.Interop.dll\sor\sa\sstandard\ssqlite3.dll\s(either\sdownloaded\sor\scompiled\sfrom\ssources)?\r\n\r\n\r\n<hr\s/><i>anonymous\sadded\son\s2011-11-16\s01:10:13\sUTC:</i><br\s/>\r\nI'm\susing\sSqlite.Interop.dll,\sbut\sI\shave\sthe\ssame\serror\swhen\susing\sthe\sMixed-Mode\sassembly,\sso\sit's\sunrelated.\sI\sdid\snot\stry\swith\ssqlite3.dll\r\n\r\n<hr\s/><i>mistachkin\sadded\son\s2011-11-16\s03:17:24\sUTC:</i><br\s/>\r\nCould\syou\splease\stry\sto\scompile\sthe\slatest\scode\son\strunk\sand\ssee\sif\sthe\sissue\sstill\sappears?\r\n\r\n<hr\s/><i>anonymous\sadded\son\s2011-11-16\s20:38:19\sUTC:</i><br\s/>\r\nI\snever\sunderstood\show\sI\scan\sdownload\sthe\ssource\scode\sthrough\sFossil?\sThe\snormal\sSQLite\sFossil\srepository\shas\soptions\sto\sdownload\szips\sof\schangesets,\sbut\shere\sI\snever\ssee\sthat\soption?\r\n\r\n<hr\s/><i>mistachkin\sadded\son\s2011-11-17\s00:48:58\sUTC:</i><br\s/>\r\nWhen\slogged\sin\sas\s'anonymous'\syou\sshould\sbe\sable\sto\sdownload\sa\sZIP\sarchive\sof\sany\scheck-in\sin\sthe\ssource\stree.\s\sFor\sexample,\sthis\slink\sshould\swork:\r\n\r\n<a\shref="/index.html/zip/System.Data.SQLite-trunk.zip?name=trunk">ZIP\sof\slatest\strunk</a>
K e30b820248e1ecdd839e462646f5c9fe5965d6df
U mistachkin
Z 5a5141d88bb2f6328058eb76969860ba