From b0556136c47c120f2bb91e24577b3e764d481640 Mon Sep 17 00:00:00 2001 From: Brian Bockelman Date: Wed, 27 Nov 2024 15:52:11 -0600 Subject: [PATCH] Notify from the main curl worker loop After the notification is done, the request may be deleted by the owning S3File instance. Do not call `Notify` from within the curl result processing function as the request object needs to be alive to release the curl handle. --- src/CurlUtil.cc | 1 + src/HTTPCommands.cc | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/CurlUtil.cc b/src/CurlUtil.cc index 8cc10f0..2b6b2fc 100644 --- a/src/CurlUtil.cc +++ b/src/CurlUtil.cc @@ -315,6 +315,7 @@ void CurlWorker::Run() { "Processing result from curl"); op->ProcessCurlResult(iter->first, res); op->ReleaseHandle(iter->first); + op->Notify(); running_handles -= 1; curl_multi_remove_handle(multi_handle, iter->first); if (res == CURLE_OK) { diff --git a/src/HTTPCommands.cc b/src/HTTPCommands.cc index c5c714e..9cdf2b5 100644 --- a/src/HTTPCommands.cc +++ b/src/HTTPCommands.cc @@ -639,9 +639,6 @@ void HTTPRequest::Notify() { HTTPRequest::CurlResult HTTPRequest::ProcessCurlResult(CURL *curl, CURLcode rv) { - auto cleaner = [&](void *) { Notify(); }; - auto unique = std::unique_ptr((void *)1, cleaner); - if (rv != 0) { if (errorCode.empty()) { errorCode = "E_CURL_IO";