resubmit: out of memory when submitting large number of inserts in transaction
------------------------------------------------------------------------------

                 Key: CORE-4780
                 URL: http://tracker.firebirdsql.org/browse/CORE-4780
             Project: Firebird Core
          Issue Type: Bug
          Components: Engine
    Affects Versions: 2.5.4
         Environment: Windows 7 32bit 4Gb RAM (3.5 GB available)
Firebird 32bit v2.5.4
            Reporter: Peter Elzner
            Priority: Critical


Our program runs into an "unable to allocate Memory from Operation System" 
error, the firebird Service is consuming 2GB of RAM in the Windows Task Manager 
and then crashes.
The Problem only happens with the 32bit Version of Firebird on a 32bit Windows 
with more than 2GB of RAM.

Our program starts a transaction and then fires a lot (100k) update statements 
using a stored procedure.
You can observe in the Task Manager that Firebird consumes more and more memory 
and then crashes.
This does not happen on machines with 2GB or less memory.


Steps to reproduce this bug:


1. Create an empty database

2. 
CREATE TABLE table1
(
    id varchar ( 10 ),
    sometext1 varchar ( 256 ),
    sometext2 varchar ( 256 ),
    sometext3 varchar ( 256 ),
    
    CONSTRAINT pk1
        PRIMARY KEY (id)
);

3. 
SET TERM ^ ;
CREATE OR ALTER PROCEDURE addline (
    id varchar ( 10 ),
    sometext1 varchar ( 245 ),
    sometext2 varchar ( 245 ),
    sometext3 varchar ( 245 ) )
as
BEGIN
  update or insert into TABLE1
  (id, sometext1, sometext2, sometext3)
  VALUES
  (:id, :sometext1, :sometext2, :sometext3);
end^

SET TERM ; ^


4. Execute this .net code:

FbConnectionStringBuilder sb = new FbConnectionStringBuilder();

sb.UserID = "test";
sb.Password = "test";
sb.Database = @"c:\data\testDatabase.gdb";

FbConnection fCon = new FbConnection(sb.ConnectionString);

fCon.Open();

FbTransaction transaction = fCon.BeginTransaction();

try
{
    int i = 0;

    while (i < int.MaxValue)
    {
        i++;

        FbCommand cmd = fCon.CreateCommand();
        cmd.Transaction = transaction;
        cmd.CommandText = string.Format("EXECUTE PROCEDURE addline ('{0}', 
'test1-{0}', 'test2-{0}', 'test3-{0}')", i);

        cmd.ExecuteNonQuery();
    }
}
finally
{
    transaction.Rollback();
}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to