System.Data.SQLite

Check-in [0fb2e3848f]
Login

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

Overview
Comment:Update test case for ticket [996d13cd87]. The test case can now reproduce the issue reported.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | tkt-996d13cd87
Files: files | file ages | folders
SHA1: 0fb2e3848f087b248801b2e33730d9bd12b74261
User & Date: mistachkin 2012-05-02 18:28:03.703
Context
2012-05-02
18:38
Merge all connection pool fixes and other changes to trunk. Fix for ticket [996d13cd87]. check-in: ae1f4354e4 user: mistachkin tags: trunk
18:28
Update test case for ticket [996d13cd87]. The test case can now reproduce the issue reported. Closed-Leaf check-in: 0fb2e3848f user: mistachkin tags: tkt-996d13cd87
16:52
Adjustments to the test case for ticket [996d13cd87]. However, this still does not reproduce the issue reported. check-in: 04c8756a93 user: mistachkin tags: tkt-996d13cd87
Changes
Unified Diff Ignore Whitespace Patch
Changes to Externals/Eagle/bin/EagleShell.exe.config.
14
15
16
17
18
19
20

21
22
23
24
25
26
27
<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
  </startup>

  <runtime>
    <!--

    <NetFx40_LegacySecurityPolicy enabled="true" />
    <generatePublisherEvidence enabled="false" />
    -->

    <!--
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>







>







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
  </startup>

  <runtime>
    <!--
    <legacyCorruptedStateExceptionsPolicy enabled="true" />
    <NetFx40_LegacySecurityPolicy enabled="true" />
    <generatePublisherEvidence enabled="false" />
    -->

    <!--
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
Changes to Tests/tkt-996d13cd87.eagle.
21
22
23
24
25
26
27





28
29
30
31
32
33
34
###############################################################################

runTest {test tkt-996d13cd87-1.1 {SQLiteConnectionPool stress} -setup {
  set fileName tkt-996d13cd87-1.1.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]






  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data.SQLite;
    using System.Diagnostics;







>
>
>
>
>







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
###############################################################################

runTest {test tkt-996d13cd87-1.1 {SQLiteConnectionPool stress} -setup {
  set fileName tkt-996d13cd87-1.1.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql { \
    CREATE TABLE t1(x TEXT); \
    INSERT INTO t1 (x) VALUES(HEX(RANDOMBLOB(1000))); \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data.SQLite;
    using System.Diagnostics;
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
          //       test threads.
          //
          int errors = 0;

          //
          // NOTE: This is the total number of test threads to create.
          //
          int count = 200;

          //
          // NOTE: Create a random number generator suitable for waiting a
          //       random number of milliseconds between each attempt to
          //       cause the race condition on a given thread.
          //
          Random random = new Random();







|







50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
          //       test threads.
          //
          int errors = 0;

          //
          // NOTE: This is the total number of test threads to create.
          //
          int count = 100;

          //
          // NOTE: Create a random number generator suitable for waiting a
          //       random number of milliseconds between each attempt to
          //       cause the race condition on a given thread.
          //
          Random random = new Random();
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96


97
98
99
100



101
102
103
104
105
106
107
                goEvent.WaitOne();

                //
                // NOTE: Repeatedly try to create, open, and close a pooled
                //       database connection and then wait a random number of
                //       milliseconds before doing it again.
                //
                for (int index = 0; index < count; index++)
                {
                  Thread.Sleep(random.Next(0, 250));

                  SQLiteConnection connection = new SQLiteConnection(
                      "Data Source=${dataSource};Pooling=True;");

                  connection.Open();


                  connection.Close();

                  connection = null;
                }



              }
              catch (Exception e)
              {
                Interlocked.Increment(ref errors);
                Trace.WriteLine(e);
              }
            };







<
<
|

|
|

|
>
>
|
|
|

>
>
>







87
88
89
90
91
92
93


94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
                goEvent.WaitOne();

                //
                // NOTE: Repeatedly try to create, open, and close a pooled
                //       database connection and then wait a random number of
                //       milliseconds before doing it again.
                //


                Thread.Sleep(random.Next(0, 500));

                SQLiteConnection connection = new SQLiteConnection(
                    "Data Source=${dataSource};Pooling=True;");

                connection.Open();

                using (SQLiteCommand command = new SQLiteCommand("${sql}",
                    connection))
                {
                  command.ExecuteNonQuery();
                }

                connection.Close();
                connection = null;
              }
              catch (Exception e)
              {
                Interlocked.Increment(ref errors);
                Trace.WriteLine(e);
              }
            };
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
                //
                goEvent.WaitOne();

                //
                // NOTE: Wait a random number of milliseconds before forcing a
                //       full garbage collection.
                //
                Thread.Sleep(random.Next(0, count * 100));
                GC.GetTotalMemory(true);
              }
              catch (Exception e)
              {
                Interlocked.Increment(ref errors);
                Trace.WriteLine(e);
              }







|







129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
                //
                goEvent.WaitOne();

                //
                // NOTE: Wait a random number of milliseconds before forcing a
                //       full garbage collection.
                //
                Thread.Sleep(random.Next(0, 1000));
                GC.GetTotalMemory(true);
              }
              catch (Exception e)
              {
                Interlocked.Increment(ref errors);
                Trace.WriteLine(e);
              }
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
      } result] : [set result ""]}] $result
} -cleanup {
  object invoke System.Data.SQLite.SQLiteConnection ClearAllPools
  object invoke GC GetTotalMemory true

  cleanupDb $fileName

  unset -nocomplain result results errors code dataSource id db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -match \
regexp -result {^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 0$}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue







|








215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
      } result] : [set result ""]}] $result
} -cleanup {
  object invoke System.Data.SQLite.SQLiteConnection ClearAllPools
  object invoke GC GetTotalMemory true

  cleanupDb $fileName

  unset -nocomplain result results errors code sql dataSource id db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -match \
regexp -result {^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 0$}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue