Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Main thread hang in XE6 - help please!


This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 2 - Last Post: Sep 16, 2015 1:48 AM Last Post By: Andrew Smith
Andrew Smith

Posts: 3
Registered: 4/19/08
Main thread hang in XE6 - help please!  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 31, 2015 12:22 AM
Hi all,

I've got an app that I've recently ported from 2009 to XE6. Under 2009 there were no problems at all, but under XE6 I'm getting a random hang where the main thread simply stops responding. The app (written in C++) heavily utilises a component derived from TServerDataSet and it seems that sometimes when CalculateFields is called it simply never returns.

I did not write the component but have inherited the source so it's up to me to get it working. When moving to XE6 I had to make a number of changes like this to get everything to compile/link:

function TCachedDataSet.GetFieldData(Field: TField; Buffer: Pointer): Boolean;
...
procedure BufferToVariant( buffer : Pointer; var value : Variant; size : Longint );
...
Move( buffer^, data^, size );


to this:

function TCachedDataSet.GetFieldData(Field: TField; var Buffer: TValueBuffer): Boolean;
...
procedure BufferToVariant( buffer : TValueBuffer; var value : Variant; size : Longint );
...
Move( buffer[0], data[0], size );


This seems to be working correctly so don't think it's necessarily the cause of the problem.

I have appended a call stack from a minidump when the process was frozen. It seems to me like a variant conversion exception is occurring inside my component's GetFieldData method. Eventually it moves on to SetFieldData and then the freeze occurs...which I am guessing is due to the unhandled exception that occurred earlier. I have specific code in the component's GetFieldData/SetFieldData methods to convert strings, date/time fields, etc and am not using the TDataSet.DataConvert method that comes with the VCL. Should I scrap it and simply call DataConvert instead?

