Subject | Firebird Embedded 2.0.1.12855 crash on a series of attach and detach operations |
---|---|
Author | Chau Chee Yang |
Post date | 2007-04-20T15:34:31Z |
Hi,
I am using Delphi 2006 for win32 creating a test case on fbembed.dll
2.0.1. I have found out a strange problem. I run a series of operation:
H := LoadLibrary('fbembed.dll');
p1 := GetProcAddress(H, 'isc_attach_database');
p1(...);
p2 := GetProcAddress(H, 'isc_detach_database');
p2(...);
FreeLibrary(H);
If I run the above for about 40-50 times in a loop. It will crash in
somewhere. This problem also occurs in Firebird Embedded 1.5.x.
However, it never happens when connect to firebird server.
I have tried running on few machines running Windows XP Professional
and the outcome is as follow:
Intel Core Duo 2.4G: Seldom crash
AMD 3.5: Always crash
Virtual Machine on VMWare: Always crash
It sounds to me that fast machine work better but it does crash too.
If I add a delay before FreeLibrary:
H := LoadLibrary('fbembed.dll');
...
Sleep(1); // << Add a delay
FreeLibrary(H);
Then the crash I encountered doesn't happen anymore for all machines I
have.
Does anyone has any ideas on why this would happens? I suspect we
need pause between the Detach and FreeLibrary operation. It sounds
like detach need some more time to free up some resource before invoke
FreeLibrary.
Thank you.
I am using Delphi 2006 for win32 creating a test case on fbembed.dll
2.0.1. I have found out a strange problem. I run a series of operation:
H := LoadLibrary('fbembed.dll');
p1 := GetProcAddress(H, 'isc_attach_database');
p1(...);
p2 := GetProcAddress(H, 'isc_detach_database');
p2(...);
FreeLibrary(H);
If I run the above for about 40-50 times in a loop. It will crash in
somewhere. This problem also occurs in Firebird Embedded 1.5.x.
However, it never happens when connect to firebird server.
I have tried running on few machines running Windows XP Professional
and the outcome is as follow:
Intel Core Duo 2.4G: Seldom crash
AMD 3.5: Always crash
Virtual Machine on VMWare: Always crash
It sounds to me that fast machine work better but it does crash too.
If I add a delay before FreeLibrary:
H := LoadLibrary('fbembed.dll');
...
Sleep(1); // << Add a delay
FreeLibrary(H);
Then the crash I encountered doesn't happen anymore for all machines I
have.
Does anyone has any ideas on why this would happens? I suspect we
need pause between the Detach and FreeLibrary operation. It sounds
like detach need some more time to free up some resource before invoke
FreeLibrary.
Thank you.