bneradt commented on code in PR #12988:
URL: https://github.com/apache/trafficserver/pull/12988#discussion_r2956296865


##########
src/proxy/ReverseProxy.cc:
##########
@@ -68,22 +69,28 @@ int
 init_reverse_proxy()
 {
   ink_assert(rewrite_table.load() == nullptr);
-  reconfig_mutex = new_ProxyMutex();
-  rewrite_table.store(new UrlRewrite());
+  reconfig_mutex      = new_ProxyMutex();
+  auto *initial_table = new UrlRewrite();
 
-  rewrite_table.load()->acquire();
+  initial_table->acquire();
   Note("%s loading ...", ts::filename::REMAP);
-  if (!rewrite_table.load()->load()) {
+  if (!initial_table->load()) {
     Emergency("%s failed to load", ts::filename::REMAP);
   } else {
     Note("%s finished loading", ts::filename::REMAP);
   }
 
+  rewrite_table.store(initial_table, std::memory_order_release);
+
   RecRegisterConfigUpdateCb("proxy.config.url_remap.filename", url_rewrite_CB, 
(void *)FILE_CHANGED);
   RecRegisterConfigUpdateCb("proxy.config.proxy_name", url_rewrite_CB, (void 
*)TSNAME_CHANGED);
   RecRegisterConfigUpdateCb("proxy.config.reverse_proxy.enabled", 
url_rewrite_CB, (void *)REVERSE_CHANGED);
   RecRegisterConfigUpdateCb("proxy.config.http.referer_default_redirect", 
url_rewrite_CB, (void *)HTTP_DEFAULT_REDIRECT_CHANGED);
 
+  if (initial_table->is_valid() && CacheProcessor::IsCacheEnabled() == 
CacheInitState::INITIALIZED) {
+    init_remap_volume_host_records();
+  }
+

Review Comment:
   I couldn’t move the ConfigRegistry registration later because remap.config 
has to be registered before load() so .include children can be tracked 
correctly. Instead, I changed startup so the deferred @volume= initialization 
runs on the private initial_table before it is published to rewrite_table. That 
keeps the startup-only walk off the shared remap table and avoids the reload 
race you called out.
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to