The Case of The Async Log4Net Appender

Wednesday, October 16, 2013

It was a bad day. I was coding away happily as we started getting alerts that one of our production farms is down. Our service seemed to be stuck on each one of our servers. Requests are coming in, but no responses appear. Restarting the service helped, only to get stuck again after a while. The logs were unhelpful, and we had to pull out windbg to figure out what was going on. When your day starts with windbg, you know it won’t be a good one. The command ~*e!clrstack (=view stack trace of all managed threads) showed...

Console.ReadKey .NET 4.5 changes may deadlock your system

Wednesday, September 12, 2012

I’ve hit a weird issue today. We have a service that we run both as Windows service and from console. A specific use case seemed to cause our system to hang, but only when running from console. Also, I was sure this didn’t happen before I upgraded my machine to .NET 4.5. The service initialization code looks something like this: serviceHost.Open();   while (Console.ReadKey().Key != ConsoleKey.Q) { Console.WriteLine("Press Q to exit"); ...