File tree Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -125,6 +125,8 @@ int appsec_helper_main_impl()
125
125
126
126
runner->run ();
127
127
128
+ runner->unregister_for_rc_notifications ();
129
+
128
130
finished.store (true , std::memory_order_release);
129
131
}};
130
132
thread_id = thr.native_handle ();
Original file line number Diff line number Diff line change @@ -123,7 +123,7 @@ void runner::register_for_rc_notifications()
123
123
std::atomic_load (&RUNNER_FOR_NOTIFICATIONS);
124
124
if (!runner) {
125
125
// NOLINTNEXTLINE(bugprone-lambda-function-name)
126
- SPDLOG_ERROR (" No runner to notify of remote config updates" );
126
+ SPDLOG_WARN (" No runner to notify of remote config updates" );
127
127
ddog_remote_config_path_free (path);
128
128
return ;
129
129
}
@@ -136,15 +136,19 @@ void runner::register_for_rc_notifications()
136
136
});
137
137
}
138
138
139
- runner::~runner () noexcept
139
+ void runner::unregister_for_rc_notifications ()
140
140
{
141
+ SPDLOG_INFO (" Unregister runner for RC update callback" );
141
142
try {
142
143
std::shared_ptr<runner> expected = shared_from_this ();
143
144
std::atomic_compare_exchange_strong (&RUNNER_FOR_NOTIFICATIONS,
144
145
&expected, std::shared_ptr<runner>(nullptr ));
145
146
} catch (...) {
146
- // can only happened if there is no shared_ptr for the runner
147
- // in this case a std::bad_weak_ptr is thrown
147
+ // can only happen if there is no shared_ptr for the runner
148
+ // in this case a std::bad_weak_ptr is thrown.
149
+ // But we only expose runner through a shared pointer, so this would
150
+ // require extraordinary actions to destroy the shared pointer but not
151
+ // the object.
148
152
std::abort ();
149
153
}
150
154
}
Original file line number Diff line number Diff line change @@ -26,14 +26,16 @@ class runner : public std::enable_shared_from_this<runner> {
26
26
runner &operator =(const runner &) = delete ;
27
27
runner (runner &&) = delete ;
28
28
runner &operator =(runner &&) = delete ;
29
- ~runner () noexcept ;
29
+ ~runner () = default ;
30
30
31
31
static void resolve_symbols ();
32
32
33
33
void run () noexcept (false );
34
34
35
35
void register_for_rc_notifications ();
36
36
37
+ void unregister_for_rc_notifications ();
38
+
37
39
[[nodiscard]] bool interrupted () const
38
40
{
39
41
return interrupted_.load (std::memory_order_acquire);
You can’t perform that action at this time.
0 commit comments