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/19 10:17:06 UTC

svn commit: r1900030 - in /httpd/httpd/trunk/modules/http2: h2_mplx.c h2_mplx.h h2_session.c h2_session.h h2_stream.c h2_stream.h mod_http2.c

Author: icing
Date: Tue Apr 19 10:17:05 2022
New Revision: 1900030

URL: http://svn.apache.org/viewvc?rev=1900030&view=rev
Log:
  *) mod_http2: use new ap_sb_get_child_thread() to get child_num
     and create unique h2 session identifiers in logging that stay
     unique among re-activations of the master connection.


Modified:
    httpd/httpd/trunk/modules/http2/h2_mplx.c
    httpd/httpd/trunk/modules/http2/h2_mplx.h
    httpd/httpd/trunk/modules/http2/h2_session.c
    httpd/httpd/trunk/modules/http2/h2_session.h
    httpd/httpd/trunk/modules/http2/h2_stream.c
    httpd/httpd/trunk/modules/http2/h2_stream.h
    httpd/httpd/trunk/modules/http2/mod_http2.c

Modified: httpd/httpd/trunk/modules/http2/h2_mplx.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_mplx.c?rev=1900030&r1=1900029&r2=1900030&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_mplx.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_mplx.c Tue Apr 19 10:17:05 2022
@@ -249,8 +249,9 @@ static void c2_transit_recycle(h2_mplx *
  *   their HTTP/1 cousins, the separate allocator seems to work better
  *   than protecting a shared h2_session one with an own lock.
  */
-h2_mplx *h2_mplx_c1_create(h2_stream *stream0, server_rec *s, apr_pool_t *parent,
-                          h2_workers *workers)
+h2_mplx *h2_mplx_c1_create(int child_num, apr_uint32_t id, h2_stream *stream0,
+                           server_rec *s, apr_pool_t *parent,
+                           h2_workers *workers)
 {
     h2_conn_ctx_t *conn_ctx;
     apr_status_t status = APR_SUCCESS;
@@ -262,7 +263,8 @@ h2_mplx *h2_mplx_c1_create(h2_stream *st
     m->stream0 = stream0;
     m->c1 = stream0->c2;
     m->s = s;
-    m->id = m->c1->id;
+    m->child_num = child_num;
+    m->id = id;
 
     /* We create a pool with its own allocator to be used for
      * processing secondary connections. This is the only way to have the
@@ -434,7 +436,7 @@ void h2_mplx_c1_destroy(h2_mplx *m)
     int i, wait_secs = 60, old_aborted;
 
     ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, m->c1,
-                  "h2_mplx(%ld): start release", m->id);
+                  H2_MPLX_MSG(m, "start release"));
     /* How to shut down a h2 connection:
      * 0. abort and tell the workers that no more work will come from us */
     m->aborted = 1;
@@ -451,8 +453,8 @@ void h2_mplx_c1_destroy(h2_mplx *m)
     /* How to shut down a h2 connection:
      * 1. cancel all streams still active */
     ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, m->c1,
-                  "h2_mplx(%ld): release, %d/%d/%d streams (total/hold/purge), %d streams",
-                  m->id, (int)h2_ihash_count(m->streams),
+                  H2_MPLX_MSG(m, "release, %d/%d/%d streams (total/hold/purge), %d streams"),
+                  (int)h2_ihash_count(m->streams),
                   (int)h2_ihash_count(m->shold), m->spurge->nelts, m->processing_count);
     while (!h2_ihash_iter(m->streams, m_stream_cancel_iter, m)) {
         /* until empty */
@@ -477,8 +479,8 @@ void h2_mplx_c1_destroy(h2_mplx *m)
             /* This can happen if we have very long running requests
              * that do not time out on IO. */
             ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, m->c1, APLOGNO(03198)
-                          "h2_mplx(%ld): waited %d sec for %d streams",
-                          m->id, i*wait_secs, (int)h2_ihash_count(m->shold));
+                          H2_MPLX_MSG(m, "waited %d sec for %d streams"),
+                          i*wait_secs, (int)h2_ihash_count(m->shold));
             h2_ihash_iter(m->shold, m_report_stream_iter, m);
         }
     }
