MSMQ 4.0 Messages stay stuck in outgoing Queue if and only if a Message Time Out is Specified

A very interesting case came in this week. Customer is sending HTTPS messages from Win2k3 machine to another Win2k3 Server with an Win2k8 Server acting as an intermediate server. The HTTPS remained stuck in outgoing queue and would eventually timeout. What made the case interesting was the fact that the problem only reproduces when you specify a timeout value. If no TTRQ value is specified, then the messages make it through to the destination server. This is what was mind boggling.

At first I thought, this may be a bug with the HTTPS code. But we were able to reproduce the problem with HTTP messages as well. After some digging we realized that the problem was related to time sync issues between the sender and receiver. The Sender was about 2 mins behind the Receiver. As a result with a 30sec time to reach queue value specified, the messages would have expired even before the message arrived in the queue. As a result the messages remained stuck in the outgoing queue on the sender.

To fix the problem, we ensured that the system clocks on the two machines were in sync and the messages started to flow between the two boxes.