Subject Floating point error in IB_Connection.Open
Author maikwoj
Hi,

In my application I connect to firebird via IBO from several threads.
Sometimes a call to IB_Connection.Open fails with invalid flaoting
point exception. Is this maybe a known problem ? What can be the reason ?

Stacktrace created with madexcept:

date/time : 2008-02-28, 11:29:03, 875ms
computer name : NAUTILUS
wts client name : BLACKSHEEP
user name : Administrator <admin>
operating system : Windows 2003 R2 Service Pack 1 build 3790
system language : German
system up time : 13 days 16 hours
program up time : 25 minutes 1 second
processors : 4x Intel(R) Xeon(R) CPU 5150 @ 2.66GHz
physical memory : 7342/8191 MB (free/total)
free disk space : (C:) 5.37 GB (D:) 49.47 GB
display mode : 1600x1200, 16 bit
process id : $326c
allocated memory : 15.66 MB
executable : wns.exe
exec. date/time : 2008-02-28 10:52
version : 6.1.3.1
compiled with : Delphi 2006
madExcept version : 3.0e
callstack crc : $de74523a, $25f190b9, $96183d80
exception number : 1
exception class : EInvalidOp
exception message : Ung├╝ltige Gleitkommaoperation.

thread $125c (TwInputProcessingThread):
0040304f +027 wns.exe System 3648 +16 Move
0046e049 +10d wns.exe Classes 4507 +13 TStrings.GetTextStr
005e6425 +089 wns.exe IB_Components 21736 +11
TIB_Statement.SysExecPrepare
005f1698 +008 wns.exe IB_Components 26942 +1
TIB_Dataset.SysExecPrepare
005e630f +073 wns.exe IB_Components 21689 +18
TIB_Statement.SysPrepare
005f088a +08a wns.exe IB_Components 26661 +11
TIB_Dataset.SysPrepare
005e53b4 +024 wns.exe IB_Components 21247 +3
TIB_Statement.Prepare
005c6460 +12c wns.exe IB_Schema 1314 +20 GetOldParameterOrder
005dbc11 +185 wns.exe IB_Components 16088 +25
TIB_Connection.SysAfterConnect
005db696 +06a wns.exe IB_Components 15906 +23
TIB_Connection.SysConnect
005d9155 +03d wns.exe IB_Components 15024 +6
TIB_Connection.Connect
005d91e1 +005 wns.exe IB_Components 15058 +1 TIB_Connection.Open
0064eb34 +0f0 wns.exe wIBThread 225 +12
TIBThread.InitDataConnection
00709d3d +041 wns.exe thrWnsInputProcessing 99 +6
TwInputProcessingThread.ExecuteWithPython
00632647 +03b wns.exe PythonEngine 9791 +11
TPythonThread.Execute
00476b9e +036 wns.exe Classes 9866 +7 ThreadProc
00405220 +028 wns.exe System 12127 +33 ThreadWrapper
>> created by thread $5468 (TwInputPollThread) at:
0064e2bb +01f wns.exe wThreadBase 166 +1 TwThreadBase.Create

Main ($53e8):
7c94ed54 +000 ntdll.dll KiFastSystemCallRet
004ccf25 +01d wns.exe Forms 7649 +2 TApplication.ProcessMessage
004cd083 +00f wns.exe Forms 7689 +1 TApplication.HandleMessage
004cd31e +0a6 wns.exe Forms 7773 +16 TApplication.Run
00762de1 +1d5 wns.exe wns 84 +34 initialization

Listener #1 ($5714): <priority:2>
7c94ed54 +00 ntdll.dll
KiFastSystemCallRet
00638364 +5c wns.exe IdStackWindows 820 +6
TIdSocketListWindows.FDSelect
006382f0 +20 wns.exe IdStackWindows 805 +3
TIdSocketListWindows.SelectRead
0063b14a +06 wns.exe IdSocketHandle 472 +1
TIdSocketHandle.Select
00673cf5 +49 wns.exe IdServerIOHandlerSocket 128 +5
TIdServerIOHandlerSocket.Accept
00674ebd +55 wns.exe IdTCPServer 852 +8
TIdListenerThread.Run
0063bc13 +d7 wns.exe IdThread 327 +30 TIdThread.Execute
00476b9e +36 wns.exe Classes 9866 +7 ThreadProc
00405220 +28 wns.exe System 12127 +33 ThreadWrapper
>> created by Main ($53e8) at:
0063be04 +68 wns.exe IdThread 392 +20 TIdThread.Create

