Re: htmlfile ActiveX very abscure problem (not the usual disconnect problem)



On 21 Apr 2008, JT <jamie.taleyarkhan@xxxxxxxxx> wrote:

sighhhh, a few hacks later i think i have this sust, so thought i'd
post my findings etc..
The basic problem was with the Garbage Collector.

the GC in IE appears to collect objects that still have one or more
references to them!! as follows:

var _myObj = false; //global scope

function initMe()
{
_myObj = new ActiveXObject("htmlfile");

.... //set up the activex object appropriately.

setTimeout( function() { CollectGarbage(); window.status = "gc
done"; }, 100);
}

the above code demonstrates that the GC does indeed clean up the
activex object, when clearly it shouldn't, because un-commenting the
timeout makes the code work for atleast a few minutes, however with
the GC timeout in place the stream never gets up and running.. so on
that note we learn (this is purely my opinion), that the IE GC doesn't
keep a reference count of all allocated objects on the heap (like any
self respecting GC)!! A hack which solves this problem and keeps my
connection a live for long periods is to add this line of code to the
end of the initMe function:

setInterval( function () { var __x = ((_myObj ) && (typeof
_myObj .parentWindow == "object" )) }, 100);

or basically some interval which is constantly reading the reference
to the parentWindow. Now an improvement on this will be to test the
value of __x and if it is false clear all previous xyz and call initMe
in some timeout.

However interestingly enough when the GC purges the ActiveX object,
any further attempts by that instance of the IE binary to refresh/
reload any webpage on that same webserver fails!! the socket
connection hangs on some linger state!!
And looking at the Apache logs we see the request from that ActiveX
htmlfile is still alive, and when we close/ kill that instance of IE,
do we then see that connection break and according to Apache customlog
the connection was aborted in an untimely manner!!

I would love to meet the person/ team who wrote the GC for IE scrips/
DOM!!
Or better still i would love to be introduced to the IE QA Testing
team!!!!!

Well no wonder there's a problem! Why on earth did they put a
gynecologist in Internet Explorer in the first place?

--
Neredbojias
http://www.neredbojias.com/
Great sights and sounds
.



Relevant Pages

  • Re: htmlfile ActiveX very abscure problem (not the usual disconnect problem)
    ... The basic problem was with the Garbage Collector. ... //set up the activex object appropriately. ... connection a live for long periods is to add this line of code to the ...
    (alt.html)
  • Re: Need explanation on calling Close() from finalizer.
    ... > finalizers, whatever they are called). ... and let the garbage collector call the finalizer ... > to do cleanup when they go out of scope. ... Suppose you've got a connection pool of 10 connections. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Question about memory and DB connections
    ... Calling Close (or Dispose) on an open connection object closes the ... even if the garbage collector frees up the memory used by the ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Reusing Parameters
    ... I always close my connections and dispose of my objects after I have used ... but at least it's marked and the Garbage Collector ... connection object, if it's not closed, I close it then dispose of it. ... >> Dim conn As SqlClient.SqlConnection ...
    (microsoft.public.sqlserver.programming)
  • Re: COM components referenced in asp.net leave SQL connections open
    ... The .NET is not releasing COM object until garbage collector collects the wrapper for COM object. ... So you should do exactly the same thing as you do with database connection, file object, ... I have tested this with my own API and found that I must expose a ...
    (microsoft.public.dotnet.framework.aspnet)

Loading