I've written a client server/database application that works beautifully
with a single client. Unfortunately, when another client connects, the
server freezes after a few requests. Here's how it's set up:
- Server event (Handler) fires when a client sends a command.
- A database connection is obtained from a pool of connections (done within
a critical section)
- The database is queried <--- This is where the problem occurs!!!
- The database connection is released back to the pool of connections
The application gets stuck in "IdServerIOHandlerSocket", line 50:
while not AThread.Stopped do begin
if LIOHandler.Binding.Select(ASocket, 100) then begin // Wait for 100
ms <--- Gets stuck here!
if LIOHandler.Binding.Accept(ASocket) then begin
If I remove the database query, everything works fine. If I wrap the entire
event in a critical section, everything is OK.
I know I must be doing something wrong here. Probably some basic thread
guideline that I'm not adhering to. My question is, how do people normally
write to databases within Indy events? Are there any example projects?
Please bear in mind that I am relatively new to Indy.
I'm using Delphi 7 Arch, Indy 9 and FIBPlus components connecting to a
Firebird 1.5 database.
If anybody thinks it will help, I may be able to send them some of the