Skip to content

Commit 081d9a0

Browse files
committed
include/seastar/gate: re-enable SEASTAR_GATE_HOLDER_DEBUG and fix race condition during gate debug
1 parent e7a2679 commit 081d9a0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

include/seastar/core/gate.hh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@
2929
#include <seastar/util/modules.hh>
3030
#include <cassert>
3131
#include <exception>
32+
#include <mutex>
3233
#include <optional>
3334
#include <utility>
3435
#endif
3536

3637
#ifdef SEASTAR_DEBUG
37-
// See: https://tracker.ceph.com/issues/64332
38-
// #define SEASTAR_GATE_HOLDER_DEBUG
38+
#define SEASTAR_GATE_HOLDER_DEBUG
3939
#endif
4040

4141
namespace seastar {
@@ -174,14 +174,17 @@ public:
174174
#ifdef SEASTAR_GATE_HOLDER_DEBUG
175175
using member_hook_t = boost::intrusive::list_member_hook<boost::intrusive::link_mode<boost::intrusive::auto_unlink>>;
176176
member_hook_t _link;
177+
std::mutex _debug_mutex;
177178

178179
void debug_hold_gate() noexcept {
179180
if (_g) {
181+
std::lock_guard<std::mutex> lock(_debug_mutex);
180182
_g->_holders.push_back(*this);
181183
}
182184
}
183185

184186
void debug_release_gate() noexcept {
187+
seastar::lock_guard<seastar::mutex> lock(_debug_mutex);
185188
_link.unlink();
186189
}
187190
#else // SEASTAR_GATE_HOLDER_DEBUG

0 commit comments

Comments
 (0)