Add deadlock detection plugin for XRootD OSS and authorization operations#125
Add deadlock detection plugin for XRootD OSS and authorization operations#125Copilot wants to merge 5 commits into
Conversation
Co-authored-by: bbockelm <1093447+bbockelm@users.noreply.github.com>
Co-authored-by: bbockelm <1093447+bbockelm@users.noreply.github.com>
|
|
||
| DeadlockOss::~DeadlockOss() {} | ||
|
|
||
| XrdOssDF *DeadlockOss::newDir(const char *user) { |
There was a problem hiding this comment.
You can skip deadlock detection for newDir and newFile.
There was a problem hiding this comment.
Removed deadlock monitoring from newDir and newFile in commit 79d693e.
| m_shutdown_cv.notify_one(); | ||
|
|
||
| // Give the thread a moment to exit | ||
| std::this_thread::sleep_for(std::chrono::milliseconds(100)); |
There was a problem hiding this comment.
Join the thread instead of having an arbitrary sleep.
There was a problem hiding this comment.
Changed Shutdown() to join the monitor thread instead of sleeping. Added static m_monitor_thread member. See commit 79d693e.
|
|
||
| DeadlockMonitor::DeadlockMonitor(const char *operation) { | ||
| // Don't create monitors if not initialized | ||
| if (!DeadlockDetector::m_initialized.load(std::memory_order_acquire)) { |
There was a problem hiding this comment.
Assume if the plugin is loaded then it is initialized. Skip this check.
There was a problem hiding this comment.
Removed initialization check from DeadlockMonitor constructor - now assumes plugin is initialized when loaded. See commit 79d693e.
|
|
||
| // Add to the list | ||
| auto &detector = DeadlockDetector::GetInstance(); | ||
| std::unique_lock<std::mutex> lock(detector.m_lists[m_list_id].m_mutex); |
There was a problem hiding this comment.
Get a reference to the list head and use it for the remainder of the function.
There was a problem hiding this comment.
Updated DeadlockMonitor constructor and destructor to get a reference to list_head and use it throughout. See commit 79d693e.
| deadlock.logfile /var/log/xrootd/deadlocks.log | ||
| ``` | ||
|
|
||
| #### How It Works |
There was a problem hiding this comment.
This subsection can be skipped
There was a problem hiding this comment.
Removed "How It Works" subsection from README. See commit 79d693e.
…d on shutdown, optimize list access, implement auth stacking Co-authored-by: bbockelm <1093447+bbockelm@users.noreply.github.com>
Co-authored-by: bbockelm <1093447+bbockelm@users.noreply.github.com>
Addressed all review feedback and fixed unit test issue:
All changes are ready for review. |
| dlclose(lib_handle); | ||
| return nullptr; | ||
| } | ||
|
|
There was a problem hiding this comment.
[lint] reported by reviewdog 🐶
| int DeadlockOss::Reloc(const char *tident, const char *path, | ||
| const char *cgName, const char *anchor) { |
There was a problem hiding this comment.
[lint] reported by reviewdog 🐶
| int DeadlockOss::Reloc(const char *tident, const char *path, | |
| const char *cgName, const char *anchor) { | |
| int DeadlockOss::Reloc(const char *tident, const char *path, const char *cgName, | |
| const char *anchor) { |
| int DeadlockOss::Rename(const char *oPath, const char *nPath, | ||
| XrdOucEnv *oEnvP, XrdOucEnv *nEnvP) { |
There was a problem hiding this comment.
[lint] reported by reviewdog 🐶
| int DeadlockOss::Rename(const char *oPath, const char *nPath, | |
| XrdOucEnv *oEnvP, XrdOucEnv *nEnvP) { | |
| int DeadlockOss::Rename(const char *oPath, const char *nPath, XrdOucEnv *oEnvP, | |
| XrdOucEnv *nEnvP) { |
Deadlock Detection Plugin Implementation Plan
Create core deadlock detection class (DeadlockDetector.hh/cc)
Create OSS wrapper plugin (DeadlockOss.hh/cc)
Create authorization wrapper plugin (DeadlockAcc.hh/cc)
Create unit tests (deadlock_tests.cc)
Create integration tests
Update CMakeLists.txt
Update README.md
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.