Thanks again Anil for the information provided.
For the current beta stage of the module, I will have to chose between the lesser of two evil. either:
- the module crash because of a programming error causing lost of analytic data. The crash cause the application pool to fail making the website(s) not available. Customer is not happy that website(s) in app pool are down.
or
- The module crash because of a programming error but try to recover in specific phase of the processing. Analytic data is lost but the website is still up running. If done properly, hopefully there is no memory leak. Customer is a little bit annoyed to lost analytic data but he's aware that it's a private beta so he can understand about possible error left.
In this private beta, the customer will not be debugging the application himself nor are we going to have access to the machine directly so we will have to rely on debug logs. So I'm not too worried about the debugging feature not being available. Locally we can remove this code for testing but still, when I was testing it by remote debugging the process w3wp.exe, the debugger was dying on that specific line and not stopping on it so I couldn't do anything about it. Maybe there is an option that I still don't know in C++ debugging or the way the code was programmed was wrong, I cannot tell yet.
For now, option 2 seems the more appropriate even thought I don't like it since you're right, code should be working properly on the get go and I'm not arguing against that. Now I have to make that decision from a business point of view based on time and resource available.
So basically what I will have to do it to check every phase of the page processing, check where memory is allocated, catch possible unexpected error. I will have to divide the check per phase to help the debugging process and when it fail in phase N, log more details about it and try to recover memory/original page content if possible. What I'm not sure is how to warn the customer that something very bad happened. Event Log seemed fine but it the bug is on every request, it will flood it, which is not good.
I really appreciate the time you take to answer this question. I will mark this thread as answered soon since I don't think there is much left to talk. Is there anything else I should be careful about SEH, I will be more happy to hear about it. I don't know if it would have made a difference it the application would have been made in C++/ATL. For now it's a one class application with C code inside methods using pointer everywhere. I don't know if this is/was common for ISAPI/Module programming even in C++ (using pointers). Maybe I'm too judgmental since the programmer didn't have experience for win32 programming but I still have to evaluate it for possible future development of this module or the a newer one.
@Lextm:
I will check the link you provided and see if it can help at a later stage. It seems to relate to info for IIS5/6 but I guess it must still work under II7 to debug native code.