Commit 82a1557
committed
Fix bg fill teardown crash in update_size_and_time_stats
Production crash logs show ink_assert(0) firing in
HttpTransact::update_size_and_time_stats from HttpSM::update_stats via
HttpSM::kill_this, triggered by an Http2Stream event re-entering the
state machine while background_fill was still in the STARTED state.
The background_fill state is normally driven to a terminal value
(COMPLETED or ABORTED) by tunnel_handler_server, but when the SM is
torn down before that handler runs the state stays STARTED and the
unreachable default branch in update_size_and_time_stats asserts. The
same path also leaks proxy.process.http.background_fill_current_count
because tunnel_handler_server is the only site that decrements the
gauge after tunnel_handler_ua incremented it.
This normalizes STARTED to ABORTED inside HttpSM::kill_this, before
the enable_http_stats gate that guards update_stats, and decrements
the gauge there. Doing the normalization in kill_this rather than in
update_stats keeps the gauge accounting balanced regardless of whether
http stats are enabled, and ensures the downstream stats helper sees a
terminal state. As a defensive backstop this also folds the STARTED
case into the ABORTED branch of update_size_and_time_stats so a future
caller that reaches this point mid-fill records the bytes against
background_fill_bytes_aborted instead of crashing the server.1 parent 450d3f3 commit 82a1557
2 files changed
Lines changed: 23 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7706 | 7706 | | |
7707 | 7707 | | |
7708 | 7708 | | |
| 7709 | + | |
| 7710 | + | |
| 7711 | + | |
| 7712 | + | |
| 7713 | + | |
| 7714 | + | |
| 7715 | + | |
| 7716 | + | |
| 7717 | + | |
| 7718 | + | |
| 7719 | + | |
| 7720 | + | |
| 7721 | + | |
| 7722 | + | |
| 7723 | + | |
| 7724 | + | |
| 7725 | + | |
7709 | 7726 | | |
7710 | 7727 | | |
7711 | 7728 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8957 | 8957 | | |
8958 | 8958 | | |
8959 | 8959 | | |
| 8960 | + | |
| 8961 | + | |
| 8962 | + | |
| 8963 | + | |
| 8964 | + | |
| 8965 | + | |
8960 | 8966 | | |
8961 | 8967 | | |
8962 | 8968 | | |
| |||
8968 | 8974 | | |
8969 | 8975 | | |
8970 | 8976 | | |
8971 | | - | |
8972 | 8977 | | |
8973 | 8978 | | |
8974 | 8979 | | |
| |||
0 commit comments