Skip to content

Commit c3f675f

Browse files
committed
Cluster: do not prolong the lifetime of Cluster for PrepareHostHandler
It was supposed to fix a crash when "host up" event interleaves with the destruction of Cluster object, but it introduced another bug, which can be observed e.g. in ControlConnectionTests.Integration_Cassandra_FullOutage integration test. The bug is that `EventLoop` still has working "timer handle" while being destroyed and, in turn, segfaults.
1 parent 81df6bf commit c3f675f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/cluster.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ void Cluster::internal_notify_host_up(const Address& address) {
520520
return; // Ignore host
521521
}
522522

523-
if (!prepare_host(host, bind_callback(&Cluster::on_prepare_host_up, Cluster::Ptr(this)))) {
523+
if (!prepare_host(host, bind_callback(&Cluster::on_prepare_host_up, this))) {
524524
notify_host_up_after_prepare(host);
525525
}
526526
}
@@ -613,7 +613,7 @@ void Cluster::notify_host_add(const Host::Ptr& host) {
613613
return; // Ignore host
614614
}
615615

616-
if (!prepare_host(host, bind_callback(&Cluster::on_prepare_host_add, Cluster::Ptr(this)))) {
616+
if (!prepare_host(host, bind_callback(&Cluster::on_prepare_host_add, this))) {
617617
notify_host_add_after_prepare(host);
618618
}
619619
}

0 commit comments

Comments
 (0)