@@ -487,15 +489,16 @@ void h2_mplx_c1_destroy(h2_mplx *m)
     ap_assert(m->processing_count == 0);
     if (!h2_ihash_empty(m->shold)) {
         ap_log_cerror(APLOG_MARK, APLOG_WARNING, 0, m->c1, APLOGNO(03516)
-                      "h2_mplx(%ld): unexpected %d streams in hold", 
-                      m->id, (int)h2_ihash_count(m->shold));
+                      H2_MPLX_MSG(m, "unexpected %d streams in hold"),
+                      (int)h2_ihash_count(m->shold));
         h2_ihash_iter(m->shold, m_unexpected_stream_iter, m);
     }
     
     m->c1->aborted = old_aborted;
     H2_MPLX_LEAVE(m);
 
-    ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, m->c1, "h2_mplx(%ld): released", m->id);
+    ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, m->c1,
+                  H2_MPLX_MSG(m, "released"));
 }
 
 apr_status_t h2_mplx_c1_stream_cleanup(h2_mplx *m, h2_stream *stream,
@@ -607,7 +610,7 @@ apr_status_t h2_mplx_c1_reprioritize(h2_
     else {
         h2_iq_sort(m->q, cmp, session);
         ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, m->c1,
-                      "h2_mplx(%ld): reprioritize streams", m->id);
+                      H2_MPLX_MSG(m, "reprioritize streams"));
         status = APR_SUCCESS;
     }
 
@@ -680,7 +683,7 @@ void h2_mplx_c1_process(h2_mplx *m,
         }
         else {
             ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, m->c1,
-                          "h2_stream(%ld-%d): not found to process", m->id, sid);
+                          H2_MPLX_MSG(m, "stream %d not found to process"), sid);
         }
     }
     if (!m->is_registered && !h2_iq_empty(m->q)) {
@@ -691,7 +694,7 @@ void h2_mplx_c1_process(h2_mplx *m,
         if (rv != APR_SUCCESS) {
             m->is_registered = 0;
             ap_log_cerror(APLOG_MARK, APLOG_ERR, rv, m->c1, APLOGNO(10021)
-                          "h2_mplx(%ld): register at workers", m->id);
+                          H2_MPLX_MSG(m, "register at workers"));
         }
     }
     *pstream_count = (int)h2_ihash_count(m->streams);
@@ -706,8 +709,8 @@ void h2_mplx_c1_process(h2_mplx *m,
         mem_w = apr_pool_num_bytes(m->workers->pool, 1);
         mem_c1 = apr_pool_num_bytes(m->c1->pool, 1);
         ap_log_cerror(APLOG_MARK, APLOG_INFO, 0, m->c1,
-                      "h2_mplx(%ld): child mem=%ld, mplx mem=%ld, session mem=%ld, workers=%ld, c1=%ld",
-                      m->id, (long)mem_g, (long)mem_m, (long)mem_s, (long)mem_w, (long)mem_c1);
+                      H2_MPLX_MSG(m, "child mem=%ld, mplx mem=%ld, session mem=%ld, workers=%ld, c1=%ld"),
+                      (long)mem_g, (long)mem_m, (long)mem_s, (long)mem_w, (long)mem_c1);
 
     } while (0);
 #endif
@@ -819,9 +822,9 @@ static conn_rec *s_next_c2(h2_mplx *m)
     if (!stream) {
         if (m->processing_count >= m->processing_limit && !h2_iq_empty(m->q)) {
             ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, m->c1,
-                          "h2_session(%ld): delaying request processing. "
-                          "Current limit is %d and %d workers are in use.",
-                          m->id, m->processing_limit, m->processing_count);
+                          H2_MPLX_MSG(m, "delaying request processing. "
+                          "Current limit is %d and %d workers are in use."),
+                          m->processing_limit, m->processing_count);
         }
         goto cleanup;
     }
