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


##########
src/proxy/ReverseProxy.cc:
##########
@@ -82,14 +85,21 @@ init_reverse_proxy()
                                                          
{"proxy.config.url_remap.filename",               // trigger records
                                                           
"proxy.config.proxy_name", "proxy.config.http.referer_default_redirect"});
 
-  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);
   }
 
+  if (initial_table->is_valid() && CacheProcessor::IsCacheEnabled() == 
CacheInitState::INITIALIZED) {
+    // Initialize deferred @volume= mappings before publishing so startup-only
+    // remap walks cannot race a reload.
+    init_table_volume_host_records(*initial_table);
+  }
+
+  rewrite_table.store(initial_table, std::memory_order_release);
   RecRegisterConfigUpdateCb("proxy.config.reverse_proxy.enabled", 
url_rewrite_CB, (void *)REVERSE_CHANGED);

Review Comment:
   `register_config("remap", … reloadUrlRewrite …)` is now executed while 
`rewrite_table` is still `nullptr` (it is only published at the end of 
`init_reverse_proxy`). If a remap reload is triggered in that window (e.g. via 
ConfigRegistry::execute_reload/schedule_reload or a record-triggered reload), 
`reloadUrlRewrite()` will `exchange()` and then `ink_assert(oldTable != 
nullptr)`, which will crash because the current table can still be null. 
Consider publishing a placeholder/initial table to `rewrite_table` before any 
reload can run, or adjust `reloadUrlRewrite()` to tolerate `oldTable == 
nullptr` during startup (treat as first publish and skip releasing/asserting).



-- 
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