As per my understanding following 2 issues causes the issue.
- WebApp holds the reference to First applicationMasterServer instance, which has rmcontext with ActiveServiceContext (holds RMApps + nodes map). WebApp remains to life time of RM process.
- On transistion to active RMNMInfo object is registered in MBean and never unregistered on transitionToStandBy
On transistion to Standby and again based to active new RMContext gets created, but above 2 issues causes first RMcontext persist still RMShutdown.