Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure StreamerInputSource throws an error (75x) #12562

Merged
merged 1 commit into from
Nov 30, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 28 additions & 5 deletions DQMServices/StreamerIO/plugins/DQMStreamerReader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,16 @@ bool DQMStreamerReader::openNextFile_() {
std::string p = fiterator_.make_path(currentLumi.datafn);

if (boost::filesystem::exists(p)) {
openFile_(currentLumi);
return true;
try {
openFile_(currentLumi);
return true;
} catch (const cms::Exception& e) {
fiterator_.logFileAction(std::string("Can't deserialize registry data (in open file): ") + e.what(), p);
fiterator_.logLumiState(currentLumi, "error: data file corrupted");

closeFile_("data file corrupted");
return false;
}
} else {
/* dat file missing */
fiterator_.logFileAction("Data file (specified in json) is missing:", p);
Expand Down Expand Up @@ -290,12 +298,27 @@ bool DQMStreamerReader::checkNextEvent() {
if (file_.streamFile_->newHeader()) {
// A new file has been opened and we must compare Headers here !!
// Get header/init from reader
InitMsgView const* header = getHeaderMsg();
deserializeAndMergeWithRegistry(*header, true);

try {
InitMsgView const* header = getHeaderMsg();
deserializeAndMergeWithRegistry(*header, true);
} catch (const cms::Exception& e) {
fiterator_.logFileAction(std::string("Can't deserialize registry data: ") + e.what());
closeFile_("data file corrupted");
return checkNextEvent();
}
}

// try to recover from corrupted files/events
try {
deserializeEvent(*eview);
} catch (const cms::Exception& e) {
fiterator_.logFileAction(std::string("Can't deserialize event data: ") + e.what());
closeFile_("error");
return checkNextEvent();
}

processedEventPerLs_ += 1;
deserializeEvent(*eview);

return true;
}
Expand Down
16 changes: 6 additions & 10 deletions IOPool/Streamer/src/StreamerInputSource.cc
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ namespace edm {
//std::cout << "Adler32 checksum of init messsage from header = " << initView.adler32_chksum() << " "
// << "host name = " << initView.hostName() << " len = " << initView.hostName_len() << std::endl;
if((uint32)adler32_chksum != initView.adler32_chksum()) {
std::cerr << "Error from StreamerInputSource: checksum of Init registry blob failed "
<< " chksum from registry data = " << adler32_chksum << " from header = "
<< initView.adler32_chksum() << " host name = " << initView.hostName() << std::endl;
// skip event (based on option?) or throw exception?
throw cms::Exception("StreamDeserialization", "Checksum error")
<< " chksum from registry data = " << adler32_chksum << " from header = "
<< initView.adler32_chksum() << " host name = " << initView.hostName() << std::endl;
}

TClass* desc = getTClass(typeid(SendJobHeader));
Expand Down Expand Up @@ -211,10 +211,10 @@ namespace edm {
//std::cout << "Adler32 checksum from header = " << eventView.adler32_chksum() << " "
// << "host name = " << eventView.hostName() << " len = " << eventView.hostName_len() << std::endl;
if((uint32)adler32_chksum != eventView.adler32_chksum()) {
std::cerr << "Error from StreamerInputSource: checksum of event data blob failed "
<< " chksum from event = " << adler32_chksum << " from header = "
<< eventView.adler32_chksum() << " host name = " << eventView.hostName() << std::endl;
// skip event (based on option?) or throw exception?
throw cms::Exception("StreamDeserialization", "Checksum error")
<< " chksum from event = " << adler32_chksum << " from header = "
<< eventView.adler32_chksum() << " host name = " << eventView.hostName() << std::endl;
}
if(origsize != 78 && origsize != 0) {
// compressed
Expand Down Expand Up @@ -335,17 +335,13 @@ namespace edm {
FDEBUG(10) << " original size = " << origSize << " final size = "
<< uncompressedSize << std::endl;
if(origSize != uncompressedSize) {
std::cerr << "deserializeEvent: Problem with uncompress, original size = "
<< origSize << " uncompress size = " << uncompressedSize << std::endl;
// we throw an error and return without event! null pointer
throw cms::Exception("StreamDeserialization","Uncompression error")
<< "mismatch event lengths should be" << origSize << " got "
<< uncompressedSize << "\n";
}
} else {
// we throw an error and return without event! null pointer
std::cerr << "deserializeEvent: Problem with uncompress, return value = "
<< ret << std::endl;
throw cms::Exception("StreamDeserialization","Uncompression error")
<< "Error code = " << ret << "\n ";
}
Expand Down