In one of our cluster, following has happened which failed HDFS write.
1. Standby NN was unstable and continously restarting due to some errors. But Active NN was stable.
2. MR Job was writing files.
3. At some point SNN went down again while datanode processing the REGISTER command for SNN.
4. Datanodes started retrying to connect to SNN to register at the following code in BPServiceActor#retrieveNamespaceInfo() which will be called under synchronization.
Unfortunately in all datanodes at same point this happened.
5. For next 7-8 min standby was down, and no blocks were reported to active NN at this point and writes have failed.
So culprit is BPOfferService#processCommandFromActor() is completely synchronized which is not required.