http: h2 client multiplexing fix 93/43593/1
authorMatus Fabian <[email protected]>
Wed, 20 Aug 2025 12:49:45 +0000 (08:49 -0400)
committerMatus Fabian <[email protected]>
Wed, 20 Aug 2025 12:49:45 +0000 (08:49 -0400)
do not try to cleanup ho in http_conn_established when called from
http2_conn_connect_stream_callback

Type: fix

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

index 9d458aa..7d781e4 100644 (file)
@@ -1955,7 +1955,7 @@ http1_transport_connected_callback (http_conn_t *hc)
 
   req = http1_conn_alloc_req (hc);
   http_req_state_change (req, HTTP_REQ_STATE_WAIT_APP_METHOD);
-  return http_conn_established (hc, req, hc->hc_pa_app_api_ctx);
+  return http_conn_established (hc, req, hc->hc_pa_app_api_ctx, 0);
 }
 
 static void
index 7723e54..5ecf8cc 100644 (file)
@@ -2390,7 +2390,7 @@ http2_handle_settings_frame (http_conn_t *hc, http2_frame_header_t *fh)
            &h2c->decoder_dynamic_table,
            http2_default_conn_settings.header_table_size);
          http_req_state_change (&req->base, HTTP_REQ_STATE_WAIT_APP_METHOD);
-         if (http_conn_established (hc, &req->base, hc->hc_pa_app_api_ctx))
+         if (http_conn_established (hc, &req->base, hc->hc_pa_app_api_ctx, 0))
            return HTTP2_ERROR_INTERNAL_ERROR;
        }
 
@@ -3128,7 +3128,7 @@ http2_conn_connect_stream_callback (http_conn_t *hc, u32 parent_app_api_ctx)
                                      hc->hc_pa_app_api_ctx);
   req = http2_conn_alloc_req (hc, 0);
   http_req_state_change (&req->base, HTTP_REQ_STATE_WAIT_APP_METHOD);
-  return http_conn_established (hc, &req->base, parent_app_api_ctx);
+  return http_conn_established (hc, &req->base, parent_app_api_ctx, 1);
 }
 
 static void
index 6036b5a..5b8f2c4 100644 (file)
@@ -871,7 +871,7 @@ http_conn_accept_request (http_conn_t *hc, http_req_t *req)
 
 always_inline int
 http_conn_established (http_conn_t *hc, http_req_t *req,
-                      u32 parent_app_api_ctx)
+                      u32 parent_app_api_ctx, u8 is_stream)
 {
   session_t *as;
   app_worker_t *app_wrk;
@@ -879,9 +879,12 @@ http_conn_established (http_conn_t *hc, http_req_t *req,
   http_conn_t *ho_hc;
   int rv;
 
-  ho_hc = http_ho_conn_get (hc->ho_index);
-  /* in chain with TLS there is race on half-open cleanup */
-  __atomic_fetch_or (&ho_hc->flags, HTTP_CONN_F_HO_DONE, __ATOMIC_RELEASE);
+  if (!is_stream)
+    {
+      ho_hc = http_ho_conn_get (hc->ho_index);
+      /* in chain with TLS there is race on half-open cleanup */
+      __atomic_fetch_or (&ho_hc->flags, HTTP_CONN_F_HO_DONE, __ATOMIC_RELEASE);
+    }
 
   /* allocate app session and initialize */
   as = session_alloc (hc->c_thread_index);