(00004086){borlndmm.dll} [50035086] Unknown function at @Borlndmm@SysGetMem$qqri + $256
(000089C7){rtl200.bpl  } [500599C7] System.@ReallocMem + $3F
(00013404){rtl200.bpl  } [50064404] System.DynArraySetLength + $D8
(00013535){rtl200.bpl  } [50064535] System.@DynArraySetLength + $5
(0003FDF5){dbrtl200.bpl} [50BB0DF5] Data.Db.TDataSet.SetFieldData + $89
(0002C7B2){CompMOSAIC.bpl} [075FD7B2] ..\CompMOSAIC\MosTable.cpp.SetFieldData (Line 1174, "..\CompMOSAIC\MosTable.cpp") + $D
(000089C7){rtl200.bpl  } [500599C7] System.@ReallocMem + $3F
(00013494){rtl200.bpl  } [50064494] System.DynArraySetLength + $168
(0002E222){dbrtl200.bpl} [50B9F222] Data.Db.TField.SetData + $9A
(000577FB){rtl200.bpl  } [500A87FB] System.Sysutils.BytesOf + $17
(00057809){rtl200.bpl  } [500A8809] System.Sysutils.BytesOf + $25
(00033439){dbrtl200.bpl} [50BA4439] Data.Db.TDateTimeField.SetAsDateTime + $2D
(0014AAD6){mosaic_desktop.exe} [0054BAD6] ..\VisRep\frStat.cpp.tblStatCalcFields (Line 159, "..\VisRep\frStat.cpp") + $4D
(000523BC){usp10.dll   } [75AF33BC] Unknown function at ScriptPositionSingleGlyph + $2429C
(000158E5){usp10.dll   } [75AB68E5] UspFreeMem + $55
(00034DD1){usp10.dll   } [75AD5DD1] Unknown function at ScriptPositionSingleGlyph + $6CB1
(00053852){usp10.dll   } [75AF4852] Unknown function at ScriptPositionSingleGlyph + $25732
(00052580){usp10.dll   } [75AF3580] Unknown function at ScriptPositionSingleGlyph + $24460
(000033C8){oleaut32.dll} [777D43C8] Unknown function at GetErrorInfo + $4A7
(00045256){ole32.dll   } [773D6256] Unknown function at CoGetComCatalog + $4F1
(00003437){oleaut32.dll} [777D4437] Unknown function at GetErrorInfo + $516
(00045256){ole32.dll   } [773D6256] Unknown function at CoGetComCatalog + $4F1
(000684FC){rtl200.bpl  } [500B94FC] System.@Variants.VarCopy + $28
(00067BBD){rtl200.bpl  } [500B8BBD] System.@Variants.VarClr + $1
(00014FC4){RDAXE6.bpl  } [002C5FC4] Lists.pas.TDictNode.SetData$qqrrx14System.Variant (Line 258, "Lists.pas") + $10
(0001536E){RDAXE6.bpl  } [002C636E] Lists.pas.TDictionary.SetKeyValue$qqr20System.UnicodeStringrx14System.Variant (Line 363, "Lists.pas") + $11
(00015383){RDAXE6.bpl  } [002C6383] Lists.pas.TDictionary.SetKeyValue$qqr20System.UnicodeStringrx14System.Variant (Line 365, "Lists.pas") + $10
(0004338D){dbrtl200.bpl} [50BB438D] Data.Db.TDataSet.DoOnCalcFields + $15
(00041A66){dbrtl200.bpl} [50BB2A66] Data.Db.TDataSet.CalculateFields + $66
(000419B9){dbrtl200.bpl} [50BB29B9] Data.Db.TDataSet.GetCalcFields + $4D
(0002B805){CompMOSAIC.bpl} [075FC805] ..\CompMOSAIC\MosTable.cpp.GetRecord (Line 916, "..\CompMOSAIC\MosTable.cpp") + $8
(00040BE4){dbrtl200.bpl} [50BB1BE4] Data.Db.TDataSet.GetRecord + $1C
(00003A5C){CompMOSAIC.bpl} [075D4A5C] ..\CompMOSAIC\MosaicQuery.cpp.TServerDataSet.GetRecord + $1C
(00041666){dbrtl200.bpl} [50BB2666] Data.Db.TDataSet.Resync + $56
(0002B576){CompMOSAIC.bpl} [075FC576] ..\CompMOSAIC\MosTable.cpp.Resync (Line 837, "..\CompMOSAIC\MosTable.cpp") + $6
(00042BDF){dbrtl200.bpl} [50BB3BDF] Data.Db.TDataSet.GotoBookmark + $4F
(0005A20E){cxDataRS20.bpl} [03F5B20E] cxDBData.TcxDBDataProvider.RestorePos$qqrv (Line 2274, "cxDBData.pas") + $9
(0003B272){cxDataRS20.bpl} [03F3C272] cxCustomData.LoadData (Line 7200, "cxCustomData.pas") + $5
(0000F242){rtl200.bpl  } [50060242] System.@HandleFinally + $5A
(00010640){madBasic_.bpl} [57011640] Madtools.FindModule + $F4
(0000DF27){KERNELBASE.dll} [7774EF27] VirtualQueryEx + $17
(0000DFF4){KERNELBASE.dll} [7774EFF4] VirtualQuery + $10
(0001DB57){madExcept_.bpl} [5981EB57] Madexcept.GetThreadCreatorAddr + $50F
(0000F006){rtl200.bpl  } [50060006] System.@HandleAnyException + $D2
(00011845){madBasic_.bpl} [57012845] Madtools.IsBadReadPtr2 + $11
(00008958){rtl200.bpl  } [50059958] System.@GetMem + $4
(0000FEEF){rtl200.bpl  } [50060EEF] System.@NewAnsiString + $F
(00010152){rtl200.bpl  } [50061152] System.@LStrFromPCharLen + $2A
(0001DB1E){madExcept_.bpl} [5981EB1E] Madexcept.GetThreadCreatorAddr + $4D6
(00008974){rtl200.bpl  } [50059974] System.@FreeMem + $4
(0000FF68){rtl200.bpl  } [50060F68] System.@UStrClr + $1C
(0001DB57){madExcept_.bpl} [5981EB57] Madexcept.GetThreadCreatorAddr + $50F
(00008974){rtl200.bpl  } [50059974] System.@FreeMem + $4
(00010411){rtl200.bpl  } [50061411] System.@LStrAsg + $41
(0001DB1E){madExcept_.bpl} [5981EB1E] Madexcept.GetThreadCreatorAddr + $4D6
(00008974){rtl200.bpl  } [50059974] System.@FreeMem + $4
(0000FF68){rtl200.bpl  } [50060F68] System.@UStrClr + $1C
(0001DB57){madExcept_.bpl} [5981EB57] Madexcept.GetThreadCreatorAddr + $50F
(00008974){rtl200.bpl  } [50059974] System.@FreeMem + $4
(00010411){rtl200.bpl  } [50061411] System.@LStrAsg + $41
(0001DB1E){madExcept_.bpl} [5981EB1E] Madexcept.GetThreadCreatorAddr + $4D6
(00008974){rtl200.bpl  } [50059974] System.@FreeMem + $4
(0000FF68){rtl200.bpl  } [50060F68] System.@UStrClr + $1C
(0001DB57){madExcept_.bpl} [5981EB57] Madexcept.GetThreadCreatorAddr + $50F
(0001DBF2){madExcept_.bpl} [5981EBF2] Madexcept.GetThreadCreatorAddr + $5AA
(0000DC7A){KERNELBASE.dll} [7774EC7A] ReadProcessMemory + $15
(0001DD19){madExcept_.bpl} [5981ED19] Madexcept.GetThreadCreatorAddr + $6D1
(000005C2){madExcept_.bpl} [598015C2]  + $0
(0000F006){rtl200.bpl  } [50060006] System.@HandleAnyException + $D2
(00004186){borlndmm.dll} [50035186] Unknown function at @Borlndmm@SysGetMem$qqri + $356
(00008958){rtl200.bpl  } [50059958] System.@GetMem + $4
(00067B50){rtl200.bpl  } [500B8B50] System.Variants.HandleConversionException + $204
(000042F2){borlndmm.dll} [500352F2] Unknown function at @Borlndmm@SysFreeMem$qqrpv + $13E
(00008974){rtl200.bpl  } [50059974] System.@FreeMem + $4
(0000FF68){rtl200.bpl  } [50060F68] System.@UStrClr + $1C
(0000367B){RDAXE6.bpl  } [002B467B] Cached.pas.TCachedDataSet.GetFieldData$qqrp14Data.Db.TFieldr25System.%DynamicArray$tuc% (Line 626, "Cached.pas") + $20
(00067BBD){rtl200.bpl  } [500B8BBD] System.@Variants.VarClr + $1
(0002BD9C){CompMOSAIC.bpl} [075FCD9C] ..\CompMOSAIC\MosTable.cpp.GetFieldData (Line 993, "..\CompMOSAIC\MosTable.cpp") + $9
(0003FAE4){dbrtl200.bpl} [50BB0AE4] Data.Db.TDataSet.GetFieldData + $38
(0003FBEF){dbrtl200.bpl} [50BB0BEF] Data.Db.TDataSet.GetFieldData + $143
(00003AA8){CompMOSAIC.bpl} [075D4AA8] ..\CompMOSAIC\MosaicQuery.cpp.TCachedDataSet.GetFieldData (Line 223, "r:\devxe6\rda\Cached.hpp") + $1C
(0002BDC4){CompMOSAIC.bpl} [075FCDC4] ..\CompMOSAIC\MosTable.cpp.GetFieldData (Line 1001, "..\CompMOSAIC\MosTable.cpp") + $D
(0002D2ED){dbrtl200.bpl} [50B9E2ED] Data.Db.TField.GetData + $A1
(00008958){rtl200.bpl  } [50059958] System.@GetMem + $4
(0000FEEF){rtl200.bpl  } [50060EEF] System.@NewAnsiString + $F
(00010152){rtl200.bpl  } [50061152] System.@LStrFromPCharLen + $2A
(00004314){borlndmm.dll} [50035314] Unknown function at @Borlndmm@SysFreeMem$qqrpv + $160
(00008974){rtl200.bpl  } [50059974] System.@FreeMem + $4
(00013689){rtl200.bpl  } [50064689] System.@DynArrayClear + $35
(0002F34C){dbrtl200.bpl} [50BA034C] Data.Db.TStringField.GetValue + $DC
(0002F17E){dbrtl200.bpl} [50BA017E] Data.Db.TStringField.GetAsVariant + $1E
(0004E527){cxDataRS20.bpl} [03F4F527] cxDB.GetFieldValue$qqrp14Data.Db.TField (Line 394, "cxDB.pas") + $8
(0005CB6E){cxDataRS20.bpl} [03F5DB6E] cxDBData.TcxValueDefDBReader.GetValue$qqrp25Cxdatastorage.TcxValueDef (Line 3391, "cxDBData.pas") + $6
(000110DF){cxDataRS20.bpl} [03F120DF] cxDataStorage.TcxDataStorage.ReadRecord$qqrip31Cxdatastorage.TcxValueDefReader (Line 2343, "cxDataStorage.pas") + $B
(0003B1DE){cxDataRS20.bpl} [03F3C1DE] cxCustomData.LoadData (Line 7187, "cxCustomData.pas") + $F
(0003B360){cxDataRS20.bpl} [03F3C360] cxCustomData.TcxCustomDataController.LoadStorage$qqrv (Line 7226, "cxCustomData.pas") + $1
(00060E44){cxDataRS20.bpl} [03F61E44] cxDBData.TcxDBDataController.LoadStorage$qqrv (Line 5213, "cxDBData.pas") + $3
(0003BA56){cxDataRS20.bpl} [03F3CA56] cxCustomData.TcxCustomDataController.UpdateStorage$qqro (Line 7453, "cxCustomData.pas") + $5
(0003BD94){cxDataRS20.bpl} [03F3CD94] cxCustomData.TcxCustomDataController.DataChanged$qqr26Cxcustomdata.TcxDataChangeii (Line 7555, "cxCustomData.pas") + $5
(00043A47){cxDataRS20.bpl} [03F44A47] cxCustomData.TcxCustomDataProvider.DataChanged$qqr26Cxcustomdata.TcxDataChangeii (Line 11422, "cxCustomData.pas") + $12
(00058A26){cxDataRS20.bpl} [03F59A26] cxDBData.TcxDBDataLink.DataSetChanged$qqrv (Line 1616, "cxDBData.pas") + $F
(000396CE){dbrtl200.bpl} [50BAA6CE] Data.Db.TDataLink.DataEvent + $BA
(00058838){cxDataRS20.bpl} [03F59838] cxDBData.TcxDBDataLink.DataEvent$qqr18Data.Db.TDataEventi (Line 1557, "cxDBData.pas") + $9
(00039C5F){dbrtl200.bpl} [50BAAC5F] Data.Db.TDataSource.NotifyLinkTypes + $43
(00039C92){dbrtl200.bpl} [50BAAC92] Data.Db.TDataSource.NotifyDataLinks + $1E
(00039CBF){dbrtl200.bpl} [50BAACBF] Data.Db.TDataSource.DataEvent + $23
(0004102C){dbrtl200.bpl} [50BB202C] Data.Db.TDataSet.DataEvent + $17C
(0004179D){dbrtl200.bpl} [50BB279D] Data.Db.TDataSet.Resync + $18D
(0002B576){CompMOSAIC.bpl} [075FC576] ..\CompMOSAIC\MosTable.cpp.Resync (Line 837, "..\CompMOSAIC\MosTable.cpp") + $6
(00041EFC){dbrtl200.bpl} [50BB2EFC] Data.Db.TDataSet.Refresh + $54
(0014B679){mosaic_desktop.exe} [0054C679] ..\VisRep\frStat.cpp.timRefreshTimer (Line 254, "..\VisRep\frStat.cpp") + $9
(000EA17B){vcl200.bpl  } [505AB17B] Vcl.Extctrls.TTimer.Timer + $F
(000EA05F){vcl200.bpl  } [505AB05F] Vcl.Extctrls.TTimer.WndProc + $2B
(001256E4){rtl200.bpl  } [501766E4] System.Classes.TDataModule.WriteHeight + $20
(000152F7){user32.dll  } [778762F7] Unknown function at gapfnScSendMessage + $32F
(00015D35){user32.dll  } [77876D35] Unknown function at GetThreadDesktop + $D2
(00015CE3){user32.dll  } [77876CE3] Unknown function at GetThreadDesktop + $80
(000167BF){user32.dll  } [778777BF] Unknown function at CharPrevW + $133
(00016885){user32.dll  } [77877885] DispatchMessageW + $A
(00181EDF){vcl200.bpl  } [50642EDF] Vcl.Forms.TApplication.ProcessMessage + $F3
(00181F22){vcl200.bpl  } [50642F22] Vcl.Forms.TApplication.HandleMessage + $A
(00182255){vcl200.bpl  } [50643255] Vcl.Forms.TApplication.Run + $C9
(00003CFA){mosaic_desktop.exe} [00404CFA] MOSAIC_Desktop.cpp.WinMain (Line 85, "MOSAIC_Desktop.cpp" + -8971) + $7
(00098665){CC32150MT.DLL} [32F99665] __startup + $14D


