http: remove assert in http2_req_state_tunnel_tx 29/43629/3
authorMatus Fabian <[email protected]>
Sun, 24 Aug 2025 16:01:19 +0000 (12:01 -0400)
committerFlorin Coras <[email protected]>
Mon, 25 Aug 2025 10:36:19 +0000 (10:36 +0000)
proxy app can send new payload before we were able to send previous

Type: fix

Change-Id: I7d0c2605da38e7495e3e26705f58a5370d1e296f
Signed-off-by: Matus Fabian <[email protected]>
src/plugins/http/http.c
src/plugins/http/http2/http2.c
src/plugins/http/http_private.h

index 7341bdf..7bfe5ea 100644 (file)
@@ -570,8 +570,8 @@ http_ts_connected_callback (u32 http_app_index, u32 ho_hc_index, session_t *ts,
   hc_handle.conn_index = new_hc_index;
   ts->opaque = hc_handle.as_u32;
 
-  HTTP_DBG (1, "half-open hc index %x,  hc [%u]%x", ho_hc_index,
-           ts->thread_index, new_hc_index);
+  HTTP_DBG (1, "half-open hc index %x,  hc [%u]%x", ts->thread_index,
+           ho_hc_index, new_hc_index);
 
   if ((rv = http_vfts[hc->version].transport_connected_callback (hc)))
     {
@@ -1257,7 +1257,7 @@ http_app_tx_callback (void *session, transport_send_params_t *sp)
 
   hc_index = http_vfts[hr_handle.version].hc_index_get_by_req_index (
     hr_handle.req_index, as->thread_index);
-  HTTP_DBG (1, "hc [%u]%x", hc_index, as->connection_index);
+  HTTP_DBG (1, "hc [%u]%x", as->thread_index, hc_index);
 
   hc = http_conn_get_w_thread (hc_index, as->thread_index);
 
@@ -1289,7 +1289,7 @@ http_app_rx_evt_cb (transport_connection_t *tc)
   http_conn_t *hc;
   http_req_handle_t hr_handle;
 
-  HTTP_DBG (1, "hc [%u]%x", vlib_get_thread_index (), req->hr_hc_index);
+  HTTP_DBG (1, "hc [%u]%x", req->c_thread_index, req->hr_hc_index);
 
   hr_handle.as_u32 = req->hr_req_handle;
   hc = http_conn_get_w_thread (req->hr_hc_index, req->c_thread_index);
index 5ecf8cc..5b3b853 100644 (file)
@@ -1867,10 +1867,17 @@ http2_req_state_tunnel_tx (http_conn_t *hc, http2_req_t *req,
 {
   http2_conn_ctx_t *h2c;
 
-  ASSERT (!clib_llist_elt_is_linked (req, sched_list));
-
   HTTP_DBG (1, "tunnel received data from app");
 
+  /* zero-copy proxy app can program new tx event before we were able to send
+   * previous payload, because fifos are shared, UDP/TCP clears evt on rx and
+   * proxy app program new tx evt for http */
+  if (clib_llist_elt_is_linked (req, sched_list))
+    {
+      http_req_deschedule (&req->base, sp);
+      return HTTP_SM_STOP;
+    }
+
   /* add data back to stream scheduler */
   HTTP_DBG (1, "adding to data queue req_index %x",
            ((http_req_handle_t) req->base.hr_req_handle).req_index);
index 5b8f2c4..1c90671 100644 (file)
@@ -828,7 +828,7 @@ http_conn_accept_request (http_conn_t *hc, http_req_t *req)
   app_worker_t *app_wrk;
   int rv;
 
-  HTTP_DBG (1, "hc [%u]%x req %x", hc->hc_hc_index, hc->c_thread_index,
+  HTTP_DBG (1, "hc [%u]%x req %x", hc->c_thread_index, hc->hc_hc_index,
            req->hr_req_handle);
 
   /* allocate app session and initialize */