When you try to upgrade more than 160 ws in a single PM instalation a TO MANY CONNECTIONS ERROR happens, and this stop the ws upgrade. When you make the upgrade of many ws, each ws opens a new connection to the DB, and this is closed only at the end of all ws upgrade, so this cause the TO MANY CONNECTIONS error. To solve the problem I kill the connection to the DB at the end of each ws upgrade.