Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 20 total
Thread Out of Memory issues with DBSRVR
Fri, Jun 2 2006 4:09 AMPermanent Link

Paul Candido
Hi,

As soon as we get a few users on our system (around 10-15) we get the following errors in
dbsrvr.log and the dbsrvr then starts dropping clients and crashes. We then usually have
to repair some of our bigger tables (180,000 records) as they have corrupt indexes.
Sometimes there is also reported data loss.
This begun after an upgrade we did to our program which introduced quite a bit of new
code, we were using 4.22 b5 before and after the update, we then upgraded to 4.24 b1 and
we still have the same problem. Can you let us know what to look for in our code to lower
the amount of memory/CPU  we are using.

2/06/2006 2:09:49 PM [ERROR] Engine error [Out of memory] [Client Version: 4.24 User Name:
CJ Address: 10.12.24.193 Encrypted: No Request: REQUEST_EXECUTESTMT Thread: 4528 Session:
520534024]
2/06/2006 2:09:49 PM [ERROR] Engine error [Out of memory] [Client Version: 4.24 User Name:
CJ Address: 10.12.24.193 Encrypted: No Request: REQUEST_FREESTMT Thread: 4528 Session:
520534024]
2/06/2006 2:09:50 PM [ERROR] Engine error [Out of memory] [Client Version: 4.24 User Name:
CJ Address: 10.12.24.193 Encrypted: No Request: REQUEST_EXECUTESTMT Thread: 4528 Session:
520534024]
2/06/2006 2:09:50 PM [ERROR] Engine error [Out of memory] [Client Version: 4.24 User Name:
ES Address: 10.12.24.165 Encrypted: No Request: REQUEST_PREPARESTMT Thread: 2408 Session:
353173512]
2/06/2006 2:09:50 PM [ERROR] Engine error [Access violation at address 004E52BB in module
'dbsrvr.exe'. Read of address 00000008] [Client Version: 4.24 User Name: ES Address:
10.12.24.165 Encrypted: No Request: REQUEST_PREPARESTMT Thread: 2408 Session: 353173512]
2/06/2006 2:09:50 PM [ERROR] Engine error [Access violation at address 004E52BB in module
'dbsrvr.exe'. Read of address 00000008] [Client Version: 4.24 User Name: CJ Address:
10.12.24.193 Encrypted: No Request: REQUEST_PREPARESTMT Thread: 4528 Session: 520534024]

