MITC hangs when multiple instances 
Author Message
 MITC hangs when multiple instances

I've been chasing this for days, but have FINALLY been able to replicate
something like it in a single small program.  I first noticed this in an
application which gets spawned many times.  If I let one of the applications
idle poll with DoEvents, this always seemed to work, although, it pegged the
CPU usage.  I then introduced a message wait loop, and then we began
noticing a lockup condition associated with the control run down.  Some
instances would not receive their response data.  But they always worked
fine if one, and only one instance of the program was running.

So I set out to see if I could reproduce this in a single program.  To see
the problem create a VB project.  Add a reference to MSINET.OCX, and add one
button to the main form, with this code:

Option Explicit

Dim WithEvents MITC1 As InetCtlsObjects.Inet
Dim WithEvents MITC2 As InetCtlsObjects.Inet
Dim WithEvents MITC3 As InetCtlsObjects.Inet

Private Sub Command1_Click()
    Dim strURL As String
    Dim lngTimeout As Long

    strURL = " http://www.*-*-*.com/ ;
    lngTimeout = 15

    Set MITC1 = New InetCtlsObjects.Inet
    MITC1.AccessType = icDirect
    MITC1.URL = strURL
    MITC1.RequestTimeout = lngTimeout

    Set MITC2 = New InetCtlsObjects.Inet
    MITC2.AccessType = icDirect
    MITC2.URL = strURL
    MITC2.RequestTimeout = lngTimeout

    Set MITC3 = New InetCtlsObjects.Inet
    MITC3.AccessType = icDirect
    MITC3.URL = strURL
    MITC3.RequestTimeout = lngTimeout

    Debug.Print "Execute 1"
    MITC1.Execute , "GET"
    Debug.Print "Execute 2"
    MITC2.Execute , "GET"
    Debug.Print "Execute 3"
    MITC3.Execute , "GET"

    Debug.Print "Start waiting"
    Do While (MITC1.StillExecuting) Or (MITC2.StillExecuting) Or
(MITC3.StillExecuting)
        DoEvents
    Loop
    Debug.Print "Done waiting"

    Set MITC3 = Nothing
    Set MITC2 = Nothing
    Set MITC1 = Nothing

End Sub

For me on W2K it hangs in the loop, MITC3.StillExecuting remains false
forever.  On an NT box, we see other problems.  You can manually BREAK the
program, but you can not exit it without{*filter*} the VB IDE.  In the
original program when we attempted to deinstantiate the MITC, it would lock
up.  I saw some other very strange behavior on NT in the IDE, which
eventually led me to this, but I could never prove that it happened outside
the IDE, so since I don't understand them fully, I will just state these
more easily reproducable symptoms.

I scoured the knowledgebase for issues such as this and could find none.  I
doubt there will ever be a fix for this.  The most disconcerting problem I
have here, is that this issue with multiple instances seems to occur EVEN if
the control is instanced in SEPARATE PROCESSES !  I was only able to prove
this by making on-disk logs of activities with millisecond timestamps in the
logs.

I believe the reason it worked with the DOEVENTS version is that while doing
the idle polling, the one process dominated the CPU, and tended to execute
and complete before others could start.  Once I found a more efficient way
to wait for completion, then it was very easy and likely to get multiple
processes with pending execution on their single MITC instances.

Has anyone else out there experienced this problem, or better yet, know of
someway to work around this?

Thanks in advance - Best Regards - Lee Gillie, Spokane WA



Sun, 10 Oct 2004 04:28:33 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. MITC hangs when multiple instances

2. Multiple Instances or Single Instances

3. Multiple Session IDs when creating multiple instances

4. Hanging Excel Instance

5. Instantiating IE instance in XP with Cleint-Side VBScript Hangs

6. Mediaplayer hangs after multiple uses

7. EXE hangs when opening 1 form multiple times

8. MITC - odd behavior with VB and waitable timers

9. Stop Multiple Instances Of Program

10. Graham Mandeno's code to prevent multiple instances

11. Prevent Multiple Instances?

12. Multiple non-default instances of a report

 

 
Powered by phpBB® Forum Software