Sounds a lot like 'problem 2' as described in McAfee support article:
KB79875 - "Agent Deployment" server task does not expire when it cannot reach the client computer
I've also found this too as well as ad sync tasks which never terminate, making subsequent sync tasks then fail too. I'd be interested to see if ePO 5.1.0 does this out of the box or just a result of upgrading.
Upgraded to ePO 5.1.1 recently, and I am seeing similar. I have tried the first two steps in the KB with no success. My AD synch is not running. The strange thing is, before I restarted services, I terminated the task and it was pending termination. Once the services restarted, the old task started running again. I terminated it again, and it is now pending termination again. This is very frustrating.