On 07.04.2011 17:49, Christian Kessing (VOKS GmbH) wrote:
> If I add more than one, for example 1000 new entities to an
> objectcontext and call saveChanges the call to saveChanges hangs or I
> get a NullReferenceException while the transaction for the insert
> committed.
> 
> The NullReferenceException is thrown in the class FbConnectionInternal
> in the method RemovePreparedCommand. In the method is a for loop that
> tries to find the right preparedCommand to remove from a list but
while
> looping over the list the list becomes empty. In the debugger
> preparedCommand.count is 0 while the loop in my tests tries to fetch
an
> object number in the range 69 to 873 from the list. A race condition I
> guess.
> 
> If saveChanges hangs and I attach a debugger it leads to an instance
of
> the GdsStatement class. It waits for the lock in the method
> "TransactionUpdated".
> 
> I use Firebird V2.5.0.26074 and Firebird.Net 2.6.0.0 on a quadcore
cpu.
> 
> Can someone reproduce it? If not maybe a suggestion for something I
can
> change in the code to get more information about this problem.
> 
> Is this related to this bug?:
> http://tracker.firebirdsql.org/browse/DNET-316


For my Sampleproject to reproduce this behaviour I use this Table:

CREATE TABLE "TestTable"
(
  ID Integer NOT NULL,
  EINENUMMER Integer,
  PRIMARY KEY (ID)
);

Then I create the Entities with Visual Studio and use this Program:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FirebirdSql.Data.Client;

namespace DemoProjektFuerBug
{
    class Program
    {
        static void Main(string[] args)
        {            
            using (var ents = new Entities()) {                
                for (int i = 0; i < 1000; i++) {
                    ents.AddToTestTable(new TestTable() { ID = i,
EINENUMMER = i });
                }                
                ents.SaveChanges();
            }
        }
    }
}


If I test in Debug-Mode with Firebird.Net provider compiled in
Debug-Mode it often works. Maybe because of the slowdown that's caused
by the trace of the generated SQL in the Immediate Window of Visual
Studio.

If I save only a few Entities in saveChanges like in the following
Program

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DemoOhneSourceFirebirdBug
{
    class Program
    {
        static void Main(string[] args)
        {
            int numberofentities = 7;
            using (var ents = new Entities())
            {
                for (int i = 0; i < 100000; i++)
                {
                    ents.AddToTestTable(new TestTable() { ID = i,
EINENUMMER = i });
                    if (i % numberofentities == 0) { ents.SaveChanges();
Console.WriteLine(i); }
                }

                ents.SaveChanges();
            }
        }
    }
}

It crashes at average after a few ten thousands of Entities.

So, does it relate to this:
http://tracker.firebirdsql.org/browse/DNET-316 ? I just tried the 2.5.2
dll and it has the same problem. 2.5.1 works.

Christian Kessing


------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to