joelanders opened a new pull request #6979:
URL: https://github.com/apache/trafficserver/pull/6979


   `next_sync_time` gets set to `ink_time() + hostdb_hostfile_check_interval` 
when a host file is actually loaded and parsed.
   
   The host file is `stat()`ed every `hostdb_hostfile_check_interval`, and only 
if has been updated, is it loaded and parsed.
   
   So, if the host file is untouched for a while, `next_sync_time` is actually 
in the past.
   
   It's only actually used here:
   ```cpp
           HostDBInfo *r = lookup_done(IpAddr(find_result->second), 
hash.host_name, false,
                                       current_host_file_map->next_sync_time - 
ink_time(), nullptr);
   ```
   where it's inserting something into the HostDB with a potentially negative 
TTL. (but actually the TTL is treated as unsigned, so I was seeing a quite 
large TTL.)
   
   I think you probably want to replace that TTL with something like 
`hostdb_hostfile_check_interval` or maybe something fancier involving the last 
update time.
   
   But I've had a lot of coffee so please correct me if I'm wrong :)
   I was definitely seeing debug lines like:
   ```
   [Jul  7 21:20:15.191] Server {0x2b3aa8614700} DEBUG: <HostDB.cc:1122 
(lookup_done)> (hostdb) done 127.0.0.1 TTL -6
   ```
   (that line number is from a different branch)
   
   Related question: is there a way to something like a config reload signal 
for all the hosts in the host file?
   I'm going to try to work around that by setting some small timeouts in the 
following:
   ```
   CONFIG proxy.config.hostdb.host_file.interval INT 10  # stat() the host file 
to see if it's been touched
   CONFIG proxy.config.cache.hostdb.sync_frequency INT 0  # don't persist 
hostdb to disk between restarts
   CONFIG proxy.config.hostdb.verify_after INT 10  #  refresh the cache from 
the last-read host file contents after this long
   ```
   
   Thank you!


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

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


Reply via email to