Delphi, TWebBrowser and IE8 -> application freeze on closedown - delphi

In our applications, we display a webpage in a TWebBrowser component.
After installing IE8, some of our application started to stop responding on closedown.
We have found the following to be true:
It only freezes if the webpage have been shown
Which application that freeze, depends on what url is shown. If we switch url between two applications, the working application freeze, and the other close down normaly.
Have anybody experienced something similar?
One url that freeze the application: http://www.finale.no/arsoppgjor
One url that does not freeze the application: http://www.finale.no/avstemming_meldinger
** UPDATE **
We have now found a pattern, a pattern thats kind of strange, but it's no less a pattern...
When the page that we display contains images, and the images is scaled, our application freezes. For now, we will just remove or rescale images.

Long shot: did you put OleInitialze OleUinitialze in your app?

Sounds like there may be a thread deadlocking. I would run SysInternals Process Explorer on your application when it is deadlocked. Add a reference to the Microsoft symbols (Options -> Configure symbols). Now double-click the process, and choose the Threads tab. Look through IE's threads and see if you can figure out if one is deadlocking and why, especially from the stack.
I recommend doing this in Process Explorer instead of the Delphi debugger since Process Explorer understands the Microsoft symbols.

Related

Delphi - ISAPI DLL Application hanging on Fastreport

Found this this post ISAPI web application hanging if FastReport.PrepareReport is called
It helped solving my problem partially. As well I´ve turned Wisiyng property to False on frxRichView. Since I'm retunrnig a base 64 string I've also tryed switched loading from StrToStream/LoadFromStream to LoadFromFile. The problem persist with multiple acess, 2 out of 10 process can finish loading my Pdf file. All the others requests hangs until timeout. Does anyone have an idea what else can I do? is there anyother way to retunr rtf format into Fastreport report Thanks.
I could only get time-out error using Selenium to test multiples request from the client side.
Update: I've figured that just having a TfrxRichView component in the report causes the hanging, it doesn't even need to have a rtf text on it. Replacing it to a memo all request are answered.
UPDATE: Got a answer from fast report and I wold like your opinion.
ok,
I had similar problems, and it is not easy to find out the reason, but maybe you can find your solution in between my considerations..
1) Stack Size
When ran in IIS your ISAPI is only a DLL called by a process, you are not the main process so you have to pay attention to stack dimension.
Normally a Delphi application have a default stack size of 1Mb, in ISAPI DLL you will have only 256Kb of stack.
Maybe you are facing a stack overflow exception.. it can explain why it does not occurr always but only in some circumstances..
2) Trapped Exception
In general you get some error during the preparation of report (aka all the job of working with data, expressions, variables, formulas etc etc..) can bring to a trapped exception. You may be unable to see it from outside but code execution was broken somwhere and report preparation had not finished.
3) MessageBoxes and/or standard Exceptions
when running in ISAPI you should not output anything to user interface,
maybe a message dialog (or an exception) can bring to unexpected behaviour.
4) Global Var
You should avoid global var because in ISAPI they will be common across threads
So, if you have sources, debug the application.. at first exception you should understand where is your problem..
If you have not sources.. chek the above list.. I hope you can find some useful information.
You have two ways to solve this:
1- Try to recreate this behavior while debugging your ISAPI DLL. If you are lucky, you can identify the thread that is hanging your application. Sometimes this is hard or even impossible to recreate.
2- If you have access to the hung ISAPI application instance, use a tool like SysInternals Process Explorer to create a minidump file. Your application must be built using full debug symbols and you should have the corresponding map file. With one (or more - even better) dump files obtained from your hung application plus the map file, you can use another tool, WinDbg to analyze it and find the cause. (Sometimes) WinDbg can show exactly which thread is hanging the whole application and the line of code that causes it.
If you have never done that, I must warn you that this kind of analysis is almost a gamble... You have to use several different tools with little
or no documentation, read heaps of technical info in various places. In the end, sometimes it works wonderfully and sometimes it fails miserably.
Because debugging ISAPI is not obvious, but also because I wanted to be able to switch easily between more different hosting solutions — and wanted to update my website on the fly without a restart of the web-server/service — I created xxm. It has a singular interface to the HTTP context, your DLL gets loaded by either a IIS ISAPI handler, or a HTTP.SYS handler, or an Apache httpd module, or for debugging locally you can just set xxmHttp.exe as host application to get IIS out of the way.

Attaching WinDbg to w3wp.exe causes IIS not to respond to requests