Edited by: Andrew Smith on Aug 31, 2015 5:38 PM
david hoke

Posts: 616
Registered: 2/9/07
Re: Main thread hang in XE6 - help please! [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 2, 2015 12:06 PM   in response to: Andrew Smith in response to: Andrew Smith
Andrew Smith wrote:

the TDataSet.DataConvert method that comes with the VCL. Should I
scrap it and simply call DataConvert instead?

Don't know about that, but FWIW...


{code}
(00004086){borlndmm.dll} [50035086] Unknown function at
@Borlndmm@SysGetMem$qqri + $256 (000089C7){rtl200.bpl } [500599C7]

I'm going to suggest you download a compatible (don't know which for
XE6) fastmm release and set it up for full debug mode - this stack
trace appears to indicate problems trying to realloc an area of memory,
I wonder if you could have heap corruption, causing you problems...

System.@ReallocMem + $3F (00013404){rtl200.bpl } [50064404]
System.DynArraySetLength + $D8 (00013535){rtl200.bpl } [50064535]
System.@DynArraySetLength + $5 (0003FDF5){dbrtl200.bpl} [50BB0DF5]
Data.Db.TDataSet.SetFieldData + $89 (0002C7B2){CompMOSAIC.bpl}
[075FD7B2] ..\CompMOSAIC\MosTable.cpp.SetFieldData (Line 1174,
"..\CompMOSAIC\MosTable.cpp") + $D (000089C7){rtl200.bpl }
[500599C7] System.@ReallocMem + $3F (00013494){rtl200.bpl }
[50064494] System.DynArraySetLength + $168 (0002E222){dbrtl200.bpl}
Andrew Smith

Posts: 3
Registered: 4/19/08
Re: Main thread hang in XE6 - help please!  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 16, 2015 1:48 AM   in response to: Andrew Smith in response to: Andrew Smith
Andrew Smith wrote:

function TCachedDataSet.GetFieldData(Field: TField; var Buffer: TValueBuffer): Boolean;


This. This was the problem, along with SetFieldData. Rewrote these functions using code from Data.Db.pas (TParam.GetData and TParam.SetData) which has fixed the problem.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02