Icon View Incident Report

Serious Serious
Reported By: Phillip Percival
Reported On: 6/8/2004
For: Version 4.07 Build 1
# 1750 The Database Server Under Delphi 6 or 7 or Kylix 2 or 3 Can Result in Endless Loops From Disconnects

The WaitForData() method in the sockets.pas unit can return FALSE immediately without there being any signalling of socket errors. In using Winsock.Select() [under XP Pro] instead of WaitForData() I found this to be the case. The Winsock.Select() can return a non-zero result immediately with the read signal set after/during a socket failure !!! I know that is true because I had to code for it to make my own threaded server and client components work after failures. I actually found Winsock.Select() to be
pretty lame at signalling socket errors as well.

**** In this specific case Sockets.TBaseSocket.WaitForData() will return FALSE because its result hinges on recv(MSG_PEEK)<>0. Thats why I use Winsock.Select() and then if FD_SET(rxSignal) check recv(MSG_PEEK)=0 for a
socket error because WaitForData()=FALSE doesn't tell me anything !!

Looking at DBISAM in TBaseThread.Receive(), you loop on:

while (not Terminated) and ClientSocket.Connected and
(TotalBytesReceived < ReceiveSize) do
begin
...

if WaitForData(..., 1000) then
begin
...
end;

end;

But there is no test on recv() if WaitForData(..., 1000) returns FALSE immediately before the timeout period as in my special case above!!!


Resolution Resolution
Fixed Problem on 6/8/2004 in version 4.08 build 1
Image