Scheduler User ($483c):
7c94ed54 +000 ntdll.dll KiFastSystemCallRet
00638364 +05c wns.exe IdStackWindows 820 +6
TIdSocketListWindows.FDSelect
006382f0 +020 wns.exe IdStackWindows 805 +3
TIdSocketListWindows.SelectRead
0063b14a +006 wns.exe IdSocketHandle 472 +1 TIdSocketHandle.Select
0063af3b +027 wns.exe IdSocketHandle 378 +2 CheckIsReadable
0063afec +064 wns.exe IdSocketHandle 399 +15
TIdSocketHandle.Readable
006481bc +078 wns.exe IdIOHandlerStack 429 +14
TIdIOHandlerStack.ReadFromSource
006441b4 +14c wns.exe IdIOHandler 1077 +37 TIdIOHandler.ReadLn
0067e809 +0ed wns.exe VarioTrans 3340 +26
TVarioPeer.ListenNodeOnExecute
006746dc +018 wns.exe IdTCPServer 517 +2 TIdTCPServer.DoExecute
006738d7 +00f wns.exe IdContext 163 +2 TIdContext.Run
0063c1fa +006 wns.exe IdThread 550 +1 TIdThreadWithTask.Run
0063bc13 +0d7 wns.exe IdThread 327 +30 TIdThread.Execute
00476b9e +036 wns.exe Classes 9866 +7 ThreadProc
00405220 +028 wns.exe System 12127 +33 ThreadWrapper
>> created by Listener #1 ($5714) at:
0063be04 +068 wns.exe IdThread 392 +20 TIdThread.Create

thread $554c (TwInputPollThread):
7c94ed54 +00 ntdll.dll KiFastSystemCallRet
005b080b +3f wns.exe wInputBase 802 +8 TwInputPollThread.Execute
00476b9e +36 wns.exe Classes 9866 +7 ThreadProc
00405220 +28 wns.exe System 12127 +33 ThreadWrapper
>> created by Main ($53e8) at:
005b0766 +16 wns.exe wInputBase 764 +1 TwInputPollThread.Create

thread $55a4 (TwInputPollThread):
7c94ed54 +00 ntdll.dll KiFastSystemCallRet
005b080b +3f wns.exe wInputBase 802 +8 TwInputPollThread.Execute
00476b9e +36 wns.exe Classes 9866 +7 ThreadProc
00405220 +28 wns.exe System 12127 +33 ThreadWrapper
>> created by Main ($53e8) at:
005b0766 +16 wns.exe wInputBase 764 +1 TwInputPollThread.Create

thread $54f0 (TwInputPollThread):
7c94ed54 +00 ntdll.dll KiFastSystemCallRet
005b080b +3f wns.exe wInputBase 802 +8 TwInputPollThread.Execute
00476b9e +36 wns.exe Classes 9866 +7 ThreadProc
00405220 +28 wns.exe System 12127 +33 ThreadWrapper
>> created by Main ($53e8) at:
005b0766 +16 wns.exe wInputBase 764 +1 TwInputPollThread.Create

thread $57e8 (TwInputPollThread):
7c94ed54 +00 ntdll.dll KiFastSystemCallRet
005b0818 +4c wns.exe wInputBase 805 +11 TwInputPollThread.Execute
00476b9e +36 wns.exe Classes 9866 +7 ThreadProc
00405220 +28 wns.exe System 12127 +33 ThreadWrapper
>> created by Main ($53e8) at:
005b0766 +16 wns.exe wInputBase 764 +1 TwInputPollThread.Create

