Open bsergean opened 8 months ago
Do you call aerospike_close() before calling aerospike_destroy()?
aerospike_close() should perform a graceful shutdown of the cluster while aerospike_destroy() just frees cluster memory. aerospike_destroy() alone does not attempt to stop the cluster tend thread.
Yes we do, this is what our cleanup looks like.
as_error err{};
as_error_reset( &err );
auto * cluster = static_cast<aerospike *>( mInternalObject );
if ( aerospike_close( cluster, &err ) != AEROSPIKE_OK )
{
LOG_ERROR( "Could not close connection to aerospike: error({}) {} at [{}:{}]", static_cast<int>( err.code ), err.message, err.file, err.line );
}
aerospike_destroy( cluster );cleaner]
LOG_INFO( "Closing aero event loops" );
as_event_close_loops();
We changed the way we are closing our uv_loop, maybe this is our problem.
Could it help to call
as_event_set_external_loop( ... );
with a null pointer to tell that the loop is gone ... ? Or maybe we call uv_run a few times to advance the event loop which could help the aerospike graceful termination.
When are you closing the shared uv_loop?
If you are sharing libuv event loops with the C client via as_event_set_external_loop() or as_set_external_event_loop(), then closing those event loops must come after as_event_close_loops().
Good point, we are calling uv_stop (loop) before our aero shutdown sequence. I think we need to reshuffle things.
Before our event loop gets stopped. Any idea of what's going on ? If feels like after calling as_event_close_loops the cluster_tend mechanic should stop (and that thread exit).