From: Lennart Poettering Date: Sat, 11 May 2024 11:45:44 +0000 (+0200) Subject: curl-glue: catch libcurl attempting to change timeout handler when we destroy a curl... X-Git-Tag: v256-rc2~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c5ecf0949460dd0bf3211db128a385ce6375252e;p=thirdparty%2Fsystemd.git curl-glue: catch libcurl attempting to change timeout handler when we destroy a curl context on exit If we destroy both an event loop and a curl contect object at the same time, then we get into this weird situation where curl wants us to reconfigure a timout event source right before destruction, which sd-event will refuse however, since it is already being shutdown. Hence, catch that and simply don't bother adjusting the timeout, since we cannot get back from there anyway. --- diff --git a/src/import/curl-util.c b/src/import/curl-util.c index 10f2aa0468e..1628f833a97 100644 --- a/src/import/curl-util.c +++ b/src/import/curl-util.c @@ -134,6 +134,13 @@ static int curl_glue_timer_callback(CURLM *curl, long timeout_ms, void *userdata assert(curl); + /* Don't configure timer anymore when the event loop is dead already. */ + if (g->timer) { + sd_event *event_loop = sd_event_source_get_event(g->timer); + if (event_loop && sd_event_get_state(event_loop) == SD_EVENT_FINISHED) + return 0; + } + if (timeout_ms < 0) { if (g->timer) { if (sd_event_source_set_enabled(g->timer, SD_EVENT_OFF) < 0)