This chapter showed some techniques that can be useful to troubleshoot concurrent programs. The key idea when dealing with such programs is that you can usually tell when something bad happened only after it happens. So, adding additional code that generates alerts with diagnostic information can be a lifesaver. Many times, this is simply additional logging or
Printf statements and
panics (a.k.a Poor Man’s Debugger). Add such code to your programs and keep that code alive in production. Immediate failure is almost always better than incorrect computation.