RE: [ntdev] Ndisallocatepacket failing
Hi Alan
one more thing i forgot to point out was that
u got it abosultely right in guessing that my
send function was being called from the receive
indicate handler.
The other thing to point out is that i have counted the allocs and frees
and they become mismatched ie the allocs exceed the frees when this
problem occurs.
Also i found out another way of quickly arriving at the problem. When the
application
sitting in the user mode ( which has a open handle to the drriver ) is
exited using ctrl C, then the underlying driver
come up with the problem. In this ctrl C case, the drivers PacketClose
functions is called.
In this what i see is that after the application has exited using ctrl C,
the alloc are getting called,
but the sendcomplete handler stops getting called and thus again the problem
occurs
and a mismatch occurs in the allocs and frees.
regds
Mayank
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Alan Kan
Sent: Tuesday, May 11, 2004 1:42 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Ndisallocatepacket failing
A few points:
- Your code looks fine without queuing.
- The queuing issue I mentioned in my pseudo code was something I have
seen that caused a race condition leading to leaking of NDIS packet
resources, which I thought may be causing your problem. The queuing was
needed for a number of reasons in that particular application, but may not
apply to your case. For example, queuing can be employed to detect
out-of-order packet completion, for sanity checking, or is needed when this
is the protocol half of an intermediate driver that needs to perform packet
processing. - Are you binding to a stock hardware NIC driver or is it your NIC driver
as well? What I’m getting at is, do you see a matching number of
SendCompleteHandler() calls as the number of NdisSend() calls you make? - The code as it is shown should not have any problems being called
multiple times by multiple threads, as there are no shared data shown.
However, as this is probably just a skeleton of your actual driver you may
want to double check if there are any shared data structure being accessed
between the SendFunction() and the SendComplete() function that may
contribute to a race condition. - The fact that you are seeing this allocate failure easily with SoftICE
breakpointing is something to ponder with respect to the underlying NIC
driver completing the packets. If the underlying NIC driver is a stock
hardware driver, you might consider changing the network card (thus a
different NIC driver) to see if the behavior changes, and hopefully get more
clues.
Hope it helps.
Alan Kan
xxxxx@flyingeaglesoftware.com