How to Remove MUST_SUCCEED_POOL_EMPTY BSOD?

Hi Doron Holan and all Experts,
I use DDK bulkusb sample to drive my usb device.I make a continuous reader as following:(1)in create dispature routine,
IoBuildAsychronousFsdRequest a new Irp, call Bulkusb_UrbReadWrite;(2)in Completion Routine,
A)IoCompleteRequest Irp, B)IoBuildAsychronousFsdRequest
a new Irp,call IoCallDriver to send Irp to usb port.
The driver runs functionally.But after playing the usb device
twenty minutes,appears MUST_SUCCEED_POOL_EMPLTY BSOD.
I try to use IofreeIrp,then IoBuildAsychronousFsdRequest in
Completion Routine,but failed.I also try to reuse Irp,then call
IoCallDriver,failed.
Could you advice?Thanks a lot.


ÇÀ×¢ÑÅ»¢Ãâ·ÑÓÊÏä-3.5GÈÝÁ¿£¬20M¸½¼þ£¡

Yu Zhou wrote:

Hi Doron Holan and all Experts,
I use DDK bulkusb sample to drive my usb device.I make a
continuous reader as following:(1)in create dispature routine,
IoBuildAsychronousFsdRequest a new Irp, call
Bulkusb_UrbReadWrite;(2)in Completion Routine,
A)IoCompleteRequest Irp, B)IoBuildAsychronousFsdRequest
a new Irp,call IoCallDriver to send Irp to usb port.
The driver runs functionally.But after playing the usb device
twenty minutes,appears MUST_SUCCEED_POOL_EMPLTY BSOD.
I try to use IofreeIrp,then IoBuildAsychronousFsdRequest in
Completion Routine,but failed.I also try to reuse Irp,then call
IoCallDriver,failed.
Could you advice?Thanks a lot.

I’ve used this scheme in many drivers. Why don’t you show us the code
that creates the URB/IRP initially, and show us your completion
routine. We’ll see if anything looks unusual.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Hi Experts,
I make request after 1s of begining my usb driver as following:
VOID
pirp = IoBuildAsynchronousFsdRequest(IRP_MJ_READ,
tDeviceObject,
DataBuffer,
DataTransferLength,
&largeInt,
NULL);
IoSetCompletionRoutine(pirp,
(PIO_COMPLETION_ROUTINE)readIoCompletion,
tDeviceObject,
TRUE,
TRUE,
TRUE);
if (!pirp) {
return;// STATUS_INSUFFICIENT_RESOURCES;
}
ntStatus = BulkUsb_UrbReadWrite(
tDeviceObject,
pirp,
TRUE
);
and in CompleteRoutine I do the following:
IoCompleteRequest(Irp,…);
(free urb1)
pirp = IoBuildAsynchronousFsdRequest(IRP_MJ_READ,
tDeviceObject,
DataBuffer,
DataTransferLength,
&largeInt,
NULL);
IoSetCompletionRoutine(pirp,
(PIO_COMPLETION_ROUTINE)readIoCompletion,
tDeviceObject,
TRUE,
TRUE,
TRUE);
if (!pirp) {
return STATUS_INSUFFICIENT_RESOURCES;
}
tdeviceExtension = tDeviceObject->DeviceExtension;
interface = tdeviceExtension->UsbInterface;
pipeHandle = &interface->Pipes[0];
urb2 = BulkUsb_BuildAsyncRequest(tDeviceObject,
pirp,
pipeHandle,
TRUE);
if ( !urb2 ) {
BULKUSB_KdPrint ( DBGLVL_DEFAULT, (“BulkUsb_SingleUrbReadWrite()failed to alloc urb\n” ));
ntStatus2 = STATUS_INSUFFICIENT_RESOURCES;
pirp->IoStatus.Status = ntStatus2;
IoCompleteRequest (pirp, IO_NO_INCREMENT );
return ntStatus2;
}
pirp->IoStatus.Information = 0;
nextStack = IoGetNextIrpStackLocation(pirp);
BULKUSB_ASSERT(nextStack != NULL);
//
// pass the URB to the USB driver stack
//
deviceExtension->BaseUrb = urb2; // save pointer to URb we alloced for this xfer; we free in completion routine
nextStack->Parameters.Others.Argument1 = urb2;
nextStack->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL;
nextStack->Parameters.DeviceIoControl.IoControlCode =
IOCTL_INTERNAL_USB_SUBMIT_URB;
IoSetCompletionRoutine(
pirp, // irp to use
BulkUsb_SimpleReadWrite_Complete, // routine to call when irp is done
tDeviceObject, // we pass our FDO as context to pass routine
TRUE, // call on success
TRUE, // call on error
TRUE); // call on cancel
When I play the usb device 20 minutes,get BSOD titled “41 Must_Succeed_Pool_Empty”
Could you advice?Thanks a lot.


Mp3·è¿ñËÑ-иèÈȸè¸ßËÙÏÂ

Yu Zhou wrote:

Hi Experts,
I make request after 1s of begining my usb driver as following:
VOID
pirp = IoBuildAsynchronousFsdRequest(IRP_MJ_READ,
tDeviceObject,
DataBuffer,
DataTransferLength,
&largeInt,
NULL);

and in CompleteRoutine I do the following:
IoCompleteRequest(Irp,…);

What IRP are you completing here? If this is the completion routine for
the IRP you created above, then you SHOULD NOT call IoCompleteRequest.
The whole reason you are IN the completion routine is because someone
below you already started the completion process. Since you created the
IRP, you need to stop the completion processing (by returning
STATUS_MORE_PROCESSING_REQUIRED) and free the IRP’s memory (by calling
IoFreeIrp).

I’m guessing that your error is caused because you never free the IRPs
you allocate.

(free urb1)

But not the IRP?

pirp = IoBuildAsynchronousFsdRequest(IRP_MJ_READ,
tDeviceObject,
DataBuffer,
DataTransferLength,
&largeInt,
NULL);
IoSetCompletionRoutine(pirp,
(PIO_COMPLETION_ROUTINE)readIoCompletion,
tDeviceObject,
TRUE,
TRUE,
TRUE);
if (!pirp) {
return STATUS_INSUFFICIENT_RESOURCES;
}

This code is in the wrong order. If pirp did come back NULL, then you
pass it to IoSetCompletionRoutine before checking for NULL.
IoSetCompletionRoutine will bugcheck. Check for NULL *immediately*
after the IoBuildAsynchronousFsdRequest.

When I play the usb device 20 minutes,get BSOD titled “41
Must_Succeed_Pool_Empty”
Could you advice?Thanks a lot.

My guess is that you never call IoFreeIrp.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.