Michael Stieler
2008-01-17 09:18:57 UTC
Hello,
we have massive problems debugging one of our products depending on
Indy 10.
The program is multi-threaded, and works fine for hours.. but then the
program exits with an access violation and I am not able to track it
because it never happened in the IDE yet.
Now at one time.. an access violation occured inside IDE and it pointed
me to inside TIdTCPClientCustom module, more specific, the Connect method.
At the top of the function there is
if IOHandler = nil then begin
IOHandler := MakeImplicitClientHandler;
IOHandler.OnStatus := OnStatus;
ManagedIOHandler := True;
end;
This call should make sure, that IOHandler is not nil inside the function.
After this there are a few calls to IOHandler which seemed to work.
For example:
IOHandler.Port := FPort; //BGO: just to make sure
The exception was thrown a few lines later at
IOHandler.Open;
Since I can't understand why this could happen in a linear execution,
I guess it happens because of a multi-threading issue.
I have the main VCL thread which can could the Connection (user clicks
Stop, but the error occurs without it) and have a "polling" thread which
checks if the connection is still open and re-opens if neccesary (every
30s) and in this thread context the communication is run, that is calls of
conn.IOHandler.WriteLn and conn.IOHandler.ReadLn;
(it's a telnet linke protocol)
Do you see any problems with this design which could cause this strange
exception inside Indy code?
Regards,
Michael
we have massive problems debugging one of our products depending on
Indy 10.
The program is multi-threaded, and works fine for hours.. but then the
program exits with an access violation and I am not able to track it
because it never happened in the IDE yet.
Now at one time.. an access violation occured inside IDE and it pointed
me to inside TIdTCPClientCustom module, more specific, the Connect method.
At the top of the function there is
if IOHandler = nil then begin
IOHandler := MakeImplicitClientHandler;
IOHandler.OnStatus := OnStatus;
ManagedIOHandler := True;
end;
This call should make sure, that IOHandler is not nil inside the function.
After this there are a few calls to IOHandler which seemed to work.
For example:
IOHandler.Port := FPort; //BGO: just to make sure
The exception was thrown a few lines later at
IOHandler.Open;
Since I can't understand why this could happen in a linear execution,
I guess it happens because of a multi-threading issue.
I have the main VCL thread which can could the Connection (user clicks
Stop, but the error occurs without it) and have a "polling" thread which
checks if the connection is still open and re-opens if neccesary (every
30s) and in this thread context the communication is run, that is calls of
conn.IOHandler.WriteLn and conn.IOHandler.ReadLn;
(it's a telnet linke protocol)
Do you see any problems with this design which could cause this strange
exception inside Indy code?
Regards,
Michael