Skip to content

Commit 34c30b1

Browse files
authored
Fix assert when client aborts during backfill (#6809)
Co-authored-by: Susan Hinrichs <shinrich@verizonmedia.com>
1 parent 85d28d9 commit 34c30b1

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

proxy/http/Http1ClientSession.cc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,8 @@ Http1ClientSession::do_io_close(int alerrno)
264264
_reader->consume(_reader->read_avail());
265265
} else {
266266
read_state = HCS_CLOSED;
267+
SET_HANDLER(&Http1ClientSession::state_wait_for_sm_shutdown);
268+
ka_vio = _vc->do_io_read(this, INT64_MAX, read_buffer);
267269
HttpSsnDebug("[%" PRId64 "] session closed", con_id);
268270
HTTP_SUM_DYN_STAT(http_transactions_per_client_con, transact_count);
269271
HTTP_DECREMENT_DYN_STAT(http_current_client_connections_stat);
@@ -274,6 +276,16 @@ Http1ClientSession::do_io_close(int alerrno)
274276
}
275277
}
276278

279+
int
280+
Http1ClientSession::state_wait_for_sm_shutdown(int event, void *data)
281+
{
282+
STATE_ENTER(&Http1ClientSession::state_wait_for_sm_shutdown, event, data);
283+
ink_assert(read_state == HCS_CLOSED);
284+
285+
// Just eat IO events until the state machine has finished
286+
return 0;
287+
}
288+
277289
int
278290
Http1ClientSession::state_wait_for_close(int event, void *data)
279291
{

proxy/http/Http1ClientSession.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ class Http1ClientSession : public ProxySession
8787
int state_keep_alive(int event, void *data);
8888
int state_slave_keep_alive(int event, void *data);
8989
int state_wait_for_close(int event, void *data);
90+
int state_wait_for_sm_shutdown(int event, void *data);
9091

9192
enum C_Read_State {
9293
HCS_INIT,
@@ -96,11 +97,10 @@ class Http1ClientSession : public ProxySession
9697
HCS_CLOSED,
9798
};
9899

99-
NetVConnection *client_vc = nullptr;
100-
int magic = HTTP_SS_MAGIC_DEAD;
101-
int transact_count = 0;
102-
bool half_close = false;
103-
bool conn_decrease = false;
100+
int magic = HTTP_SS_MAGIC_DEAD;
101+
int transact_count = 0;
102+
bool half_close = false;
103+
bool conn_decrease = false;
104104

105105
MIOBuffer *read_buffer = nullptr;
106106
IOBufferReader *_reader = nullptr;

proxy/http/HttpSM.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3271,6 +3271,11 @@ HttpSM::tunnel_handler_ua(int event, HttpTunnelConsumer *c)
32713271
server_session->get_netvc()->set_active_timeout(HRTIME_SECONDS(t_state.txn_conf->background_fill_active_timeout));
32723272
}
32733273

3274+
// Even with the background fill, the client side should go down
3275+
c->write_vio = nullptr;
3276+
c->vc->do_io_close(EHTTP_ERROR);
3277+
c->alive = false;
3278+
32743279
} else {
32753280
// No background fill
32763281
p = c->producer;

0 commit comments

Comments
 (0)