thread $4eb0 (TwInputPollThread):
7c94ed54 +00 ntdll.dll KiFastSystemCallRet
005b080b +3f wns.exe wInputBase 802 +8 TwInputPollThread.Execute
00476b9e +36 wns.exe Classes 9866 +7 ThreadProc
00405220 +28 wns.exe System 12127 +33 ThreadWrapper
>> created by Main ($53e8) at:
005b0766 +16 wns.exe wInputBase 764 +1 TwInputPollThread.Create

thread $5468 (TwInputPollThread):
7c94ed54 +00 ntdll.dll KiFastSystemCallRet
005b0818 +4c wns.exe wInputBase 805 +11 TwInputPollThread.Execute
00476b9e +36 wns.exe Classes 9866 +7 ThreadProc
00405220 +28 wns.exe System 12127 +33 ThreadWrapper
>> created by Main ($53e8) at:
005b0766 +16 wns.exe wInputBase 764 +1 TwInputPollThread.Create

thread $4d10 (TwInputPollThread):
7c94ed54 +00 ntdll.dll KiFastSystemCallRet
005b0818 +4c wns.exe wInputBase 805 +11 TwInputPollThread.Execute
00476b9e +36 wns.exe Classes 9866 +7 ThreadProc
00405220 +28 wns.exe System 12127 +33 ThreadWrapper
>> created by Main ($53e8) at:
005b0766 +16 wns.exe wInputBase 764 +1 TwInputPollThread.Create

thread $4e44 (TwInputPollThread):
7c94ed54 +00 ntdll.dll KiFastSystemCallRet
005b080b +3f wns.exe wInputBase 802 +8 TwInputPollThread.Execute
00476b9e +36 wns.exe Classes 9866 +7 ThreadProc
00405220 +28 wns.exe System 12127 +33 ThreadWrapper
>> created by Main ($53e8) at:
005b0766 +16 wns.exe wInputBase 764 +1 TwInputPollThread.Create

thread $4a8c (TwInputPollThread):
7c94ed54 +00 ntdll.dll KiFastSystemCallRet
005b080b +3f wns.exe wInputBase 802 +8 TwInputPollThread.Execute
00476b9e +36 wns.exe Classes 9866 +7 ThreadProc
00405220 +28 wns.exe System 12127 +33 ThreadWrapper
>> created by Main ($53e8) at:
005b0766 +16 wns.exe wInputBase 764 +1 TwInputPollThread.Create

thread $52c8 (TwEventPollThread):
7c94ed54 +00 ntdll.dll KiFastSystemCallRet
006c1d70 +4c wns.exe cWnsEventChannel 466 +10
TwEventPollThread.Execute
00476b9e +36 wns.exe Classes 9866 +7 ThreadProc
00405220 +28 wns.exe System 12127 +33 ThreadWrapper
>> created by Main ($53e8) at:
006c0d05 +19 wns.exe wDBThread 291 +1 TwDBThread.Create

thread $53cc (TwEventPollThread):
7c94ed54 +00 ntdll.dll KiFastSystemCallRet
006c1d70 +4c wns.exe cWnsEventChannel 466 +10
TwEventPollThread.Execute
00476b9e +36 wns.exe Classes 9866 +7 ThreadProc
00405220 +28 wns.exe System 12127 +33 ThreadWrapper
>> created by Main ($53e8) at:
006c0d05 +19 wns.exe wDBThread 291 +1 TwDBThread.Create

thread $51d8 (TwEventPollThread):
7c94ed54 +00 ntdll.dll KiFastSystemCallRet
006c1d70 +4c wns.exe cWnsEventChannel 466 +10
TwEventPollThread.Execute
00476b9e +36 wns.exe Classes 9866 +7 ThreadProc
00405220 +28 wns.exe System 12127 +33 ThreadWrapper
>> created by Main ($53e8) at:
006c0d05 +19 wns.exe wDBThread 291 +1 TwDBThread.Create

thread $4d40 (TwEventPollThread):
7c94ed54 +00 ntdll.dll KiFastSystemCallRet
006c1d70 +4c wns.exe cWnsEventChannel 466 +10
TwEventPollThread.Execute
00476b9e +36 wns.exe Classes 9866 +7 ThreadProc
00405220 +28 wns.exe System 12127 +33 ThreadWrapper
>> created by Main ($53e8) at:
006c0d05 +19 wns.exe wDBThread 291 +1 TwDBThread.Create

