Skip to content

Conversation

@maskit
Copy link
Member

@maskit maskit commented Aug 28, 2023

If you look at the code on 9.2.x, the code is basically:

if (time_down) {

} else {  // Clear the failure
  info->app.http_data.fail_count   = 0;
  info->app.http_data.last_failure = time_down;
}

but on master it's like

if (time_down != TS_TIME_ZERO) {
  if (++count < max_retry) {

  } else {  // Clear the failure
    info->app.http_data.fail_count   = 0;
    info->app.http_data.last_failure = time_down;
  }
}

So the counter never reaches max_retry.

The code on 9.2.x:

if (time_down) {
// Increment the fail_count
++info->app.http_data.fail_count;
if (info->app.http_data.fail_count >= t_state.txn_conf->connect_attempts_rr_retries) {
if (info->app.http_data.last_failure == 0) {
char *url_str = t_state.hdr_info.client_request.url_string_get(&t_state.arena, nullptr);
int host_len;
const char *host_name_ptr = t_state.unmapped_url.host_get(&host_len);
std::string_view host_name{host_name_ptr, size_t(host_len)};
ts::bwprint(error_bw_buffer, "CONNECT: {::s} connecting to {} for host='{}' url='{}' marking down",
ts::bwf::Errno(t_state.current.server->connect_result), t_state.current.server->dst_addr, host_name,
ts::bwf::FirstOf(url_str, "<none>"));
Log::error("%s", error_bw_buffer.c_str());
if (url_str) {
t_state.arena.str_free(url_str);
}
}
info->app.http_data.last_failure = time_down;
SMDebug("http", "hostdb update marking IP: %s as down",
ats_ip_nptop(&t_state.current.server->dst_addr.sa, addrbuf, sizeof(addrbuf)));
} else {
SMDebug("http", "hostdb increment IP failcount %s to %d",
ats_ip_nptop(&t_state.current.server->dst_addr.sa, addrbuf, sizeof(addrbuf)), info->app.http_data.fail_count);
}
} else { // Clear the failure
info->app.http_data.fail_count = 0;
info->app.http_data.last_failure = time_down;
}

@maskit maskit added the Core label Aug 28, 2023
@maskit maskit added this to the 10.0.0 milestone Aug 28, 2023
@maskit maskit self-assigned this Aug 28, 2023
@bryancall bryancall requested a review from bneradt August 28, 2023 22:06
@maskit maskit merged commit 3de9b5c into apache:master Aug 28, 2023
cmcfarlen pushed a commit to cmcfarlen/trafficserver that referenced this pull request Jun 3, 2024
cmcfarlen pushed a commit to cmcfarlen/trafficserver that referenced this pull request Jun 3, 2024
* commit '01409a61bab49c81cf422cdb29a94dcd07bf3c37': (31 commits)
  cmake: add more executables (apache#10284)
  Fix a crash due to bad disks (apache#10287)
  ts_lua_transform: input_reader may be used uninitialized (apache#10297)
  CID 1508887 fix parent_select plugin stat Time of check. (apache#10260)
  Make remap API compatibility checks consistent. (apache#10253)
  remove deprecated 'NATIVE' AIO mode (apache#10269)
  Fix connect failure count (apache#10294)
  Add version range up to CMake 3.27 (apache#10259)
  untangle fds_limit global (apache#10288)
  replace net_config_poll_timeout with EThread::default_wait_interval_ms (apache#10289)
  suppress coverity false positive on race condition (apache#10278)
  initialize variable (apache#10277)
  Check the inet_pton return value for IP reputations (apache#10267)
  Fix missing virtual destructor. (apache#10293)
  tools/jtest: use @SWOC_LIBS@ (apache#10292)
  Fix m4 quoting on configure error messages. (apache#10258)
  build_h3_tools: explicitly chmod the destination directory (apache#10274)
  Fix CID 1508979: unchecked return value (apache#10281)
  Fix CID 1508970: Uninitialized scalar variable (apache#10282)
  Fix CID 1508992, 1508976, 1508972: uninitialized scalar variables (apache#10275)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants