Asynchronous IO

Hello,

I am sorry to bother you with a non-NT related question, but I don?t
know where else to turn to (if there still are out there win 9x DDK
developer sites, I would appreciate if you let me know).

This is my problem:

I have a client program that is performing asynchronous IO with this
driver I?m working on. It works just fine for a while, and then the
driver doesn?t receive any more calls to its device IO control routine.
The system keeps running normally.

I have this routine that does something like:

?

Wait_Semaphore(getEvent, BLOCK_SVC_INTS);

memcpy(cc.lpBuffer, pdb, sizeof(DataBundle));

*cc.lpcbBytesReturned = sizeof(DataBundle);

cc.lpoOverlapped->O_InternalHigh = sizeof(DataBundle);

VWIN32_DIOCCompletionRoutine(cc.lpoOverlapped->O_Internal);

PageUnlock((DWORD)cc.lpBuffer, sizeof(DataBundle));

PageUnlock((DWORD)cc.lpoOverlapped, sizeof(OVERLAPPED));

PageUnlock((DWORD)cc.lpcbBytesReturned, sizeof(DWORD));

Wait_Semaphore(chkEvent, BLOCK_SVC_INTS);

memcpy(pdb, cc.lpBuffer, sizeof(DataBundle));

cc.lpcbBytesReturned = 0;

cc.lpoOverlapped->O_InternalHigh = 0;

VWIN32_DIOCCompletionRoutine(cc.lpoOverlapped->O_Internal);

PageUnlock((DWORD)cc.lpBuffer, sizeof(DataBundle));

PageUnlock((DWORD)cc.lpoOverlapped, sizeof(OVERLAPPED));

PageUnlock((DWORD)cc.lpcbBytesReturned, sizeof(DWORD));

?

The two semaphores are signaled in the device IO control routine on two
separate control codes.

Can anyone tell me what may cause this?

Many thanks,

Andrei Zlate-Podani

I would check the system for deadlocks. Are you sure getEvent isn’t being
released before chkEvent ?

Alberto.

-----Original Message-----
From: Andrei Zlate-Podani [mailto:xxxxx@bitdefender.com]
Sent: Monday, July 28, 2003 11:10 AM
To: Windows System Software Developers Interest List
Subject: [ntdev] Asynchronous IO

Hello,

I am sorry to bother you with a non-NT related question, but I don?t
know where else to turn to (if there still are out there win 9x DDK
developer sites, I would appreciate if you let me know).

This is my problem:

I have a client program that is performing asynchronous IO with this
driver I?m working on. It works just fine for a while, and then the
driver doesn?t receive any more calls to its device IO control routine.
The system keeps running normally.

I have this routine that does something like:

?

Wait_Semaphore(getEvent, BLOCK_SVC_INTS);

memcpy(cc.lpBuffer, pdb, sizeof(DataBundle));

*cc.lpcbBytesReturned = sizeof(DataBundle);

cc.lpoOverlapped->O_InternalHigh = sizeof(DataBundle);

VWIN32_DIOCCompletionRoutine(cc.lpoOverlapped->O_Internal);

PageUnlock((DWORD)cc.lpBuffer, sizeof(DataBundle));

PageUnlock((DWORD)cc.lpoOverlapped, sizeof(OVERLAPPED));

PageUnlock((DWORD)cc.lpcbBytesReturned, sizeof(DWORD));

Wait_Semaphore(chkEvent, BLOCK_SVC_INTS);

memcpy(pdb, cc.lpBuffer, sizeof(DataBundle));

cc.lpcbBytesReturned = 0;

cc.lpoOverlapped->O_InternalHigh = 0;

VWIN32_DIOCCompletionRoutine(cc.lpoOverlapped->O_Internal);

PageUnlock((DWORD)cc.lpBuffer, sizeof(DataBundle));

PageUnlock((DWORD)cc.lpoOverlapped, sizeof(OVERLAPPED));

PageUnlock((DWORD)cc.lpcbBytesReturned, sizeof(DWORD));

?

The two semaphores are signaled in the device IO control routine on two
separate control codes.

Can anyone tell me what may cause this?

Many thanks,

Andrei Zlate-Podani


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@compuware.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.

The deadlock is not possible because the two semaphores are signaled in
the device IO control routine
in a sequential manner controlled by a thread in the client program.

After some tests I noticed that the system runs out of some resource
(not memory). I believe it is not
a memory leak, because the “System Monitor” program doesn’t indicate
this. (I used the “Memory
Manager/Allocated memory” and “Memory Manager: Locked memory” graphs).
An error message
is displayed (out of memory) if a new virtual machine is being started
(ie command.com -> new VM),
but if some Win32 program is started (ie Internet Explorer), it runs OK.
Also this behavior persists
after unloading the driver.

Oh, I forgot to mention that I use Windows 98 SE to test the driver.

Any ideas?

Andrei

Moreira, Alberto wrote:

I would check the system for deadlocks. Are you sure getEvent isn’t being
released before chkEvent ?

Alberto.

Hey it looks like you are trying to complete the same asynchronous twice.