thread $5464 (TwEventPollThread):
7c94ed54 +00 ntdll.dll KiFastSystemCallRet
006c1d70 +4c wns.exe cWnsEventChannel 466 +10
TwEventPollThread.Execute
00476b9e +36 wns.exe Classes 9866 +7 ThreadProc
00405220 +28 wns.exe System 12127 +33 ThreadWrapper
>> created by Main ($53e8) at:
006c0d05 +19 wns.exe wDBThread 291 +1 TwDBThread.Create

thread $52d4 (TwEventPollThread):
7c94ed54 +00 ntdll.dll KiFastSystemCallRet
006c1d70 +4c wns.exe cWnsEventChannel 466 +10
TwEventPollThread.Execute
00476b9e +36 wns.exe Classes 9866 +7 ThreadProc
00405220 +28 wns.exe System 12127 +33 ThreadWrapper
>> created by Main ($53e8) at:
006c0d05 +19 wns.exe wDBThread 291 +1 TwDBThread.Create

thread $561c (TwEventPollThread):
7c94ed54 +00 ntdll.dll KiFastSystemCallRet
006c1d70 +4c wns.exe cWnsEventChannel 466 +10
TwEventPollThread.Execute
00476b9e +36 wns.exe Classes 9866 +7 ThreadProc
00405220 +28 wns.exe System 12127 +33 ThreadWrapper
>> created by Main ($53e8) at:
006c0d05 +19 wns.exe wDBThread 291 +1 TwDBThread.Create

thread $530c (TwEventPollThread):
7c94ed54 +00 ntdll.dll KiFastSystemCallRet
006c1d70 +4c wns.exe cWnsEventChannel 466 +10
TwEventPollThread.Execute
00476b9e +36 wns.exe Classes 9866 +7 ThreadProc
00405220 +28 wns.exe System 12127 +33 ThreadWrapper
>> created by Main ($53e8) at:
006c0d05 +19 wns.exe wDBThread 291 +1 TwDBThread.Create

thread $5764 (TVarioClientListenThread):
7c94ed54 +000 ntdll.dll KiFastSystemCallRet
00638364 +05c wns.exe IdStackWindows 820 +6
TIdSocketListWindows.FDSelect
006382f0 +020 wns.exe IdStackWindows 805 +3
TIdSocketListWindows.SelectRead
0063b14a +006 wns.exe IdSocketHandle 472 +1 TIdSocketHandle.Select
0063af3b +027 wns.exe IdSocketHandle 378 +2 CheckIsReadable
0063afec +064 wns.exe IdSocketHandle 399 +15
TIdSocketHandle.Readable
006481bc +078 wns.exe IdIOHandlerStack 429 +14
TIdIOHandlerStack.ReadFromSource
006441b4 +14c wns.exe IdIOHandler 1077 +37 TIdIOHandler.ReadLn
0067fee1 +0e5 wns.exe VarioTrans 4106 +19
TVarioClientListenThread.Execute
00476b9e +036 wns.exe Classes 9866 +7 ThreadProc
00405220 +028 wns.exe System 12127 +33 ThreadWrapper
>> created by Main ($53e8) at:
0067fda5 +019 wns.exe VarioTrans 4052 +1
TVarioClientListenThread.Create

thread $5418 (TIdThreadWithTask): <suspended>
7c82b5bb +00 kernel32.dll
>> created by Listener #1 ($5714) at:
0063be04 +68 wns.exe IdThread 392 +20 TIdThread.Create

