# HG changeset patch # User Sebastien Jodogne # Date 1403726030 -7200 # Node ID bd5659f2a50aef9d7d23462e0d550edda21c0af0 # Parent 1fbe89dc18b55a3d268fee58988dd00e46f00a70 fix possible race condition diff -r 1fbe89dc18b5 -r bd5659f2a50a OrthancServer/OrthancRestApi/OrthancRestResources.cpp --- a/OrthancServer/OrthancRestApi/OrthancRestResources.cpp Wed Jun 25 21:48:16 2014 +0200 +++ b/OrthancServer/OrthancRestApi/OrthancRestResources.cpp Wed Jun 25 21:53:50 2014 +0200 @@ -599,7 +599,7 @@ // Retrieve all the instances of this patient/study/series typedef std::list Instances; Instances instances; - context.GetIndex().GetChildInstances(instances, publicId); + context.GetIndex().GetChildInstances(instances, publicId); // (*) // Loop over the instances bool isFirst = true; @@ -610,7 +610,18 @@ { // Get the tags of the current instance, in the simplified format Json::Value full, simplified; - context.ReadJson(full, *it); + + try + { + context.ReadJson(full, *it); + } + catch (OrthancException&) + { + // Race condition: This instance has been removed since + // (*). Ignore this instance. + continue; + } + SimplifyTags(simplified, full); if (simplified.type() != Json::objectValue)