Bug 11153 - SQLiteConnection leaks file descriptors
Summary: SQLiteConnection leaks file descriptors
Status: VERIFIED INVALID
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 6.1.x
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-03-14 09:12 UTC by mq
Modified: 2013-03-14 11:14 UTC (History)
3 users (show)

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


Attachments
Sample project (6.51 KB, application/x-zip-compressed)
2013-03-14 09:12 UTC, mq
Details


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:
VERIFIED INVALID

Description mq 2013-03-14 09:12:39 UTC
Created attachment 3615 [details]
Sample project

Hello,

We ran into strange problem where file descriptor run out. Tracked the problem down 
with Instruments to SQLiteConnection. Seems that standard usage:

using(var conn = ....)
{
   ..use database..
   conn.Close();
}

is not closing files. Open files grow up to ~250 and then crash occurs. 
I have prepared and attached simple project where each button click 10x opens connection, 
writes something and then closes connection. After ~24 clicks crash occurs.
In instrumenst you can see that conn.Close() actually does not close the file.
Does anyone have workaround?
Comment 1 Rolf Bjarne Kvinge [MSFT] 2013-03-14 09:33:34 UTC
If you make Xamarin Studio break on Mono.Data.Sqlite.SqliteExceptions (menu Run -> Exceptions), you'll see that the close fails: "unable to close due to unfinalised statements". And the reason you get that is because you're not calling Dispose on the command you create in DbHelper.ExecSQL_NonQuery.
Comment 2 mq 2013-03-14 10:16:32 UTC
Indeed explicitly disposing Command solves the problem. Tks for help.
Comment 3 Saurabh 2013-03-14 11:14:15 UTC
As per above comments changing the status to Verified.