thread $140 (TwInputProcessingThread):
0045d87f +003 wns.exe Variants 712 +0 VarClearDeep
00463b5e +016 wns.exe Variants 3718 +6 VarCompare
00465cd9 +005 wns.exe Variants 5755 +1 @VarCmpEQ
004e41e4 +030 wns.exe wListTypes 319 +1
TwVarDictEntry.Check
004e430d +045 wns.exe wListTypes 378 +3 TwVarDict.Find
004e4421 +031 wns.exe wListTypes 431 +1 TwVarDict.SetItems
006b9274 +114 wns.exe cWnnIBControl 11683 +24
TIBControl._oReadAllMetatags
006a1dd6 +02e wns.exe cWnnIBControl 3749 +3
TIBControl.oReadAllMetatags
0072ccdd +109 wns.exe AppControl 7170 +26
TAppCtrl.PyoReadAllMetatags
0062b9fc +044 wns.exe PythonEngine 5457 +5
TPythonEngine.EvalPyFunction
0062bb24 +054 wns.exe PythonEngine 5491 +4
TPythonEngine.EvalFunction
0070a614 +744 wns.exe thrWnsInputProcessing 321 +157
TwInputProcessingThread.FoundFile
00709d83 +087 wns.exe thrWnsInputProcessing 103 +10
TwInputProcessingThread.ExecuteWithPython
00632647 +03b wns.exe PythonEngine 9791 +11
TPythonThread.Execute
00476b9e +036 wns.exe Classes 9866 +7 ThreadProc
00405220 +028 wns.exe System 12127 +33 ThreadWrapper
>> created by thread $4d10 (TwInputPollThread) at:
0064e2bb +01f wns.exe wThreadBase 166 +1 TwThreadBase.Create

thread $fbc (TwInputProcessingThread):
0045d8a3 +027 wns.exe Variants 721 +9 VarClearDeep
00463b5e +016 wns.exe Variants 3718 +6 VarCompare
00465cd9 +005 wns.exe Variants 5755 +1 @VarCmpEQ
004e41e4 +030 wns.exe wListTypes 319 +1
TwVarDictEntry.Check
004e430d +045 wns.exe wListTypes 378 +3 TwVarDict.Find
004e4421 +031 wns.exe wListTypes 431 +1 TwVarDict.SetItems
006b9274 +114 wns.exe cWnnIBControl 11683 +24
TIBControl._oReadAllMetatags
006a1dd6 +02e wns.exe cWnnIBControl 3749 +3
TIBControl.oReadAllMetatags
0072ccdd +109 wns.exe AppControl 7170 +26
TAppCtrl.PyoReadAllMetatags
0062b9fc +044 wns.exe PythonEngine 5457 +5
TPythonEngine.EvalPyFunction
0062bb24 +054 wns.exe PythonEngine 5491 +4
TPythonEngine.EvalFunction
0070a614 +744 wns.exe thrWnsInputProcessing 321 +157
TwInputProcessingThread.FoundFile
00709d83 +087 wns.exe thrWnsInputProcessing 103 +10
TwInputProcessingThread.ExecuteWithPython
00632647 +03b wns.exe PythonEngine 9791 +11
TPythonThread.Execute
00476b9e +036 wns.exe Classes 9866 +7 ThreadProc
00405220 +028 wns.exe System 12127 +33 ThreadWrapper
>> created by thread $57e8 (TwInputPollThread) at:
0064e2bb +01f wns.exe wThreadBase 166 +1 TwThreadBase.Create

cpu registers:
eax = 00e8fa90
ebx = 005cb5b4
ecx = 00000013
edx = 023f2dfc
esi = 00dde8f0
edi = 00e7de90
eip = 00403052
esp = 050ffcb0
ebp = 050ffd04

