Juniper/contrail-controller — pull request #292 by bailkeri (2014-02-12 08:42:21+00:00)
Title: OnTaskCancel of Cancelled timer task asserts if the restarted timer fire...

...s.

Following set of events will cause this issue:
1. Start the Timer
2. Timer Fires. StartTimerTask() gets called. Timer Task is enqueued and spawned
3. Before the task is run/executed by TBB, timer is cancelled. "task_cancel_" is set to true for this TimerTask.
4. Timer is restarted and timer fires again. Timer task is created.
5. TBB executes the task started in step(2) and cancelled in step(3). The TimerTask::Run returns as task is cancelled. On destructor of TaskImpl, Taskscheduler calls TimerTask::OnTaskCancel. We will hit the assert.

Test case to recreate the failure scenario.
1. TBB_THREAD_COUNT is set to one to simulate spawning of timer task and not executing it