SirRahal / delphi-ide-theme-editor

Automatically exported from code.google.com/p/delphi-ide-theme-editor
0 stars 0 forks source link

DIC - DIC expert is loaded into debugged program, causing VCL BPLs to be loaded in (eg) a FMX program, causing deadlocks #49

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Install DIC 0.1.61 in XE4
2. Create a new FMX 3D application with a 3D form
3. Turn on runtime packages in the new project
4. Run.

What is the expected output? What do you see instead?
Expected: the FMX app runs as normal
Observed: about 50% of the time, the app window won't show. Pausing the process 
shows two threads deadlocked in unit initialization, each calling 
OleInitialize, the first (main thread) from Fmx.Platform.Win; the second thread 
in Vc.Controls.  Note that no VCL units or BPLs are referenced in the project 
or project file or are seen when using Dependency Walker to examine the DLLs 
required by the project.
I examined the DLLs loaded by the process (looking at the Module Load entries 
in the Event Log when you start the app) and saw some VCL BPLS, and just before 
them the DIC expert.  I couldn't figure out how to uninstall it (the installer 
only reinstalls) but removing the entry from the registry BDS\11.0\Experts 
section stopped it being loaded into the IDE and so also into the debugged 
process, and after that no VCL BPLs are loaded as the process starts and so no 
deadlock occurs.

What version of the product are you using? On what operating system?
DIC 0.1.61
RAD Studio XE4 Pro
Windows 7 x64 Pro

Please provide any additional information below.

Original issue reported on code.google.com by vintaged...@gmail.com on 14 May 2014 at 1:05

GoogleCodeExporter commented 9 years ago
I just follow the steps described and I can't reproduce the issue, can you 
please attach a sample project. 

Rodrigo.

Original comment by Rodrigo.Ruz.V@gmail.com on 14 May 2014 at 3:39

GoogleCodeExporter commented 9 years ago
Sure.  I have attached a project I just made with the steps:
 - Install DIC
 - Start XE4
 - File, New FMX HD app, and choose 3D in the wizard it shows
 - Project options, change to use runtime packages as in the description above
 - Run

The zip file contains the entire source plus a built debug EXE.

And I have also attached a screenshot of the event log, which shows the DIC 
expert being loaded, and after that you can see some VCL packages being loaded. 
 (The key question I think is, why is the DIC expert being loaded into the 
process the IDE is starting?)  The process was doing apparently doing nothing 
at the time I took this screenshot, ie it was running but the main form hadn't 
appeared.  When I paused it, it was deadlocked, and I have taken a screenshot 
of this too.

The callstack of each thread is:
main thread;
:7730f8d1 ntdll.ZwWaitForSingleObject + 0x15
:77328d28 ; ntdll.dll
:7732c401 ; ntdll.dll
:7732c558 ntdll.LdrLoadDll + 0x7b
:75b02c95 ; C:\Windows\syswow64\KERNELBASE.dll
:75d3aac3 ; C:\Windows\syswow64\USER32.dll
:7730010a ntdll.KiUserCallbackDispatcher + 0x2e
:75d3aa3c ; C:\Windows\syswow64\USER32.dll
:75d38a5c USER32.CreateWindowExW + 0x33
:751b644f ; C:\Windows\syswow64\ole32.dll
:751b0b81 ; C:\Windows\syswow64\ole32.dll
:7518ed55 ; C:\Windows\syswow64\ole32.dll
:7518efe6 ole32.OleInitialize + 0xf
fmx.FMX.Platform.Win.FMX.Platform.Win
rtl.System.InitUnits
rtl.System._StartExe(???,???)
SysInit._InitExe($401F50)
Project1.Project1
:759f338a kernel32.BaseThreadInitThunk + 0x12
:77329f72 ntdll.RtlInitializeExceptionChain + 0x63
:77329f45 ntdll.RtlInitializeExceptionChain + 0x36

Second thread (note, as a brand new FMX app, there is no code to create extra 
threads in the app):
:7730f8d1 ntdll.ZwWaitForSingleObject + 0x15
:77328d28 ; ntdll.dll
:751beb7f ; C:\Windows\syswow64\ole32.dll
:751b0b77 ; C:\Windows\syswow64\ole32.dll
:7518ed55 ; C:\Windows\syswow64\ole32.dll
:7518efe6 ole32.OleInitialize + 0xf
vcl.Vcl.Forms.TApplication.Create(???)
vcl.Vcl.Controls.InitControls
vcl.Vcl.Controls.Vcl.Controls
rtl.System.InitUnits
rtl.System._StartLib
:5006069a @StartLib + $C2
:773299a0 ; ntdll.dll
:7732d939 ; ntdll.dll
:7732d7fc ; ntdll.dll
:7732c558 ntdll.LdrLoadDll + 0x7b
:75b02c95 ; C:\Windows\syswow64\KERNELBASE.dll
:75d3aac3 ; C:\Windows\syswow64\USER32.dll
:7730010a ntdll.KiUserCallbackDispatcher + 0x2e
:75d3aa3c ; C:\Windows\syswow64\USER32.dll
:75d3d261 USER32.CreateWindowExA + 0x33
:74507708 ; 
C:\Windows\WinSxS\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.7601.18120_
none_72d2e82386681b36\gdiplus.dll
:7450792a ; 
C:\Windows\WinSxS\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.7601.18120_
none_72d2e82386681b36\gdiplus.dll
:7450787a ; 
C:\Windows\WinSxS\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.7601.18120_
none_72d2e82386681b36\gdiplus.dll
:759f338a kernel32.BaseThreadInitThunk + 0x12
:77329f72 ntdll.RtlInitializeExceptionChain + 0x63
:77329f45 ntdll.RtlInitializeExceptionChain + 0x36

The third seems to be the IDE breaking thread:
:773001b4 ; ntdll.dll

Original comment by vintaged...@gmail.com on 15 May 2014 at 7:58

Attachments:

GoogleCodeExporter commented 9 years ago
And just to be clear, if I remove the DIC expert from the Experts\ folder in 
the registry, so it's not loaded by the IDE, this doesn't occur.

Original comment by vintaged...@gmail.com on 15 May 2014 at 8:00

GoogleCodeExporter commented 9 years ago
Thanks David, for the additional info, I just found the cause of the issue, 
which is related to one of the hooks which install the Wizard, I will work on 
the solution on these days.   

Original comment by Rodrigo.Ruz.V@gmail.com on 15 May 2014 at 10:06

GoogleCodeExporter commented 9 years ago
Hi David, I found the solution for the issue.  The fix will be included in the 
next version of the Wizard. I hope release this version soon, but I must finish 
another pending tasks first.

Thanks very much again for you report and time testing the Wizard.

Rodrigo.

Original comment by Rodrigo.Ruz.V@gmail.com on 15 May 2014 at 7:26

GoogleCodeExporter commented 9 years ago
No worries, glad to help :)

Original comment by vintaged...@gmail.com on 16 May 2014 at 8:03

GoogleCodeExporter commented 9 years ago

Original comment by Rodrigo.Ruz.V@gmail.com on 18 May 2014 at 4:47