@@ -986,8 +989,8 @@ static void s_mplx_be_happy(h2_mplx *m,
             m->last_mood_change = now;
             m->irritations_since = 0;
             ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, c,
-                          "h2_mplx(%ld): mood update, increasing worker limit to %d",
-                          m->id, m->processing_limit);
+                          H2_MPLX_MSG(m, "mood update, increasing worker limit to %d"),
+                          m->processing_limit);
         }
     }
 }
@@ -1016,8 +1019,8 @@ static void m_be_annoyed(h2_mplx *m)
             m->last_mood_change = now;
             m->irritations_since = 0;
             ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, m->c1,
-                          "h2_mplx(%ld): mood update, decreasing worker limit to %d",
-                          m->id, m->processing_limit);
+                          H2_MPLX_MSG(m, "mood update, decreasing worker limit to %d"),
+                          m->processing_limit);
         }
     }
 }
@@ -1110,8 +1113,8 @@ static apr_status_t mplx_pollset_poll(h2
     m->polling = 1;
     do {
         ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, m->c1,
-                      "h2_mplx(%ld): enter polling timeout=%d",
-                      m->id, (int)apr_time_sec(timeout));
+                      H2_MPLX_MSG(m, "enter polling timeout=%d"),
+                      (int)apr_time_sec(timeout));
 
         apr_array_clear(m->streams_ev_in);
         apr_array_clear(m->streams_ev_out);
@@ -1149,12 +1152,11 @@ static apr_status_t mplx_pollset_poll(h2
         if (APR_SUCCESS != rv) {
             if (APR_STATUS_IS_TIMEUP(rv)) {
                 ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, m->c1,
-                              "h2_mplx(%ld): polling timed out ",
-                              m->id);
+                              H2_MPLX_MSG(m, "polling timed out "));
             }
             else {
                 ap_log_cerror(APLOG_MARK, APLOG_ERR, rv, m->c1, APLOGNO(10310)
-                              "h2_mplx(%ld): polling failed", m->id);
+                              H2_MPLX_MSG(m, "polling failed"));
             }
             goto cleanup;
         }

