Fix some bugs that were causing spurious stalls

Fixed the following problems:
* The start time of the stall was moving ahead while the stall was in flight, thereby smaller stall than actual
* Added a delay in reseting the stall timer right after the the task finishes, to avoid a race condition where a stall was being reported errorneously (when there was no stall)
* There might still be some race conditions that can give rise to stalls that are not legitimate, albiet much infrequent. Added a fence condition to make sure that if we are reporting a stall then the stall duration should be at least be equal to the task timeout.