Server Stats:
operating system  : Windows 2003 Service Pack 1 build 3790
system language   : English
system up time    : 22 hours 47 minutes
program up time   : 20 hours 1 minute
processors        : 2x Intel(R) Xeon(TM) CPU 3.20GHz
physical memory   : 438/2048 MB (free/total)
free disk space   : (CSmile118.72 GB
display mode      : 1024x768, 32 bit

We have also been able to trap the following exception message from dbsrvr:
exception class   : EThread
exception message : Thread Error: The handle is invalid (6).

Any help with this would be greatly appreciated.
Fri, Jun 2 2006 11:00 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Paul,

<< As soon as we get a few users on our system (around 10-15) we get the
following errors in dbsrvr.log and the dbsrvr then starts dropping clients
and crashes. We then usually have to repair some of our bigger tables
(180,000 records) as they have corrupt indexes.
Sometimes there is also reported data loss.  This begun after an upgrade we
did to our program which introduced quite a bit of new code, we were using
4.22 b5 before and after the update, we then upgraded to 4.24 b1 and we
still have the same problem. Can you let us know what to look for in our
code to lower the amount of memory/CPU  we are using. >>

Do you actually have an idea of whether you are running out of memory when
you get that many users ?  How many tables are being opened per user session
(approximately) ?  Also, are you modifying the engine buffering settings at
all for the database server ?

--
Tim Young
Elevate Software
www.elevatesoft.com

Fri, Jun 2 2006 1:41 PMPermanent Link

Paul Candido
Hi Tim thanks for the quick response,

<<Do you actually have an idea of whether you are running out of memory when
you get that many users ?>>
Further testing reveals that it is accumatively building memory up as you run certain
functions in our program and the server doesn't seem to be freeing it.

<<How many tables are being opened per user session
(approximately) ?>>
Approx 50-60 in the datamodule this has always been like this and hasn't seemed to have
caused any issues to my knowledge. The new functions that seem to be building the memory
issues are more query based. Lots of queries running in loops.

<<Also, are you modifying the engine buffering settings at all for the database server ?>>
Nope

Thanks again
We are desperatly trying to resolve this as fast as possible, so any help you can give us
would be very much appreciated! Smile
Fri, Jun 2 2006 2:05 PMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Paul


Have you tried using FastMM - it helps as far as memory fragmentation is concerned.

Roy Lambert
Sat, Jun 3 2006 6:23 AMPermanent Link

Paul Candido
Hi Roy,

Thanks for the reply!
The problem we are having with memory resides on the server. Are you suggesting
recompiling DBSRVR with FASTMM? As I don't think putting FastMM in our client program will
solve any memory issues on the server? Unless the Error from DBISAM is suggesting the
client's Machine is out of memory? In which case why would DBSRVR be dropping everyone
from the server once we get this message and causing Access Violations on DBSRVR?

Thanks again for the suggestion Roy, I am pretty stumped on this one and it is quickly
becoming an urgent matter for us so any help with this issue is greatly appreciated.

- Paul

Sat, Jun 3 2006 8:48 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Paul


I was thinking of the server. I know its not too likely but there have been a number of posts about Windows/Delphi memory fragmentation and FastMM is meant to be far better at sorting it out. Also, at least run through the IDE, it will tell you if you have memory leaks. Tracking them down can be a bit of a pig though.

Roy Lambert
Sat, Jun 3 2006 2:36 PMPermanent Link

"Ralf Mimoun"
Paul Candido wrote:
> Hi Roy,
>
> Thanks for the reply!
> The problem we are having with memory resides on the server. Are you
> suggesting recompiling DBSRVR with FASTMM?

Won't help much because the server uses DBISAMMM as memory manager. It
solves the fragmentation problem, too.

Do you use the server out of the box, or ist there addtional code?

Ralf
Sat, Jun 3 2006 11:38 PMPermanent Link

Paul Candido
Hi Ralf,

Thanks for the reply,

<<Do you use the server out of the box, or ist there addtional code?>>
We have one additional event assigned to the engine object against
ServerEngineBeforeDeleteTrigger.

 if (AnsiCompareText(lowercase(TableName),'tablename')=0) then
 with TDBISAMQuery.Create(self) do
   try
     SessionName:=TriggerDatabase.SessionName;
     DatabaseName:=TriggerDatabase.DatabaseName;
     RequestLive:=True;
     SQL.Text:='insert into Deleted_tablename '+
               'select * from tablename where '+
               'primarykey = '+CurrentRecord.FieldByName('primarykey').AsString;
     try
       ExecSQL;
     finally
        Close;
     end;
   finally
     free;
   end;

That's the only bit of additional code we recompile into DBSRVR. We do delete in the
function that seems to be causing the problem but it isn't from the table we are using in
this trigger.

Thanks,

- Paul
Mon, Jun 5 2006 9:47 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Paul,

<< Further testing reveals that it is accumatively building memory up as you
run certain functions in our program and the server doesn't seem to be
freeing it. >>

Could you send me the code that is causing the issue ?  Perhaps a little
eyeball work might spot something.

BTW, you can also compile the DBISAM memory manager (dbisammm.pas) with this
define:

{$IFDEF DBISAM_MEMLEAKS}

and it will report whether there is memory still allocated when the memory
manager (and the database server) shuts down.  That may at least give you an
idea if there is actually a leak or not.  If you want to send me a project
that can run your code, I can also do the same for you here.

--
Tim Young
Elevate Software
www.elevatesoft.com

Tue, Jun 6 2006 4:01 AMPermanent Link

Paul Candido
Hi Tim,

You were right a bit of eyeball over the code turned up that one of the queries I was
using in my loop didn't have a close before free which was causing the memory to build.

Although another problem has now presented itself, we have now had 3 sites saying that
after awhile of use the DBSRVR will stop and deny any more new connections. When this
happens the message "Cannot open or create log file C:\Path\to\logfile\DBSRVR.log for
database server." which is then shortly followed by an Access Violation in DBSRVR.

I have been able to get my hands on two log files, I have located the following errors:
[ERROR] Internal error removing session [Access violation at address 7C8396D0 in module
'ntdll.dll'. Read of address 502D3AE5] [Client Version: 0.00 User Name: HD Address:
10.12.25.239 Encrypted: No Thread: 5036 Session: 44701704]
[ERROR] Internal error removing session [External exception C0000008] [Client Version:
0.00 User Name: ATE Address: 10.12.25.248 Encrypted: No Thread: 6008 Session: 45455368]
[ERROR] Engine error [Access violation at address 00407E09 in module 'dbsrvr.exe'. Read of
address D8371A2C] [Client Version: 4.24 User Name: KK Address: 10.12.25.106 Encrypted: No
Request: REQUEST_PREPARESTMT Thread: 5036 Session: 207063048]

There is also a lot of warnings that Re-connections were rejected.

I can send you these 2 log files if that helps?

Just so you know that this is with the new version of our program with the fix for the
memory problem, and we are not receiving the Out of Memory error any longer so I don't
think that this will be a related issue.

Thanks,

- Paul
Page 1 of 2Next Page »
Jump to Page:  1 2
Image