Re: Surprising error in PFN_HSE_IO_COMPLETION Function by David
David
Sat Nov 06 01:56:01 CST 2004
I want to make sure I understand your program flow correctly.
> Here's my program flow:
> Receive call to HttpExtensionProc
> Call ServerSupportFunction(..., HSE_REQ_IO_COMPLETION, ...)
You need to queue up an async operation prior to returning
HSE_STATUS_PENDING. So, are you making an async WriteClient prior to
returing HSE_STATUS_PENDING, or are you queuing up work in a thread pool
which is making the async WriteClient call?
> Return HSE_STATUS_PENDING
> Make many calls to WriteClient(..., HSE_IO_ASYNC) being careful to
> wait each time for my callback to be called before issuing the
> next WriteClient.
When you chain async WriteClient, you are doing so from the async completion
function, yes? I'm not certain why you even need to "wait for the callback".
The callback happens whenever it wants, asynchronous to the WriteClient, at
which point you can immediately make another asynch WriteClient.
> After the last WriteClientCall has had its callback, I call
> ServerSupportFunction(..., HSE_REQ_DONE_WITH_SESSION, ...)
> Never touch that ECB again.
In other words, I hope you have code that reduced to this:
1. Inside of HttpExtensionProc
2. Set HSE_REQ_IO_COMPLETION for IOCompletionFunction
3. Make initial async WriteClient call
4. If success, return HSE_STATUS_PENDING; else, return HSE_STATUS_ERROR.
Never touch the ECB at this point
1. Inside of IOCompletionFunction
2. If dwError is 0, then make another async WriteClient call ; else, call
HSE_REQ_DONE_WITH_SESSION with HSE_STATUS_ERROR
3. When your code decides to no longer chain async WriteClient, call
HSE_REQ_DONE_WITH_SESSION with HSE_STATUS_SUCCESS
4. Never touch the ECB at this point
> Is it OK to call
> ServerSupportFunction(..., HSE_REQ_IO_COMPLETION, ...)
> for each request, and if not, could that be causing the
No, you MUST call HSE_REQ_IO_COMPLETION for each request that is going to
make an async operation. Each request has exactly one async operation
outstanding and has NO knowledge of any other request -- thus it must
individually set HSE_REQ_IO_COMPLETION for that request.
> Any other ideas of what could cause these errors?
Can you clarify your rationale as to why you think that these errors are
unexpected problems??? Are you suggesting that:
1. network communications is perfect
2. network disconnections never happen
3. network transmissions always happen without errors/disconnections between
the client and server
4. IIS is fabricating error codes to keep you on your toes
> Of course, there are many ECBs open at any one time,
> about 100 currently but will get into the thousands
> as this project gets more mature.
This is not a problem. IIS can have thousands of requests in-flight (limited
more by system resources than by IIS architecture), and if you keep things
asynchronous, you have a good chance to scale well along with IIS.
--
//David
IIS
This posting is provided "AS IS" with no warranties, and confers no rights.
//
"Howard Rubin - change nospam to nyx" <hrubin@nospam.net> wrote in message
news:1099593433.431291@irys.nyx.net...
In my ISAPI dll, my PFN_HSE_IO_COMPLETION callback function is
occasionally called with dwError (the 4th) parameter set to 64
(ERROR_NETNAME_DELETED) or 121 (ERROR_SEM_TIMEOUT). According
to the VC7 help, ERROR_NETNAME_DELETED can happen if the
HSE_REQ_CLOSE_CONNECTION function of ServerSupportFunction is called.
I'm never doing that though, and ERROR_SEM_TIMEOUT is still a mystery.
Just in case it's relevant, GetLastError() returns 1008 (ERROR_NO_TOKEN)
Here's my program flow:
Receive call to HttpExtensionProc
Call ServerSupportFunction(..., HSE_REQ_IO_COMPLETION, ...)
Return HSE_STATUS_PENDING
Make many calls to WriteClient(..., HSE_IO_ASYNC) being careful to
wait each time for my callback to be called before issuing the
next WriteClient.
After the last WriteClientCall has had its callback, I call
ServerSupportFunction(..., HSE_REQ_DONE_WITH_SESSION, ...)
Never touch that ECB again.
Of course, there are many ECBs open at any one time, about 100 currently
but will get into the thousands as this project gets more mature.
Is it OK to call ServerSupportFunction(..., HSE_REQ_IO_COMPLETION, ...)
for each request, and if not, could that be causing the
ERROR_NETNAME_DELETED and / or ERROR_SEM_TIMEOUT errors I'm seeing?
Any other ideas of what could cause these errors?
Thanks,
Howard Rubin