PDA

View Full Version : Indy 10 Support for IdThread


briangochnauer
18-Apr-2006, 12:55 PM
Did I say something wrong. :confused:

----------------------------------------------------------------

I noticed that in EurekaLog.pas your redeclaring TIdThread as your own class type

TIdThread = class(TThread)
protected
FData: TObject;
FStopMode: TIdThreadStopMode;
FStopped: Boolean;
FTerminatingException: string;
FOnException: TIdExceptionEvent;
public
class procedure HandledException(Sender: TObject; E: Exception);
end;

*Very Dangerous*

In Indy10 lastest snapshop they changed the TIdThread class,
it no longer has a
procedure HandledException(Sender: TObject; E: Exception);

admin
18-Apr-2006, 05:53 PM
Hi,

briangochnauer wrote:
> Did I say something wrong. :confused:
>
> [...]

Try to remove the "SetIndyEvent" procedure and tell back to me the
results, ok? :)

--
Best regards...

Fabio Dell'Aria.
----------------
http://www.eurekalog.com
Catch every BUG, every time!

briangochnauer
19-Apr-2006, 12:38 PM
Commenting out
// if (not IndyHooked) and (IsAParentStr(Thread, 'TIdThread')) then SetIndyEvent;

gives me many errors in a previous file 31MB in size but after restarting I got.
Exception:TEurekaFunctionList
Message:UnknownError

NOTE: (FYI)
EurekaLog.pas defines TIdThread as;

TIdThread = class(TThread)
protected
FData: TObject;
FStopMode: TIdThreadStopMode;
FStopped: Boolean;
FTerminatingException: string;
FOnException: TIdExceptionEvent;
public
class procedure HandledException(Sender: TObject; E: Exception);
end;

IdThread defines as;

TIdThread = class(TIdNativeThread)
protected
FData: TObject;
FLock: TIdCriticalSection;
FLoop: Boolean;
FName: string;
FStopMode: TIdThreadStopMode;
FOptions: TIdThreadOptions;
FTerminatingException: String;
FTerminatingExceptionClass: TClass;
FYarn: TIdYarn;
//
FOnException: TIdExceptionThreadEvent;
FOnStopped: TIdNotifyThreadEvent;
//
procedure AfterRun; virtual; //3* not abstract - otherwise it is required
procedure AfterExecute; virtual;//5 not abstract - otherwise it is required
procedure BeforeExecute; virtual;//1 not abstract - otherwise it is required
procedure BeforeRun; virtual; //2* not abstract - otherwise it is required
procedure Cleanup; virtual;//4*
procedure DoException (AException: Exception); virtual;
procedure DoStopped; virtual;
procedure Execute; override;
function GetStopped: Boolean;
function HandleRunException(AException: Exception): Boolean; virtual;
procedure Run; virtual; abstract;
class procedure WaitAllThreadsTerminated(
AMSec: Integer = IdWaitAllThreadsTerminatedCount);
public
constructor Create(ACreateSuspended: Boolean = True;
ALoop: Boolean = True; AName: string = ''); virtual;
destructor Destroy; override;
procedure Start; virtual;
procedure Stop; virtual;
procedure Synchronize(Method: TIdThreadMethod); overload;
//BGO:TODO procedure Synchronize(Method: TMethod); overload;
// Here to make virtual
procedure Terminate; virtual;
procedure TerminateAndWaitFor; virtual;
//
property Data: TObject read FData write FData;
property Loop: Boolean read FLoop write FLoop;
property Name: string read FName write FName;
property ReturnValue;
property StopMode: TIdThreadStopMode read FStopMode write FStopMode;
property Stopped: Boolean read GetStopped;
property Terminated;
// TODO: Change this to be like TIdFiber. D6 implementation is not as good
// as what is done in TIdFiber.
property TerminatingException: string read FTerminatingException;
property TerminatingExceptionClass: TClass read FTerminatingExceptionClass;
//Represents the thread or fiber for the scheduler of the thread.
property Yarn: TIdYarn read FYarn write FYarn;
property OnException: TIdExceptionThreadEvent read FOnException write FOnException;
property OnStopped: TIdNotifyThreadEvent read FOnStopped write FOnStopped;
end;
=========================================

The resulting internals would be very different.

admin
19-Apr-2006, 01:18 PM
Hi,

briangochnauer wrote:
> Commenting out
> // if (not IndyHooked) and (IsAParentStr(Thread, 'TIdThread')) then
> SetIndyEvent;
>
> gives me many errors in a previous file 31MB in size but after
> restarting I got.
> Exception:TEurekaFunctionList
> Message:UnknownError
>
> [...]

I'm sorry but the "SetIndyEvent" procedure is executed only if is detect
an Indy 8 installation. For Indy 9 and 10 EurekaLog did not use it, so
it's impossible that the problem is caused by this.

