From d1c398b7868a9d4977c50458f64ffc294417592c Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 26 Sep 2024 18:36:17 +0200 Subject: [PATCH] Revert "BUG/MINOR: server: shut down streams under thread isolation" This reverts commit b500e84e24fd19ccbcdf4fae5165aeb07e46bd67. Thread isolation does not work well for this, there exists code paths which already hold the server's lock and result in a deadlock. Let's revert that and address it better without isolation. --- src/server.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/server.c b/src/server.c index da7eba34a4..c0795c0a55 100644 --- a/src/server.c +++ b/src/server.c @@ -2015,9 +2015,7 @@ static int srv_has_streams(struct server *srv) * code in , which must be one of SF_ERR_* indicating the reason for the * shutdown. * - * Note: the function will switch to thread isolation (due to shutdown_stream() - * modifying the streams directly), and commonly called with the server's lock - * held as well though not needed anymore (this is not a bug). + * Must be called with the server lock held. */ void srv_shutdown_streams(struct server *srv, int why) { @@ -2025,14 +2023,10 @@ void srv_shutdown_streams(struct server *srv, int why) struct mt_list back; int thr; - thread_isolate(); - for (thr = 0; thr < global.nbthread; thr++) MT_LIST_FOR_EACH_ENTRY_LOCKED(stream, &srv->per_thr[thr].streams, by_srv, back) if (stream->srv_conn == srv) stream_shutdown(stream, why); - - thread_release(); } /* Shutdown all connections of all backup servers of a proxy. The caller must -- 2.47.3