emaksovalec's Blog

emaksovalec's Avatar Image
Emacs fan from Slovenia. Interested in #linux #emacs #lisp #scheme and so on :)
← All posts

I’ve been chasing a concurrency bug recently. I thought that I have structured everything nicely for simultaneous read/write synchronization between objects but it happened that if two threads were in very specific points of execution there was a possibility of a deadlock. And of course this only showed up when the system was finally put to stress after months of working fine with moderate testing and this only got possible shortly before shipping.

My senior looked at a code and suggested I just swap around some if’s and else’s and that this is probably a C++ compiler bug. But it only worked because the code couldn’t hit that sweet spot so easily and then began to fail in some even more mysterious way.

I guess the moral of the story is to don’t do concurrent mutation with multiple locks if you can avoid it. But then you might be locking your main thread for longer than its appropriate…

To like or reply, open original post on Emacs.ch