Skip to content

Commit

Permalink
Pause MaxMemoryPreload for edmplugincache file reading in PluginManager
Browse files Browse the repository at this point in the history
In a local developer area with many packages checked out, the
PluginManager cache can be tens of megabytes larger than in a
developer area without packages being checked out. This difference can
result in false positive warnings in MaxMemoryPreload monitoring in PR
tests. An easy way (even if hacky) out is to exclude the PluginManager
cache from the MaxMemoryPreload monitoring.
  • Loading branch information
makortel committed Oct 30, 2024
1 parent 09ebaf9 commit ab2cab7
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
16 changes: 16 additions & 0 deletions FWCore/PluginManager/src/PauseMaxMemoryPreloadSentry.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include "PauseMaxMemoryPreloadSentry.h"

// By default do nothing, but add "hooks" that MaxMemoryPreload can
// override with LD_PRELOAD
void pauseMaxMemoryPreload() {}
void unpauseMaxMemoryPreload() {}

namespace edm {
PauseMaxMemoryPreloadSentry::PauseMaxMemoryPreloadSentry() {
pauseMaxMemoryPreload();
}
PauseMaxMemoryPreloadSentry::~PauseMaxMemoryPreloadSentry(){
unpauseMaxMemoryPreload();
}
}

17 changes: 17 additions & 0 deletions FWCore/PluginManager/src/PauseMaxMemoryPreloadSentry.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#ifndef FWCore_PluginManager_src_PauseMaxMemoryPreloadSentry_h
#define FWCore_PluginManager_src_PauseMaxMemoryPreloadSentry_h

namespace edm {
class PauseMaxMemoryPreloadSentry {
public:
PauseMaxMemoryPreloadSentry();
~PauseMaxMemoryPreloadSentry();

PauseMaxMemoryPreloadSentry(const PauseMaxMemoryPreloadSentry&) = delete;
PauseMaxMemoryPreloadSentry(PauseMaxMemoryPreloadSentry&&) = delete;
PauseMaxMemoryPreloadSentry& operator=(const PauseMaxMemoryPreloadSentry&) = delete;
PauseMaxMemoryPreloadSentry& operator=(PauseMaxMemoryPreloadSentry&&) = delete;
};
}

#endif
3 changes: 3 additions & 0 deletions FWCore/PluginManager/src/PluginManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
#include "FWCore/Utilities/interface/Exception.h"
#include "FWCore/Utilities/interface/thread_safety_macros.h"

#include "PauseMaxMemoryPreloadSentry.h"

namespace edmplugin {
//
// constants, enums and typedefs
Expand All @@ -47,6 +49,7 @@ namespace edmplugin {
throw cms::Exception("PluginMangerCacheProblem")
<< "Unable to open the cache file '" << cacheFile.string() << "'. Please check permissions on file";
}
edm::PauseMaxMemoryPreloadSentry pauseSentry;;
CacheParser::read(file, dir, categoryToInfos);
return true;
}
Expand Down

0 comments on commit ab2cab7

Please sign in to comment.