<< | Thread Index | >> ]    [ << | Date Index | >> ]

Subject: RE: Service exiting
From: Jan Olderdissen <jolderdissen,AT,ixiacom,DOT,com>
Date: Wed, 13 Mar 2002 06:07:06 +0100

Damion,

I have some more data. If you modify CipeTapIO::RequestAsyncReceive() as
follows:

DWORD loopcount;
void CipeTapIO::RequestAsyncReceive()
   {
        loopcount = 0;
        int i;
        UCHAR catcher[1000];
        memset (catcher, 0xab, 1000);
    if (! CheckForShutdownIndication())
       {
                for (i=0; i<1000; i++) if (catcher[i] != 0xab)
                        DbgPrint ("i");
        while (m_Synchronous = ReadFile (m_Handle, m_Buffer.buffer,
DescriptorSize(), &m_Buffer.length, &m_Overlapped))
           {
                        loopcount++;
                        for (i=0; i<1000; i++) if (catcher[i] != 0xab)
                                DbgPrint ("i");
            CompleteAsyncReceive();
                        for (i=0; i<1000; i++) if (catcher[i] != 0xab)
                                DbgPrint ("i");
           }

                for (i=0; i<1000; i++) if (catcher[i] != 0xab)
                        DbgPrint ("i");
        if ((++m_Tx % STATISTICS_UPDATE_FREQUENCY) == 0 && m_Tx > 0)
           {
            UpdateAdapterStatistics();
           }
       }

        for (i=0; i<1000; i++) if (catcher[i] != 0xab)
                DbgPrint ("i");
        for (i=0; i<1000; i++) if (catcher[i] != 0xab)
                DbgPrint ("i");
        for (i=0; i<1000; i++) if (catcher[i] != 0xab)
                DbgPrint ("i");
        for (i=0; i<1000; i++) if (catcher[i] != 0xab)
                DbgPrint ("i");
        for (i=0; i<1000; i++) if (catcher[i] != 0xab)
                DbgPrint ("i");
        for (i=0; i<1000; i++) if (catcher[i] != 0xab)
                DbgPrint ("i");
        for (i=0; i<1000; i++) if (catcher[i] != 0xab)
                DbgPrint ("i");
        for (i=0; i<1000; i++) if (catcher[i] != 0xab)
                DbgPrint ("i");
        for (i=0; i<1000; i++) if (catcher[i] != 0xab)
                DbgPrint ("i"); // *
        for (i=0; i<1000; i++) if (catcher[i] != 0xab)
                DbgPrint ("i");
   }

The guard array will very often catch a write of 0x00000010. The DbgPrint
that gets to execute is not fixed. I conclude from this that the effect must
be asynchronous and not necessarily have something to do with TapIO. I have
not yet determined which of the asynchronous ios is actually doing the bad
thing. Since the location of the overwrite is not relative to the stack
pointer inside RequestAsyncReceive but relative to the stack pointer at the
time of entry into the function, it is likely that the problem is elsewhere.
I'll have to isolate the problem further.

How many threads are executing in the code? I didn't find any creation of
addtional threads, is that correct?

The last guard array catch took the cake. I had put breakpoints on all the
DbgPrint statements, the one with the * executed! 

It would be really helpful if you could imagine anything that will
asynchronously write 0x10 into some pre-allocated storage.
STATUS_UNSUCCESSFUL is not it. A return structure passed to asynchronously
completing functions that is allocated on the stack would be my primary
suspect.

Jan

-----Original Message-----
From: Damion Wilson [mailto:dwilson,AT,ibl,DOT,bm
Sent: Tuesday, March 12, 2002 16:46
To: Jan Olderdissen
Cc: cipe-l,AT,inka,DOT,de
Subject: Re: Service exiting

It may even be one of the error statuses passed out by CompleteIRP in 
cipdrvr.c when it's upset about a packet size or something. I may have to 
reevaluate returning STATUS_UNSUCCESSFUL to the read IRP substituting
instead 
a successful read of 0 bytes.

Another thought. This might be occurring when there's just enough traffic
for 
the packets to queue up in AdapterTransmit (cipdrvr.c) so that the driver 
answers read IRPs with packets stored for a while. Since this code was even 
working properly (re queued packets) in my original CIPE-Win32 (different 
design), I don't know if that's a red herring or not. Again, this behaviour 
does not appear to exhibit itself on NT4.

(Sigh) well we're almost there aren't we ?

DKW

On Tuesday 12 March 2002 02:18 am, you wrote:
> Hi Damion,
>
> I'm finally able to devote company time on CIPE. Today I've made some
> inroads into the issue with the service exiting at higher bandwidth. What
> appears to be happening is that under certain conditions,
> CipeTapIO::RequestAsyncReceive() fails to exit and returns to the command
> prompt instead. I'm suspecting some kind of asynchronous interaction with
> the ReadFile() call that sometimes messes up the stack. I can make the
> error much more likely to occur by adding DbgPrint ("a") as the last line
> of the function. If I do that, my CIPE test system becomes completely
> unstable when I do any kind of volume transfer. Sometimes, both sides exit
> simultaneously!
>
> My current pet theory is that under the failure condition, ReadFile will
> fail but the driver will get a time slice before the function exits.
> Something is messed up at this point and the function's return fails. I
> will research this more, of course. It would be very interesting to find
> out whether you can make the error occur when you add that DbgPrint()
> statement as discussed above.
>
> I've also found a bizarre workaround that I'll have to research some more.
> It is totally incomprehensible to me why it should make a difference. But
> it does make the system stable. More on that later.
>
> Jan





<< | Thread Index | >> ]    [ << | Date Index | >> ]