Skip to content

Commit

Permalink
Lock more methods of JobReport
Browse files Browse the repository at this point in the history
Production jobs were seeing scrambled job reports caused by
pileup file entries.
  • Loading branch information
Dr15Jones committed May 19, 2022
1 parent ce797ae commit 6deaf60
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions FWCore/MessageLogger/src/JobReport.cc
Expand Up @@ -376,13 +376,11 @@ namespace edm {
void JobReport::inputFileClosed(InputType inputType, JobReport::Token fileToken) {
JobReport::InputFile& f = impl_->getInputFileForToken(inputType, fileToken);
f.fileHasBeenClosed = true;
std::lock_guard<std::mutex> lock(write_mutex);
if (inputType == InputType::Primary) {
impl_->writeInputFile(f);
} else {
{
std::lock_guard<std::mutex> lock(write_mutex);
impl_->writeInputFile(f);
}
impl_->writeInputFile(f);
}
}

Expand Down Expand Up @@ -434,6 +432,7 @@ namespace edm {
void JobReport::outputFileClosed(JobReport::Token fileToken) {
JobReport::OutputFile& f = impl_->getOutputFileForToken(fileToken);
f.fileHasBeenClosed = true;
std::lock_guard<std::mutex> lock(write_mutex);
impl_->writeOutputFile(f);
}

Expand Down Expand Up @@ -541,6 +540,7 @@ namespace edm {

void JobReport::reportMemoryInfo(std::vector<std::string> const& memoryData) {
if (impl_->ost_) {
std::lock_guard<std::mutex> lock(write_mutex);
std::ostream& msg = *(impl_->ost_);
msg << "<MemoryService>\n";

Expand All @@ -555,6 +555,7 @@ namespace edm {

void JobReport::reportMessageInfo(std::map<std::string, double> const& messageData) {
if (impl_->ost_) {
std::lock_guard<std::mutex> lock(write_mutex);
std::ostream& msg = *(impl_->ost_);
msg << "<MessageSummary>\n";
typedef std::map<std::string, double>::const_iterator const_iterator;
Expand All @@ -572,6 +573,7 @@ namespace edm {
if (not impl_->printedReadBranches_.compare_exchange_strong(expected, true))
return;
if (impl_->ost_) {
std::lock_guard<std::mutex> lock(write_mutex);
std::ostream& ost = *(impl_->ost_);
ost << "<ReadBranches>\n";
tinyxml2::XMLDocument doc;
Expand Down

0 comments on commit 6deaf60

Please sign in to comment.