stack dump:
050ffcb0 4e e0 46 00 0c fd 0f 05 - bc 4a 40 00 04 fd 0f 05
N.F......J@.....
050ffcc0 f0 e8 dd 00 00 00 00 00 - 02 00 00 00 1b 00 00 00
................
050ffcd0 02 00 00 00 1e 00 00 00 - d8 77 dd 00 07 00 00 00
.........w......
050ffce0 00 00 00 00 00 00 00 00 - fc 2d 3f 02 08 00 00 00
.........-?.....
050ffcf0 14 01 00 00 1b 00 00 00 - 01 00 00 00 5c fd 0f 05
............\...
050ffd00 00 2f df 00 60 fd 0f 05 - 28 64 5e 00 18 fd 0f 05
./..`...(d^.....
050ffd10 bc 4a 40 00 60 fd 0f 05 - 98 fd 0f 05 bc 4a 40 00
.J@.`........J@.
050ffd20 60 fd 0f 05 90 de e7 00 - f0 e8 dd 00 f0 e8 dd 00
`...............
050ffd30 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
................
050ffd40 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
................
050ffd50 f0 e8 dd 00 00 00 00 00 - 00 00 00 00 00 00 00 00
................
050ffd60 a8 fd 0f 05 9d 16 5f 00 - a8 fd 0f 05 90 de e7 00
......_.........
050ffd70 40 98 e7 00 f0 e8 dd 00 - 15 63 5e 00 f0 e8 dd 00
@........c^.....
050ffd80 8f 08 5f 00 a8 fd 0f 05 - 90 de e7 00 40 98 e7 00
.._.........@...
050ffd90 00 00 00 00 ba 53 5e 00 - b0 fd 0f 05 bc 4a 40 00
.....S^......J@.
050ffda0 a8 fd 0f 05 f0 e8 dd 00 - 28 fe 0f 05 65 64 5c 00
........(...ed\.
050ffdb0 bc fd 0f 05 bc 4a 40 00 - 28 fe 0f 05 30 fe 0f 05
.....J@.(...0...
050ffdc0 bc 4a 40 00 28 fe 0f 05 - 40 98 e7 00 03 73 02 00
.J@.(...@....s..
050ffdd0 03 06 04 00 00 00 00 00 - 00 00 00 03 32 01 00 01
............2...
050ffde0 00 00 0b 00 00 10 01 00 - 00 00 00 03 00 00 00 00
................

disassembling:
00403028 public System.Move: ; function entry point
00403028 3632 cmp eax, edx
0040302a 3633 jz loc_40305d
0040302c 3634 cmp ecx, $20
0040302f 3635 ja loc_4030ad
00403031 3636 sub ecx, 8
00403034 3637 jg loc_40303d
00403036 3639 jmp dword ptr [ecx*4+$403080]
0040303d 3641 fild qword ptr [ecx+eax]
00403040 3642 fild qword ptr [eax]
00403042 3643 cmp ecx, 8
00403045 3644 jle loc_403058
00403047 3645 fild qword ptr [eax+8]
0040304a 3646 cmp ecx, $10
0040304d 3647 jle loc_403055
0040304f 3648 > fild qword ptr [eax+$10]
00403052 3649 fistp qword ptr [edx+$10]
00403055 3651 fistp qword ptr [edx+8]
00403058 3653 fistp qword ptr [edx]
0040305a 3654 fistp qword ptr [ecx+edx]
0040305d 3656 ret
0040305e 3657 nop
0040305f 3658 nop
00403060 3660 pop ebp
00403061 xor [eax], al
00403064 fidiv word ptr [eax]
00403066 inc eax
00403067 add ah, ah
00403069 xor [eax], al
0040306c jmp loc_40309e
0040306e inc eax
0040306f add al, bh
00403071 xor [eax], al
00403074 std
00403075 xor [eax], al
00403078 or [ecx], dh
0040307a inc eax
0040307b add [$20004031], dl
00403081 xor [eax], eax
00403084 3662 push edx
00403085 3663 fild qword ptr [eax]
00403087 3664 lea eax, [ecx+eax-8]
0040308b 3665 lea ecx, [edx+ecx-8]
0040308f 3666 fild qword ptr [eax]
00403091 3667 push ecx
00403092 3668 neg ecx
00403094 3669 and edx, -8
00403097 3670 lea ecx, [edx+ecx+8]
0040309b 3671 pop edx
0040309c 3673 fild qword ptr [ecx+eax]
0040309e add edi, ebx
004030a0 3674 cmp al, $11
004030a2 3675 add ecx, 8
004030a5 3676 jl loc_40309c
004030a7 3677 fistp qword ptr [edx]
004030a9 3678 pop edx
004030aa 3679 fistp qword ptr [edx]
004030ac 3680 ret
004030ad 3682 jle loc_4030dd
004030af 3683 cmp eax, edx
004030b1 3684 ja loc_403084
004030b3 3685 sub edx, ecx
004030b5 3686 cmp eax, edx
004030b7 3687 lea edx, [ecx+edx]
004030ba 3688 jbe loc_403084
004030bc 3689 sub ecx, 8
[...]