I'm sorry but I need a method to can reproduce it to can help you more. :(

--
Best regards...

Fabio Dell'Aria.
----------------
http://www.eurekalog.com
Catch every BUG, every time!

briangochnauer
19-Apr-2006, 06:19 PM
I don't see any conditional compilation directives for Indy 8,9,10.

After I commented out lines near "IndyHooked := " line, no more errors.

procedure Init;
... removed next six lines....line 12395
IndyThread_HandleException :=
HookBPLProcedure(IndyThread_ID, INDY,
'@Idthread@TIdThread@DoException$qqrp18Sysutils@Ex ception',
@Hooked_IndyThreadHandleException);

IndyHooked := Assigned(IndyThread_HandleException);
....
end;

admin
20-Apr-2006, 09:33 AM
Hi,

briangochnauer wrote:
> I don't see any conditional compilation directives for Indy 8,9,10.

Because I test the "Indy 8" presence checking for the
"TIdThread.DoException" method.

> After I commented out lines near "IndyHooked := " line, no more
> errors.
>
> procedure Init;
> .. removed next six lines....line 12395
> IndyThread_HandleException :=
> HookBPLProcedure(IndyThread_ID, INDY,
> '@Idthread@TIdThread@DoException$qqrp18Sysutils@Ex ception',
> @Hooked_IndyThreadHandleException);
>
> IndyHooked := Assigned(IndyThread_HandleException);
> ...
> end;

I'm sorry but this disable the EurekaLog Indy support! :(

Try to replace the following "ExceptionLog.pas" procedures:



function ExceptionManager(Obj: TObject; Addr: Pointer;
RaiserType: TRaiserType; ModuleHandle: THandle): Boolean;
begin
EnterCriticalSection(ExceptionCriticalSection);
try
Result := ExceptNotify(Obj, Addr,
LastDelphiException, 0, 0, nil, RaiserType, ModuleHandle, aeNone);
finally
LeaveCriticalSection(ExceptionCriticalSection);
end;
end;

procedure Hooked_IndyThreadHandleException(Self: TObject;
AException: Exception);
begin
EnterCriticalSection(ExceptionCriticalSection);
try
if ExceptionManager(AException,ExceptAddr,rtUnknown,H Instance) then
IndyThread_HandleException(Self, AException);
finally
LeaveCriticalSection(ExceptionCriticalSection);
end;
end;



I'm waiting for your feedback ASAP, OK? :)

--
Best regards...

Fabio Dell'Aria.
----------------
http://www.eurekalog.com
Catch every BUG, every time!

briangochnauer
20-Apr-2006, 06:14 PM
I left the line

// if (not IndyHooked) and (IsAParentStr(Thread, 'TIdThread')) then SetIndyEvent;

commented out (removed) and made the changes you requested.

The "function ExceptionManager" was quite a *big* change...

Seems to work, I'll let in run for a few hours and check it again.

Thanks,
Brian

briangochnauer
20-Apr-2006, 08:03 PM
Still running fine.

Is this production ready (RC4 + this change) ?

briangochnauer
21-Apr-2006, 06:22 PM
24+ hours now and running fine.

Do you have an 'offical' release date for this fix.

Thanks,
Brian

admin
22-Apr-2006, 03:35 PM
Hi,

briangochnauer wrote:
> 24+ hours now and running fine.
>
> Do you have an 'offical' release date for this fix.
>
> Thanks,
> Brian

I have just released the last EurekaLog 5.1.4 RC 6 at:
http://www.eurekalog.com/login.php

Can you try with it, please?

I'm waiting for your feedback ASAP, ok? :)

--
Best regards...

Fabio Dell'Aria.
----------------
http://www.eurekalog.com
Catch every BUG, every time!

briangochnauer
25-Apr-2006, 07:43 PM
>I'm waiting for your feedback ASAP, ok?

On my short/simple test it, seems to be working okay.

admin
26-Apr-2006, 09:04 AM
Hi,

briangochnauer wrote:
>> I'm waiting for your feedback ASAP, ok?
>
> On my short/simple test it, seems to be working okay.

Still works fine?

--
Best regards...

Fabio Dell'Aria.
----------------
http://www.eurekalog.com
Catch every BUG, every time!

briangochnauer
26-Apr-2006, 01:04 PM
After 24+ hours, still looks good.

admin
27-Apr-2006, 04:34 PM
Hi,

briangochnauer wrote:
> After 24+ hours, still looks good.

Perfect.

The final stable 5.1.4 version will be available shortly! :)

--
Best regards...

Fabio Dell'Aria.
----------------
http://www.eurekalog.com
Catch every BUG, every time!