Skip to content

Double calling TRANSACT_RETURN from HttpTransact::handle_cache_write_lock #7872

@shinrich

Description

@shinrich

Noticed this while walking code trying to see how an assert from @ezelkow1 could occur. Looking at the last if/else clause in HttpTransact::handle_cache_write_lock

  if (s->cache_info.write_lock_state == CACHE_WL_READ_RETRY) {
    TxnDebug("http_error", "calling hdr_info.server_request.destroy");
    s->hdr_info.server_request.destroy();
    HandleCacheOpenReadHitFreshness(s);
  } else {
    StateMachineAction_t next;
    next = how_to_open_connection(s);
    if (next == SM_ACTION_ORIGIN_SERVER_OPEN || next == SM_ACTION_ORIGIN_SERVER_RAW_OPEN) {
      s->next_action = next;
      TRANSACT_RETURN(next, nullptr);
    } else {
      // hehe!
      s->next_action = next;
      ink_assert(s->next_action == SM_ACTION_DNS_LOOKUP);
      return;
    }
    TRANSACT_RETURN(next, nullptr);
  }

If the outer else is taken and the next is SM_ACTION_ORIGIN_SERVER_OPEN, then TRANSACT_RETURN is called in the if body and also on return through the outer else.

Doesn't seem like a good thing. Appears to be accidental change from PR #1794

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions