It appears that when the service is upgraded, the middleware dll is replaced immediately whereas the service is replace upon reboot. This causes a mismatch that means IPM will fail with API session error until reboot. In cases where service replacement is scheduled, the dll should probably be replaced by same mechanism rather than immediately.