In my previous post on XMLHttpRequest, I explained why I chose to implement my http request class using the legacy WinInet library, rather than one of the more modern alternatives. Last week, I was able to get the DOM parsing part of PeteSearch running, and so I was able to start stress-testing my class.
I was getting a lot of crashes, and after finding and eliminating a couple of my own bugs, and paring down the code as much as I could I was left with some minimal code that still crashed, often in the wininet dll!
After digging around some more on the MSDN site, and reading between the lines, I realized this seemed to be a known problem, and there probably wasn't much I could do about it. They recommend using WinHttp for "server applications", and there seem to be a lot of hard-coded limits in WinInet, such as how many concurrent accesses to the same server you can have.
As far as I could tell, the crashes all occurred when I had a lot of requests being processed on different threads at the same time.
I replaced WinInet in my XMLHttpRequest implementation with WinHttp, and the crashes went away, which is strong evidence that it wasn't my code doing something whacky. I'll be posting the updated code in my next article.
Comments