Omer Frenkel has submitted this change and it was merged. Change subject: engine: fix race in CommandAsyncTask ......................................................................
engine: fix race in CommandAsyncTask The race was the following: 1: [thread 1] CommandAsyncTask's constructor reaches the point "entityInfo.AttachTask(this)" while the "_multiTasksByCommandIds" still contains one task. After this it gets interrupted 2: [thread 2] the CommandAsyncTask.handleEndActionResult is executed in meanwhile and issues the "_multiTasksByCommandIds.remove(commandInfo.getCommandId());" 3: [thread 1] the first thread continues the execution and calls the "entityInfo.AttachTask(this);" 4: [thread 1] the CommandAsyncTask.ConcreteStartPollingTask() is called. It asks for the GetCommandMultiAsyncTasks which returns null (because thread 2 have deleted it) and fails on NPE on the next line Fixed by moving all the code which needs to be synchonized to the sync block. It will not cause any deadlocks because the CommandMultiAsyncTasks.AttachTask does not use the original _lockObject (nor directly nor indirectly). Change-Id: Id265df1c1843b976c6f8d65729fd6717c3df3c76 Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1015638 Signed-off-by: Tomas Jelinek <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandAsyncTask.java 1 file changed, 8 insertions(+), 3 deletions(-) Approvals: Omer Frenkel: Verified; Looks good to me, approved -- To view, visit http://gerrit.ovirt.org/20183 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Id265df1c1843b976c6f8d65729fd6717c3df3c76 Gerrit-PatchSet: 2 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Tomas Jelinek <[email protected]> Gerrit-Reviewer: Arik Hadas <[email protected]> Gerrit-Reviewer: Omer Frenkel <[email protected]> Gerrit-Reviewer: Ravi Nori <[email protected]> Gerrit-Reviewer: Roy Golan <[email protected]> Gerrit-Reviewer: Tomas Jelinek <[email protected]> Gerrit-Reviewer: oVirt Jenkins CI Server _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
