You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ic...@apache.org on 2022/04/21 11:21:50 UTC

svn commit: r1900104 - /httpd/httpd/trunk/modules/http2/h2_workers.c

Author: icing
Date: Thu Apr 21 11:21:50 2022
New Revision: 1900104

URL: http://svn.apache.org/viewvc?rev=1900104&view=rev
Log:
  *) mod_http2: clear the h2 worker slot connection early to avoid
     any race in slot updates after the connection has been handled.


Modified:
    httpd/httpd/trunk/modules/http2/h2_workers.c

Modified: httpd/httpd/trunk/modules/http2/h2_workers.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_workers.c?rev=1900104&r1=1900103&r2=1900104&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_workers.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_workers.c Thu Apr 21 11:21:50 2022
@@ -254,6 +254,7 @@ static void slot_done(h2_slot *slot)
 static void* APR_THREAD_FUNC slot_run(apr_thread_t *thread, void *wctx)
 {
     h2_slot *slot = wctx;
+    conn_rec *c;
     
     /* Get the next c2 from mplx to process. */
     while (get_next(slot)) {
@@ -287,13 +288,14 @@ static void* APR_THREAD_FUNC slot_run(ap
          * configurations by mod_h2 alone.
          */
         AP_DEBUG_ASSERT(slot->connection != NULL);
-        slot->connection->id = (slot->connection->master->id << 8)^slot->id;
-        slot->connection->current_thread = thread;
+        c = slot->connection;
+        slot->connection = NULL;
+        c->id = (c->master->id << 8)^slot->id;
+        c->current_thread = thread;
 
-        ap_process_connection(slot->connection, ap_get_conn_socket(slot->connection));
+        ap_process_connection(c, ap_get_conn_socket(c));
 
-        h2_mplx_worker_c2_done(slot->connection);
-        slot->connection = NULL;
+        h2_mplx_worker_c2_done(c);
     }
 
     if (apr_atomic_read32(&slot->timed_out) == 0) {