One of clients went to run some of our applications on their Windows Server 2003 SP1 box and it wasn’t very pretty. They got the error message:
“The procedure entry point DefWindowProcI could not be located in the dynamic link library msdart.dll”
Not a very helpful message. It happens when we access an ADO object within our code. We couldn’t duplicate the problem on our W2K3 SP1 boxes. Some searches through Google seem to point the figure at a corrupted MDAC stack with SP1. When our client rolled SP1 back, the problem went away. Microsoft seems to be aware of a similiar problem as they have a KB article, 889114, that describes a similiar issue in Msdart.dll, but not with W2K3. I have also seen references to another article, 892500, but that one refers to DCOM permissions. I’m not sure if that one is relevant.
The question now is how to resolve this issue. How many ways can SP1 be installed on Windows Server 2003? Our boxes got SP1 through Windows Update and they have the right version of Msdat.dll.
During initial e-Link web service development, I played around with lowering the priority of a background processing thread. It didn’t need to run in real time and having the service handling client requests was more important. For a background housekeeping thread, I lowered it’s priority to BelowNormal.
Well that didn’t work quite the way I expected it. That thread never ran, or it ran so seldom that it was effectively useless. So I removed the calls to lowering the thread priority and life was good again. I chalked it up to one of those thread things not to touch and moved on to other tasks.
Today, I saw a posting on the Coding Horror that explained why you should never mess with thread prioirities. If you have a thread running at a lower priority and it enters a sleep state, it may never wake up if another thread with a higher priority continues to run. That’s an oversimplification, the actual details are described better here by Joe Duffy.
The moral of today’s story is “Set up your threads at normal priority and let the operating system deal with scheduling them“