I am following the steps in this article for attaching WinDbg to IIS to find the root cause of an "External component has thrown an exception" error. I am using WinDbg 10 (from Windows 10 SDK) on a Windows 7 on an ASP.NET MVC .NET 4.6 (Visual Studio 2015) app. When I attach WindDbg to the w3wp.exe process, reload the web page, the browser just spins waiting for a response. As soon as I stop WinDbg, the response is received. Looks like WinDbg is stalling IIS for some reason. I have checked/unchecked the 'invasive' checkbox. I enabled/disabled CLR Exceptions. I am not professient in WinDbg.
Any ideas what might be the issue? Or other quick way to troubleshoot that kind of exception? I usually know the issue is a compile error in a partial view after spending some time but I am interested in learning WinDbg's way of finding it (if it can).
Attaching WinDbg will cause all threads to suspend. If that is the case, your command prompt looks like this, waiting for input:
At this time, if I understand the purpose of the linked article, you should enter things like
.symfix;.reload
.sxe clr
.loadby sos clr;.loadby sos mscorwks
To resume the threads and continue execution of the program, enter g. After that, the command prompt should change to
Now do something in your application and wait for an exception, then issue the commands mentioned in the article
!dumpheap -type CompilerError
!dumpobject <0xXXXX>
or (I would suggest)
!pe

view iphone console logs without a mac

Is there a way to view the iphone console logs without having a mac ?
It used to be possible using the iPhone Configuration Utility but it does not seem to be available any longer.
I saw a tool called iTools but it seems to require a 32bit version of itunes which is also not available any more.
Given an iPhone device + windows + linux, Is there any workaround / tool to view the iphone console logs?
Realizing it is over half a year ago you asked this, but since it does not have an accepted answer yet:
I ran into this very same issue over and over, and got fed up with it, so I decided to have a go at writing a script that displays console messages in HTML, so you can just view everything in the webpage itself, without having to resort to a console-replacement or a tedious remote debugger (for which you, indeed, require a Mac), without having to modify each console call in existing code.
The key lies in 'replacing' the four main functions in window.console: log, warn, error and trace. This is done by redifining each method, adding own code to that, and calling the original method in the end. Jakub Fiala wrote the basic script for that, on which I built the rest: https://gist.github.com/jakubfiala/8fe3461ab6508f46003d
I dubbed it 'MobileConsole'. It is quite unobtrusive and will 'catch' all console.log (or .warn, .error or .trace) events, and even bind to window.onerror.
I have created a separate page for this script with an elaborate explanation on how it works, including a demo, over here.
Download this from the app store onto the iphone, you can then view logs directly on the phone:
https://itunes.apple.com/us/app/console/id317676250?mt=8
Please note, this is an old app, it will crash when launched, then on reopening it will show you the device logs.
If that fails, here is a link to the iPhone configuration utility for windows:
http://download.cnet.com/iPhone-Configuration-Utility-for-Windows/3000-20432_4-10969175.html

to hide the block the desktop during my startup program launch

i am develop a application based on log in and log out for my students. when my user logged in, the start up application will be load. during the start up!
My Question : all my desktop icon and other application should be disabled when my start up application load.Any one suggested me i really owe to you guys.
What language are you using? Here is an example of C#:
How to hide desktop icons programatically?
anyway you can use the windows API with C# or C++ don't know about java. Try and see if it works.

Debugging Delphi ISAPI Dll on Apache

I have run into a situtation where frequently when debugging a ISAPI Dll (TWebModule) running under Apache I get errors. The caption on the error box is "Debugger Fault Notification" and contained in the message is, among other things:
"c:\program files\Apache\bin\httpd.exe faulted with message......."
When this happens the cpu window pops up, and I have to hit the "OK" button on the error message. I might have to do this 3 - 5 times before program flow continues.
This is happening on my laptop. I have a desktop with the same exact configuration (as far as I know) and I don't have this problem. Both operating systems are XP. So obviously there is some setting or outdated file somewhere.
Also, I have noticed if first run my website when Apache is not in the debugging envrironment it seems not to have this problem. (i.e. start apache in the services, run my web app, stop the service, and then debug it within the Delphi environment).
Any ideas???
While it doesn't directly answer the how to debug using Apache, another alternate debugging technique which works well is to use idDebugger (near the bottom of that page). It will allow you to debug ISAPI DLL's directly from the IDE without having to start/stop services. I now never develop ISAPI DLL's without it.
To avoid this and other problems, I've started xxm. It's an alternative to TWebModule, and uses a separate wrapper to run with IIS, but there's also an Apache, FireFox and IE wrapper! It also uses mixed-HTML-Delphi-source and the development-mode wrappers do the parsing and an auto-compile to give a web-script-like environment.
Also the InternetExplorer plugin works great in the debugger (with iexplore.exe as host application).
Error code 0xC0000008 is Status_Invalid_Handle. That can be thrown by CloseHandle, for example, when you try to close a handle that either was never open or was already closed. The error might not occur when you're running outside the debugger because the API won't throw an exception unless it's being debugged.
If you're getting that exception in code that the debugger doesn't have access to, then the debugger will display the CPU window instead. Look at the call stack to find the place in your code closest to where the exception came from.
It's also possible that it's not occurring in your code at all. Try doing your same debug routine without your module installed. Do you still get errors?

Resources