mattyw opened a new pull request, #13745: URL: https://github.com/apache/trafficserver/pull/13745
A hosting.config reload that refers to volumes that don't exist used to report success and install a hosting table with no volumes for generic hostnames. The next cache lookup that fell through to the generic record then dereferenced a null stripes pointer in Cache::key_to_stripe and crashed. This change checks the validity of the CacheHostTable via an `is_valid()` function. If this function determines the CacheHostTable is invalid during a reload then the reload is considered a failure and the existing config is not replaced. This follows the same pattern as remap.config. - CacheHostTable counts discarded entries (m_numErrors) and gains is_valid(). A table is valid only if no entries were discarded and the generic record has at least one volume. - The cache_hosting reload handler builds the new table first. If it isn't valid, the handler calls CfgLoadFail and keeps the previous table. traffic_ctl config reload now exits 2 instead of 0, and diags.log records that the previous configuration was kept. - CacheHostMatcher::NewEntry returns bool, so failed host lines can be counted instead of being dropped silently. - BuildTable no longer sets the reload status itself on a read error. The handler previously called CfgLoadComplete right after it, so the same task got two conflicting status updates. - CacheHostRecord::Init now checks every number in a comma-separated volume list. Before, once one number matched, the rest were skipped without a warning. - CacheHostRecord::Init also backs remap @volume= and proxy.config.cache.default_volumes. A list such as volume=1,99, where volume 99 doesn't exist, used to half-work silently. It is now rejected with bad volume number [99]. An empty or missing hosting.config is still valid, and all volumes are then used for generic hostnames, as before. We don't add a null check to Cache::key_to_stripe. Every caller dereferences the returned stripe immediately, so returning nullptr would only move the crash. Startup is already gated by IsCacheReady(), and reloads are now validated, so there is no known path to an empty generic record. -- 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]
