Roles getting inactive while deploying a solution

Roles getting inactive while deploying a solution

Sometimes when we deploy a new release to an environment , some of the roles from any random espaces gets inactive and in result your will get invalid permission. this seems to be very weird but it happens many time with us.