Modified: httpd/httpd/trunk/modules/http2/h2_mplx.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_mplx.h?rev=1900030&r1=1900029&r2=1900030&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_mplx.h (original)
+++ httpd/httpd/trunk/modules/http2/h2_mplx.h Tue Apr 19 10:17:05 2022
@@ -54,7 +54,8 @@ struct h2_c2_transit {
 typedef struct h2_mplx h2_mplx;
 
 struct h2_mplx {
-    long id;
+    int child_num;                  /* child this runs in */
+    apr_uint32_t id;                /* id unique per child */
     conn_rec *c1;                   /* the main connection */
     apr_pool_t *pool;
     struct h2_stream *stream0;      /* HTTP/2's stream 0 */
@@ -107,7 +108,9 @@ apr_status_t h2_mplx_c1_child_init(apr_p
  * Create the multiplexer for the given HTTP2 session. 
  * Implicitly has reference count 1.
  */
-h2_mplx *h2_mplx_c1_create(struct h2_stream *stream0, server_rec *s, apr_pool_t *master,
+h2_mplx *h2_mplx_c1_create(int child_id, apr_uint32_t id,
+                           struct h2_stream *stream0,
+                           server_rec *s, apr_pool_t *master,
                            struct h2_workers *workers);
 
 /**
@@ -221,4 +224,7 @@ apr_status_t h2_mplx_worker_pop_c2(h2_mp
  */
 void h2_mplx_worker_c2_done(conn_rec *c2);
 
+#define H2_MPLX_MSG(m, msg)     \
+    "h2_mplx(%d-%lu): "msg, m->child_num, (unsigned long)m->id
+
 #endif /* defined(__mod_h2__h2_mplx__) */

Modified: httpd/httpd/trunk/modules/http2/h2_session.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_session.c?rev=1900030&r1=1900029&r2=1900030&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_session.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_session.c Tue Apr 19 10:17:05 2022
@@ -17,6 +17,7 @@
 #include <assert.h>
 #include <stddef.h>
 #include <apr_thread_cond.h>
+#include <apr_atomic.h>
 #include <apr_base64.h>
 #include <apr_strings.h>
 
@@ -235,14 +236,14 @@ static int on_data_chunk_recv_cb(nghttp2
     stream = get_stream(session, stream_id);
     if (stream) {
         ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, session->c1,
-                      "h2_stream(%ld-%d): write %ld bytes of DATA",
-                      session->id, (int)stream_id, (long)len);
+                      H2_SSSN_STRM_MSG(session, stream_id, "write %ld bytes of DATA"),
+                      (long)len);
         status = h2_stream_recv_DATA(stream, flags, data, len);
     }
     else {
         ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c1, APLOGNO(03064)
-                      "h2_stream(%ld-%d): on_data_chunk for unknown stream",
-                      session->id, (int)stream_id);
+                      H2_SSSN_STRM_MSG(session, stream_id,
+                      "on_data_chunk for unknown stream"));
         rv = NGHTTP2_ERR_CALLBACK_FAILURE;
     }
     
@@ -306,8 +307,8 @@ static int on_header_cb(nghttp2_session
     stream = get_stream(session, frame->hd.stream_id);
     if (!stream) {
         ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c1, APLOGNO(02920)
-                      "h2_stream(%ld-%d): on_header unknown stream",
-                      session->id, (int)frame->hd.stream_id);
+                      H2_SSSN_STRM_MSG(session, frame->hd.stream_id,
+                      "on_header unknown stream"));
         return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE;
     }
     
@@ -379,23 +380,22 @@ static int on_frame_recv_cb(nghttp2_sess
         case NGHTTP2_PRIORITY:
             session->reprioritize = 1;
             ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, session->c1,
-                          "h2_stream(%ld-%d): PRIORITY frame "
-                          " weight=%d, dependsOn=%d, exclusive=%d", 
-                          session->id, (int)frame->hd.stream_id,
+                          H2_SSSN_STRM_MSG(session, frame->hd.stream_id, "PRIORITY frame "
+                          " weight=%d, dependsOn=%d, exclusive=%d"),
                           frame->priority.pri_spec.weight,
                           frame->priority.pri_spec.stream_id,
                           frame->priority.pri_spec.exclusive);
             break;
         case NGHTTP2_WINDOW_UPDATE:
             ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, session->c1,
-                          "h2_stream(%ld-%d): WINDOW_UPDATE incr=%d", 
-                          session->id, (int)frame->hd.stream_id,
+                          H2_SSSN_STRM_MSG(session, frame->hd.stream_id,
+                          "WINDOW_UPDATE incr=%d"),
                           frame->window_update.window_size_increment);
             break;
         case NGHTTP2_RST_STREAM:
             ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c1, APLOGNO(03067)
