Skip to content

Commit

Permalink
alive_clients may be cleaned up out of order
Browse files Browse the repository at this point in the history
Though arguably this shouldn't happen.  For now, just fix the
crash on exit.  We don't need to debug the issue if we're moving
to the new BIO code.
  • Loading branch information
alandekok committed Jan 15, 2025
1 parent 6a69e73 commit b0c587a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/lib/io/master.c
Original file line number Diff line number Diff line change
Expand Up @@ -919,14 +919,20 @@ static fr_client_t *radclient_alloc(TALLOC_CTX *ctx, int ipproto, fr_io_address_
*/
static int _client_live_free(fr_io_client_t *client)
{
talloc_get_type_abort(client, fr_io_client_t);

fr_assert(client->in_trie);
fr_assert(!client->connection);
fr_assert(fr_heap_num_elements(client->thread->alive_clients) > 0);
fr_assert(client->thread);

if (client->pending) TALLOC_FREE(client->pending);

(void) fr_trie_remove_by_key(client->thread->trie, &client->src_ipaddr.addr, client->src_ipaddr.prefix);
(void) fr_heap_extract(&client->thread->alive_clients, client);

if (client->thread->alive_clients) {
fr_assert(fr_heap_num_elements(client->thread->alive_clients) > 0);
(void) fr_heap_extract(&client->thread->alive_clients, client);
}

return 0;
}
Expand Down

0 comments on commit b0c587a

Please sign in to comment.