Subject RE: [firebird-support] Re: I/O error or Internal gds error when running many concurrent transactions
Author Alan McDonald
> > > Hi,
> > >
> > > I have a thread repeatly inserts and updates several tables (with
> > > triggers). When I run 100 instances of the same thread, sometimes when
> > > starting the application I received the following exception, either
> > > the first or the second:
> > >
> > > 1. FirebirdSql.Data.FirebirdClient.FbException: I/O error for file
> > > CreateFile (open) "tmcdb.fdb" Error while trying to open file
> > >
> > > 2. FirebirdSql.Data.FirebirdClient.FbException: internal gds software
> > > consistency check (can't continue after bugcheck)
> > >
> > > I used Firebird 1.5.2.4731 superserver to create the template
> > > database, and used fbembed.dll(v.1.5.3.4870) to run the server in
> > > embedded mode.
> > >
> > > The problem only occurs at the first round of threads' execution. If
> > > the first round is fine, it will continue running with no problem.
> > >
> > > How can I avoid this?
> > >
> > > Thank you very much!
> > > Sean
> >
> > java? .NET?
> > anyway - are you ensuring that each thread is using it's own
> connection? if
> > we knew what language/connection components used we could indicate some
> > other requirements.
> > Alan
> >

I think you shoudl, then, ask at the fb-dotnet group to see what else you
may need to do to ensure thread safety
Alan

>
> Hi,
>
> It's .NET with Firebird ADO.NET Data Provider 2.0 RC1 (version
> 2.0.50727). I am using connection pool with size of 1000. For every
> transaction I open a connection and close it right after the
> transaction is committed or rolled back.
>
> The (simplified) code is like this:
> ------------------------------------
> public int ExecuteStoredProcedure(string sqlCommand, ref IList paramList)
> {
> int retval = 0;
>
> DateTime start = DateTime.Now;
>
> FbConnection conn;
> GetFBConnection(out conn);
>
> FbCommand fbCommand;
> fbCommand = conn.CreateCommand();
> fbCommand.CommandText = sqlCommand;
> if (paramList != null)
> foreach (Object obj in paramList)
> {
> fbCommand.Parameters.Add(obj);
> }
> fbCommand.CommandType = System.Data.CommandType.StoredProcedure;
>
> FbTransaction txn = null;
> txn = conn.BeginTransaction(FbTransactionOptions.Concurrency);
> fbCommand.Transaction = txn;
> retval = fbCommand.ExecuteNonQuery();
> txn.Commit();
> ReleaseFBConnection(conn);
> fbCommand.Dispose();
>
> return retval;
> }
>
> private void GetFBConnection(out conn)
> {
> FbConnection fbc = new FbConnection(_connectionString);
> fbc.Open();
> conn = fbc;
> }
> private void ReleaseFBConnection(FbConnection fbc)
> {
> fbc.Close();
> fbc.Dispose();
> }