-                          "h2_stream(%ld-%d): RST_STREAM by client, error=%d",
-                          session->id, (int)frame->hd.stream_id,
+                          H2_SSSN_STRM_MSG(session, frame->hd.stream_id,
+                          "RST_STREAM by client, error=%d"),
                           (int)frame->rst_stream.error_code);
             if (stream && stream->initiated_on) {
                 /* A stream reset on a request we sent it. Normal, when the
@@ -499,8 +499,7 @@ static int on_send_data_cb(nghttp2_sessi
     if (!stream) {
         ap_log_cerror(APLOG_MARK, APLOG_ERR, APR_NOTFOUND, session->c1,
                       APLOGNO(02924) 
-                      "h2_stream(%ld-%d): send_data, stream not found",
-                      session->id, (int)stream_id);
+                      H2_SSSN_STRM_MSG(session, stream_id, "send_data, stream not found"));
         return NGHTTP2_ERR_CALLBACK_FAILURE;
     }
     
@@ -613,8 +612,8 @@ static int on_invalid_header_cb(nghttp2_
     h2_stream *stream;
     
     ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c1, APLOGNO(03456)
-                  "h2_stream(%ld-%d): invalid header '%s: %s'",
-                  session->id, (int)frame->hd.stream_id,
+                  H2_SSSN_STRM_MSG(session, frame->hd.stream_id,
+                  "invalid header '%s: %s'"),
                   apr_pstrndup(session->pool, (const char *)name, namelen),
                   apr_pstrndup(session->pool, (const char *)value, valuelen));
     stream = get_stream(session, frame->hd.stream_id);
@@ -844,12 +843,15 @@ static apr_status_t session_pool_cleanup
     return APR_SUCCESS;
 }
 
+static /* atomic */ apr_uint32_t next_id;
+
 apr_status_t h2_session_create(h2_session **psession, conn_rec *c, request_rec *r,
                                server_rec *s, h2_workers *workers)
 {
     nghttp2_session_callbacks *callbacks = NULL;
     nghttp2_option *options = NULL;
     uint32_t n;
+    int thread_num;
     apr_pool_t *pool = NULL;
     h2_session *session;
     h2_stream *stream0;
@@ -865,7 +867,16 @@ apr_status_t h2_session_create(h2_sessio
     }
     
     *psession = session;
-    session->id = c->id;
+    /* c->id does not give a unique id for the lifetime of the session.
+     * mpms like event change c->id when re-activating a keepalive
+     * connection based on the child_num+thread_num of the worker
+     * processing it.
+     * We'd like to have an id that remains constant and unique bc
+     * h2 streams can live through keepalive periods. While double id
+     * will not lead to processing failures, it will confuse log analysis.
+     */
+    ap_sb_get_child_thread(c->sbh, &session->child_num, &thread_num);
+    session->id = apr_atomic_inc32(&next_id);
     session->c1 = c;
     session->r = r;
     session->s = s;
@@ -890,7 +901,8 @@ apr_status_t h2_session_create(h2_sessio
 
     stream0 = h2_stream_create(0, session->pool, session, NULL, 0);
     stream0->c2 = session->c1;  /* stream0's connection is the main connection */
-    session->mplx = h2_mplx_c1_create(stream0, s, session->pool, workers);
+    session->mplx = h2_mplx_c1_create(session->child_num, session->id,
+                                      stream0, s, session->pool, workers);
     if (!session->mplx) {
         apr_pool_destroy(pool);
         return APR_ENOTIMPL;
@@ -1182,9 +1194,9 @@ apr_status_t h2_session_set_prio(h2_sess
                 rv = nghttp2_session_change_stream_priority(session->ngh2, id_parent, &ps);
                 if (rv < 0) {
                     ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c1, APLOGNO(03202)
-                                  "h2_stream(%ld-%d): PUSH BEFORE, weight=%d, "
-                                  "depends=%d, returned=%d",
-                                  session->id, id_parent, ps.weight, ps.stream_id, rv);
+                                  H2_SSSN_STRM_MSG(session, id_parent,
+                                  "PUSH BEFORE, weight=%d, depends=%d, returned=%d"),
+                                  ps.weight, ps.stream_id, rv);
                     return APR_EGENERAL;
                 }
                 nghttp2_priority_spec_init(&ps, id_grandpa, w, 0);

Modified: httpd/httpd/trunk/modules/http2/h2_session.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_session.h?rev=1900030&r1=1900029&r2=1900030&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_session.h (original)
+++ httpd/httpd/trunk/modules/http2/h2_session.h Tue Apr 19 10:17:05 2022
@@ -62,8 +62,8 @@ typedef enum {
 } h2_session_event_t;
 
 typedef struct h2_session {
-    long id;                        /* identifier of this session, unique
-                                     * inside a httpd process */
+    int child_num;                  /* child number this session runs in */
+    apr_uint32_t id;                /* identifier of this session, unique per child */
     conn_rec *c1;                   /* the main connection this session serves */
     request_rec *r;                 /* the request that started this in case
                                      * of 'h2c', NULL otherwise */
@@ -193,9 +193,13 @@ void h2_session_dispatch_event(h2_sessio
 
 
 #define H2_SSSN_MSG(s, msg)     \
-    "h2_session(%ld,%s,%d): "msg, s->id, h2_session_state_str(s->state), \
+    "h2_session(%d-%lu,%s,%d): "msg, s->child_num, (unsigned long)s->id, \
+                            h2_session_state_str(s->state), \
                             s->open_streams
 
 #define H2_SSSN_LOG(aplogno, s, msg)    aplogno H2_SSSN_MSG(s, msg)
 
+#define H2_SSSN_STRM_MSG(s, stream_id, msg)     \
+    "h2_stream(%d-%lu-%d): "msg, s->child_num, (unsigned long)s->id, stream_id
+
 #endif /* defined(__mod_h2__h2_session__) */

Modified: httpd/httpd/trunk/modules/http2/h2_stream.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_stream.c?rev=1900030&r1=1900029&r2=1900030&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_stream.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_stream.c Tue Apr 19 10:17:05 2022
@@ -1303,9 +1303,8 @@ apr_status_t h2_stream_in_consumed(h2_st
                         NGHTTP2_FLAG_NONE, stream->id, win);
             } 
             ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, session->c1,
-                          "h2_stream(%ld-%d): consumed %ld bytes, window now %d/%d",
-                          session->id, stream->id, (long)amount, 
-                          cur_size, stream->in_window_size);
+                          H2_STRM_MSG(stream, "consumed %ld bytes, window now %d/%d"),
+                          (long)amount, cur_size, stream->in_window_size);
         }
 #endif /* #ifdef H2_NG2_LOCAL_WIN_SIZE */
     }
