mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2026-11-26 05:31:36 +00:00
fix(shmem): fill the result of Monitor::GetDebugInfo()
- The function reserved each result vector and then wrote to result[segment][handle], past the end of the vector: it returned empty vectors and corrupted the heap - Append one entry per buffer, in the order of the buffer offset - Check the debug map for null before its first use - Name the map entries (segment id, offset, buffer) instead of .first and .second - Enable Monitor.GetDebugInfo (needs FAIRMQ_DEBUG_MODE) - Update the documentation page that described the defect Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -483,14 +483,13 @@ unordered_map<uint16_t, std::vector<BufferDebugInfo>> Monitor::GetDebugInfo(cons
|
||||
|
||||
Uint16MsgDebugMapHashMap* debug = managementSegment.find<Uint16MsgDebugMapHashMap>(bipc::unique_instance).first;
|
||||
|
||||
result.reserve(debug->size());
|
||||
|
||||
|
||||
if (debug) {
|
||||
for (const auto& s : *debug) {
|
||||
result[s.first].reserve(s.second.size());
|
||||
for (const auto& e : s.second) {
|
||||
result[s.first][e.first] = BufferDebugInfo(e.first, e.second.fPid, e.second.fSize, e.second.fCreationTime);
|
||||
result.reserve(debug->size());
|
||||
for (const auto& [segmentId, buffers] : *debug) {
|
||||
auto& infos = result[segmentId];
|
||||
infos.reserve(buffers.size());
|
||||
for (const auto& [offset, buffer] : buffers) {
|
||||
infos.emplace_back(offset, buffer.fPid, buffer.fSize, buffer.fCreationTime);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user