This is an automated email from the ASF dual-hosted git repository.
masaori pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new b5b1b1f6ec [origin_server_auth] Fix race of config_reloader vs delete
(#12143)
b5b1b1f6ec is described below
commit b5b1b1f6ec742eccb4e003c2b9305d4061c0ef40
Author: Masaori Koshiba <[email protected]>
AuthorDate: Tue Apr 1 07:48:05 2025 +0900
[origin_server_auth] Fix race of config_reloader vs delete (#12143)
* [origin_server_auth] Fix race of config_reloader vs delete
* Fix format
---
plugins/origin_server_auth/origin_server_auth.cc | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/plugins/origin_server_auth/origin_server_auth.cc
b/plugins/origin_server_auth/origin_server_auth.cc
index affd975867..6036cca1a5 100644
--- a/plugins/origin_server_auth/origin_server_auth.cc
+++ b/plugins/origin_server_auth/origin_server_auth.cc
@@ -48,6 +48,7 @@
#include <ts/remap.h>
#include <ts/remap_version.h>
#include <tsutil/TsSharedMutex.h>
+#include "ts/apidefs.h"
#include "tscore/ink_config.h"
#include "swoc/TextView.h"
@@ -554,6 +555,12 @@ public:
}
}
+ TSMutex
+ config_reloader_mutex()
+ {
+ return TSContMutexGet(_conf_rld);
+ }
+
ts::shared_mutex reload_mutex;
enum versions { awsv2 = 0, awsv4 = 1, gcpv1 = 2 };
@@ -1262,8 +1269,11 @@ TSRemapNewInstance(int argc, char *argv[], void **ih,
char * /* errbuf ATS_UNUSE
void
TSRemapDeleteInstance(void *ih)
{
- S3Config *s3 = static_cast<S3Config *>(ih);
+ S3Config *s3 = static_cast<S3Config *>(ih);
+ TSMutex s3_mutex_ptr = s3->config_reloader_mutex();
+ TSMutexLock(s3_mutex_ptr);
delete s3;
+ TSMutexUnlock(s3_mutex_ptr);
}
///////////////////////////////////////////////////////////////////////////////