Digging for Locking Problems

Once again I got the wake-up call and needed to deal with a problem on the server. During the night there had been a problem with deadlocks and it stopped the server. What a drag.

Thank goodness for the extra logging I had put into the server. This time it was the reloading of the missing marks after they had been received. The code evaluated the stock families for those with new prices from the loading of the missing marks. The problem was that in some conditions a tick coming in for the instrument that's getting revalued from the loading of the missing marks was locking from the stock down, and the revalue method was only locking the options. That's certainly a source of potential deadlock.

These deadlocks have been very hard to eliminate. I know that if I used the exclusive locks and not try to be cute with the read/write mutexes it'd be a lot easier. But I think it's important to the server that I try very hard to make these read/write mutexes work. I'm close, I can feel it.