@@ -1372,15 +1371,13 @@ static ssize_t stream_data_cb(nghttp2_se
     if (!stream || !stream->output) {
         ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, c1,
                       APLOGNO(02937)
-                      "h2_stream(%ld-%d): data_cb, stream not found",
-                      session->id, (int)stream_id);
+                      H2_SSSN_STRM_MSG(session, stream_id, "data_cb, stream not found"));
         return NGHTTP2_ERR_CALLBACK_FAILURE;
     }
     if (!stream->response) {
         ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, c1,
                       APLOGNO(10299)
-                      "h2_stream(%ld-%d): data_cb, no response seen yet",
-                      session->id, (int)stream_id);
+                      H2_SSSN_STRM_MSG(session, stream_id, "data_cb, no response seen yet"));
         return NGHTTP2_ERR_DEFERRED;
     }
     if (stream->rst_error) {
@@ -1388,14 +1385,12 @@ static ssize_t stream_data_cb(nghttp2_se
     }
     if (!stream->out_buffer) {
         ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, c1,
-                      "h2_stream(%ld-%d): suspending",
-                      session->id, (int)stream_id);
+                      H2_SSSN_STRM_MSG(session, stream_id, "suspending"));
         return NGHTTP2_ERR_DEFERRED;
     }
     if (h2_c1_io_needs_flush(&session->io)) {
         ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, c1,
-                      "h2_stream(%ld-%d): suspending on c1 out needs flush",
-                      session->id, (int)stream_id);
+                      H2_SSSN_STRM_MSG(session, stream_id, "suspending on c1 out needs flush"));
         h2_stream_dispatch(stream, H2_SEV_OUT_C1_BLOCK);
         return NGHTTP2_ERR_DEFERRED;
     }
