Delphi CGIs hanging when too many simulateous DB Connections

Posted on 2003-02-23
Medium Priority
Last Modified: 2013-11-23
The system we are developing uses one database and
can be accessed using BDE from over 20 computers
 simulataneously via Websnap.Each database connection
 uses a different Session.When testing the system with
 21 connections if there is a lot of access to the DB
 all at once (or in a very short timespan) sometimes all the CGI Processes hang.

While the processes are hung trying to open the BDE Administrator produces an error 2A06.

Our customer is currently spitting fire at the
 delay in finding and fixing this problem.

Please any advice would be great , before somebody
 is coming after me with an axe (~_~;;;

Sorry but 75 is all the points I have )-:
Question by:brian_sweeney
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
  • +3

Expert Comment

ID: 8002495
you might have a blocking or deadlocking problem at the database. Wich DB are you using?

Expert Comment

ID: 8002510
- Did you try to convert it to ISAPI instead?
- Did you close all opened tables using try finally?
- Did you handle all exceptions?

  Table1.Close; // Normal close
  on e: exception do
    Table1.Close; // Error occured
    Response.Content:= E.Message;
  end; // on e:..
end; // try


Author Comment

ID: 8002517
As Fujitsu is a customer I am using Fujitsu's Symfoware.
Unfortunately there is not much information about this Database on the web.
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 8002549
Thanks for your quick response.
Unfortunately We cannot change to ISAPI, and we cannot change the database.All exceptions are handled and all Database Operations are performed within try..finally clauses.Exceptions are displayed in the browser.
We also tested using an application that launched, accessed the DB and terminated numerous times at the same time as the CGIs were running. After numerous tests the Application and CGIs hung. This was after Application.Terminate was called and the main window closed. Using a log file to debug the application we saw that the DB was successfully closed, the Application Window was destroyed, there was no exception message or any form of sytem dialog box but the the Application Process did not terminate(checked via the task manager). The CGIs terminated eventually after the System CGI Timeout but even then the Application process did not end.

Again it was impossible to open the BDE Administrator application.

The system is Windows 2000. The Delphi Version is 6.


Expert Comment

ID: 8002580
well it looks like this would be a BDE problem the error code 2A06 maens :Engine not initialized.

let me see if i find some more informations ...

Expert Comment

ID: 8002647
well i found this article that night be helpful :

Author Comment

ID: 8002731
Thanks but the only problems there , that could possibly pertain to my case are fixed by the Service Pack 2 which we have installed.
LVL 21

Accepted Solution

ziolko earned 225 total points
ID: 8002992
as Motaz poinetd out ISAPI would be better solution, but if You still want CGI no rpoblem, in this case it's problem of BDE switch to ADO and multiple users problem will disapear, BDE is not good while more then 16-18 users (different sessions) working at same time.

Author Comment

ID: 8003076
Hi ziolko. Thanks for your reply. Where did you get the information about more than the 16-18 users being not good?
LVL 21

Expert Comment

ID: 8003158
It's not from any kind of documentation but from my experience, I've created web server based on ISAPI in the begining I've used BDE, then tested it for many users executeing quite complex SQL queries and BDE caused many problems so I switched to ADO now software is used constantly by 20-25 users nad I have no problems at all.

Expert Comment

ID: 8003949
ADO *IS* a much better solution... faster, smoother, more updates available for it (thus it is allso less buggy). Additionally, you have to realize that unless you are running all of your DB processes as threads, they are probably making the natural program flow wait until they are done. It's simple and stupid, but often overlooked. If you know you have done something long and tedious and about to do something else, just as bad, run Application.ProcessMessages first, so it has the time to deal with answering CGI requests and dealing with any other messages that might have popped up.

Just my 2 cents. Hope it helps.

Expert Comment

ID: 8022287

Remember the BDE is not multi-treaded.

This will cause you problems.

You should not use the BDE in any Web applicattion. There are now other suitable solutions that you can use.

IB Components
are very good. DBISAM is one step up from the BDE, but the benefits are big.


Author Comment

ID: 8046418
Thanks everyone for answering.Sorry fo taking so long to answer but it took a while to test BDE and all the alternatives. It turned out ISAPI is stable but very slow.
Even when using ISAPI with BDE it wsas necessary to add a Mutex and delay to the CGIs after closing a DB connection so that the CGIs were not accessing the db at the same time.
Although it is more work to change everything now from BDE to ADO (having to retest the entire system again)it seems the best way to go.There is no need for Mutexes or delays.

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month11 days, 20 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question