Potential crash in ParallelTask (Bug #283)


Added by Hwee Miin Koh about 4 years ago. Updated about 4 years ago.


Status:Closed Start date:07/01/2013
Priority:Low Due date:
Assignee:- % Done:

0%

Category:Task Spent time: -
Target version:1.8.4
Affected version:1.8.0

Description

In ParallelTask.cs line 225 ~ 234

events[taskNumber].Set();
tasksDetails[taskNumber].Finished = true;
tasksDetails[taskNumber].ParentResult.BuildProgressInformation.UpdateStartupInformation(GetStatusInformation(tasksDetails[taskNumber]));
}, loop);
}
logger.Debug("Waiting for tasks to complete");
WaitHandle.WaitAll(events);

Because the event is set before the worker-thread actually ended (there are still 2 line of code to run after that), it is possible that the main-thread continue to run before the worker-thread ended. Thus, in extreme case, it is possible that CCNet declares the integration as completed even though some of the worker-thread still running, and when CCNet starts another integration using the same project, where it allocate new taskDetails array at ParallelTask.cs line 168:

tasksDetails = new ParallelRunningSubTaskDetails[numberOfTasks];
If the previous unfinished worker-thread continue to run the last 2 line of its code, which involve calling to GetStatusInformation():

events[taskNumber].Set();
tasksDetails[taskNumber].Finished = true;
tasksDetails[taskNumber].ParentResult.BuildProgressInformation.UpdateStartupInformation(GetStatusInformation(tasksDetails[taskNumber]));

It might encounter NullReferenceException on accessing taskDetails.


History

Updated by Hwee Miin Koh about 4 years ago

A possible fix would be moving event signaling to the end of the code:

tasksDetails[taskNumber].Finished = true;
tasksDetails[taskNumber].ParentResult.BuildProgressInformation.UpdateStartupInformation(GetStatusInformation(tasksDetails[taskNumber]));
events[taskNumber].Set();

Updated by Ruben Willems about 4 years ago

did you use CCNet 1.8.0 ?
if so, upgrade to 1.8.3 or later, because there was a bug fixed in the paralleltask concerning this part of the code.
see issue #173

  • Status changed from New to Feedback
  • Assignee set to Hwee Miin Koh
  • Target version set to 1.8.4

Updated by Hwee Miin Koh about 4 years ago

Yes, I've noticed that fix, even though I didn't upgrade to 1.8.3, I apply that fix manually on 1.8.0. Besides, this issue is different from #173. This issue only happen in extreme case where the worker thread not finished before next integration started.

Updated by Ruben Willems about 4 years ago

  • Status changed from Feedback to In Progress
  • Assignee changed from Hwee Miin Koh to Ruben Willems

Updated by Ruben Willems about 4 years ago

  • Status changed from In Progress to Closed
  • Assignee deleted (Ruben Willems)

Also available in: Atom PDF