@@ -1415,8 +1410,9 @@ static ssize_t stream_data_cb(nghttp2_se
     if (buf_len < length && !eos) {
         /* read more? */
         ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, c1,
-                      "h2_stream(%ld-%d): need more (read len=%ld, %ld in buffer)",
-                      session->id, (int)stream_id, (long)length, (long)buf_len);
+                      H2_SSSN_STRM_MSG(session, stream_id,
+                      "need more (read len=%ld, %ld in buffer)"),
+                      (long)length, (long)buf_len);
         rv = buffer_output_receive(stream);
         /* process all headers sitting at the buffer head. */
         while (APR_SUCCESS == rv && !eos && !stream->sent_trailers) {
@@ -1460,8 +1456,7 @@ static ssize_t stream_data_cb(nghttp2_se
         ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, c1,
                       H2_STRM_LOG(APLOGNO(03071), stream, "data_cb, suspending"));
         ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, c1,
-                      "h2_stream(%ld-%d): suspending",
-                      session->id, (int)stream_id);
+                      H2_SSSN_STRM_MSG(session, stream_id, "suspending"));
         return NGHTTP2_ERR_DEFERRED;
     }
 
@@ -1521,8 +1516,7 @@ apr_status_t h2_stream_read_output(h2_st
 
     nghttp2_session_resume_data(stream->session->ngh2, stream->id);
     ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, c1,
-                  "h2_stream(%ld-%d): resumed",
-                  stream->session->id, (int)stream->id);
+                  H2_STRM_MSG(stream, "resumed"));
 
 cleanup:
     return rv;

Modified: httpd/httpd/trunk/modules/http2/h2_stream.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_stream.h?rev=1900030&r1=1900029&r2=1900030&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_stream.h (original)
+++ httpd/httpd/trunk/modules/http2/h2_stream.h Tue Apr 19 10:17:05 2022
@@ -285,7 +285,8 @@ const char *h2_stream_state_str(const h2
 int h2_stream_is_ready(h2_stream *stream);
 
 #define H2_STRM_MSG(s, msg)     \
-    "h2_stream(%ld-%d,%s): "msg, s->session->id, s->id, h2_stream_state_str(s)
+    "h2_stream(%d-%lu-%d,%s): "msg, s->session->child_num, \
+    (unsigned long)s->session->id, s->id, h2_stream_state_str(s)
 
 #define H2_STRM_LOG(aplogno, s, msg)    aplogno H2_STRM_MSG(s, msg)
 

Modified: httpd/httpd/trunk/modules/http2/mod_http2.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/mod_http2.c?rev=1900030&r1=1900029&r2=1900030&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/mod_http2.c (original)
+++ httpd/httpd/trunk/modules/http2/mod_http2.c Tue Apr 19 10:17:05 2022
@@ -158,25 +158,8 @@ static void http2_get_num_workers(server
  */
 static void h2_child_init(apr_pool_t *pchild, server_rec *s)
 {
-    apr_allocator_t *allocator;
-    apr_thread_mutex_t *mutex;
     apr_status_t rv;
 
-    /* The allocator of pchild has no mutex with MPM prefork, but we need one
-     * for h2 workers threads synchronization. Even though mod_http2 shouldn't
-     * be used with prefork, better be safe than sorry, so forcibly set the
-     * mutex here. For MPM event/worker, pchild has no allocator so pconf's
-     * is used, with its mutex.
-     */
-    allocator = apr_pool_allocator_get(pchild);
-    if (allocator) {
-        mutex = apr_allocator_mutex_get(allocator);
-        if (!mutex) {
-            apr_thread_mutex_create(&mutex, APR_THREAD_MUTEX_DEFAULT, pchild);
-            apr_allocator_mutex_set(allocator, mutex);
-        }
-    }
-
     /* Set up our connection processing */
     rv = h2_c1_child_init(pchild, s);
     if (APR_SUCCESS == rv) {