Skip to content

Commit f2e959f

Browse files
authored
Fix issue where origins could be unintentionally marked as down (#12729)
* Fix issue where origins could be unintentionally marked as down * Set connect_result only when an actual connection error is detected * Prevent unnecessary overwriting of error codes * Revert "Prevent unnecessary overwriting of error codes" This reverts commit 76cd57e. * Revert "Set connect_result only when an actual connection error is detected" This reverts commit bd1c192.
1 parent fcd0827 commit f2e959f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/proxy/http/HttpSM.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1823,6 +1823,9 @@ HttpSM::state_http_server_open(int event, void *data)
18231823
_netvc->do_io_write(this, 1, _netvc_reader);
18241824
_netvc->set_inactivity_timeout(this->get_server_connect_timeout());
18251825

1826+
// Pre-emptively set a server connect failure that will be cleared once a WRITE_READY is received from origin or
1827+
// bytes are received back
1828+
t_state.set_connect_fail(EIO);
18261829
} else { // in the case of an intercept plugin don't to the connect timeout change
18271830
SMDbg(dbg_ctl_http_connect, "not setting handler for connection handshake");
18281831
this->create_server_txn(this->create_server_session(*_netvc, _netvc_read_buffer, _netvc_reader));
@@ -1841,6 +1844,7 @@ HttpSM::state_http_server_open(int event, void *data)
18411844
case CONNECT_EVENT_TXN:
18421845
SMDbg(dbg_ctl_http, "Connection handshake complete via CONNECT_EVENT_TXN");
18431846
if (this->create_server_txn(static_cast<PoolableSession *>(data))) {
1847+
t_state.current.server->clear_connect_fail();
18441848
handle_http_server_open();
18451849
} else { // Failed to create transaction. Maybe too many active transactions already
18461850
// Try again (probably need a bounding counter here)
@@ -8045,9 +8049,6 @@ HttpSM::set_next_state()
80458049
}
80468050

80478051
case HttpTransact::StateMachineAction_t::ORIGIN_SERVER_OPEN: {
8048-
// Pre-emptively set a server connect failure that will be cleared once a WRITE_READY is received from origin or
8049-
// bytes are received back
8050-
t_state.set_connect_fail(EIO);
80518052
HTTP_SM_SET_DEFAULT_HANDLER(&HttpSM::state_http_server_open);
80528053

80538054
// We need to close the previous attempt

0 commit comments

Comments
 (0)