bneradt commented on code in PR #12988:
URL: https://github.com/apache/trafficserver/pull/12988#discussion_r2956298246
##########
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:
The updated patch no longer dereferences initial_table after publishing it.
Any deferred @volume= initialization now happens before
rewrite_table.store(...), so a reload can’t swap out and free the published
table while startup is still using that pointer.
--
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]