Open makortel opened 1 year ago
A new Issue was created by @makortel Matti Kortelainen.
@Dr15Jones, @perrotta, @dpiparo, @rappoccio, @makortel, @smuzaffar can you please review it and eventually sign/assign? Thanks.
cms-bot commands are listed here
assign alca,db
New categories assigned: db,alca
@yuanchao,@ggovi,@francescobrivio,@francescobrivio,@malbouis,@malbouis,@saumyaphor4252,@saumyaphor4252,@tvami,@tvami,@ChrisMisan you have been requested to review this Pull request/Issue and eventually sign? Thanks
I think the problem is the following:
FileBlock
constructor (MillePedeFileConverter::endLuminosityBlockProduce()
calls with zip=true
) reads the file once to figure out its size, and asks blob
to reserve memory for as many elements
https://github.com/cms-sw/cmssw/blob/038eb56268f2fb41e45e46828e556c174dc1f589/CondFormats/Common/src/FileBlob.cc#L11-L23
FileBlob::read()
reads the file again (this time also storing the data)
https://github.com/cms-sw/cmssw/blob/038eb56268f2fb41e45e46828e556c174dc1f589/CondFormats/Common/src/FileBlob.cc#L34-L38
then sets the size of the blob
to the number of characters in the file, computes an upper bound for the compressed data size with computeBound()
, and calls compress2()
https://github.com/cms-sw/cmssw/blob/038eb56268f2fb41e45e46828e556c174dc1f589/CondFormats/Common/src/FileBlob.cc#L45-L50
I think what happens is that compressBound(isize)
is larger than isize
(which is allowed behavior mentioned in the documentation
This function may return a conservative value that may be larger than sourceLen.
), and that leads to a write beyond the allocated buffer.
https://github.com/cms-sw/cmssw/pull/40408 proposes a minimal fix.
I noticed the compression and uncompression failures are reported with LogError()
(that, I suppose, end up being effectively ignored in production jobs?). I can't avoid wondering if this is sufficient, or if production use cases would benefit from exceptions instead.
@cms-sw/alca-l2 @cms-sw/db-l2 The fix https://github.com/cms-sw/cmssw/pull/40408 was merged. Do you want to keep this issue open for the other question I raised https://github.com/cms-sw/cmssw/issues/40407#issuecomment-1366008357 or should we close it?
hi @makortel thanks for the fix! Can you please point me to the LogError()
msg you are referring to?
I'm wondering in particular https://github.com/cms-sw/cmssw/blob/a22313c07c6ccf65d78b792730fbf0f36db16d45/CondFormats/Common/src/FileBlob.cc#L47-L49 https://github.com/cms-sw/cmssw/blob/a22313c07c6ccf65d78b792730fbf0f36db16d45/CondFormats/Common/src/FileBlob.cc#L65-L68 https://github.com/cms-sw/cmssw/blob/a22313c07c6ccf65d78b792730fbf0f36db16d45/CondFormats/Common/src/FileBlob.cc#L81-L84 https://github.com/cms-sw/cmssw/blob/a22313c07c6ccf65d78b792730fbf0f36db16d45/CondFormats/Common/src/FileBlob.cc#L95-L98
(the other two in read()
and computeFileSize()
look less suspicious, although I could wonder also there what exactly ends up being happening in case of those errors)
CMSSW_13_0_ASAN_X_2022-12-26-2300 reports in workflow 138.5 step 3
https://cmssdt.cern.ch/SDT/cgi-bin/logreader/el8_amd64_gcc11/CMSSW_13_0_ASAN_X_2022-12-26-2300/pyRelValMatrixLogs/run/138.5_ExpressCollisions2021/step3_ExpressCollisions2021.log#/