System.Data.SQLite
Check-in [5cc9167d46]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Make sure to check for a null connection handle prior to calling the GC.SuppressFinalize method.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5cc9167d46a30e2ae493f7abedb1b8eaba1b0172
User & Date: mistachkin 2012-05-04 18:28:34
Context
2012-05-04
19:21
Modify test case for ticket [996d13cd87] to add some more stress testing and some additional diagnostic messages. check-in: 4faf9420bd user: mistachkin tags: trunk
18:28
Make sure to check for a null connection handle prior to calling the GC.SuppressFinalize method. check-in: 5cc9167d46 user: mistachkin tags: trunk
16:04
Prevent returning a connection handle whose finalizer may be pending on the GC thread. Part of fix for ticket [996d13cd87]. Also, update Eagle in externals to latest trunk. check-in: 5c0646db9d user: mistachkin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to System.Data.SQLite/SQLiteConnectionPool.cs.

157
158
159
160
161
162
163

164

165
166
167
168
169
170
171
...
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
            if (poolQueue == null) return null;
        }

        while (poolQueue.Count > 0)
        {
            WeakReference cnn = poolQueue.Dequeue();
            if (cnn == null) continue;

            SQLiteConnectionHandle hdl = cnn.Target as SQLiteConnectionHandle;


            //
            // BUGFIX: For ticket [996d13cd87], step #1.  After this point,
            //         make sure that the finalizer for the connection handle
            //         just obtained from the queue cannot START running (i.e.
            //         it may still be pending but it will no longer start
            //         after this point).
................................................................................

                //
                // BUGFIX: For ticket [996d13cd87], step #3.  Next, verify that
                //         the connection handle is actually valid and [still?]
                //         not closed prior to actually returning it to our
                //         caller.
                //
                if ((hdl != null) && !hdl.IsClosed && !hdl.IsInvalid)
                {
                    Interlocked.Increment(ref _poolOpened);
                    return hdl;
                }
            }
            finally
            {







>

>







 







|







157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
...
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
            if (poolQueue == null) return null;
        }

        while (poolQueue.Count > 0)
        {
            WeakReference cnn = poolQueue.Dequeue();
            if (cnn == null) continue;

            SQLiteConnectionHandle hdl = cnn.Target as SQLiteConnectionHandle;
            if (hdl == null) continue;

            //
            // BUGFIX: For ticket [996d13cd87], step #1.  After this point,
            //         make sure that the finalizer for the connection handle
            //         just obtained from the queue cannot START running (i.e.
            //         it may still be pending but it will no longer start
            //         after this point).
................................................................................

                //
                // BUGFIX: For ticket [996d13cd87], step #3.  Next, verify that
                //         the connection handle is actually valid and [still?]
                //         not closed prior to actually returning it to our
                //         caller.
                //
                if (!hdl.IsClosed && !hdl.IsInvalid)
                {
                    Interlocked.Increment(ref _poolOpened);
                    return hdl;
                }
            }
            finally
            {