View | Details | Raw Unified | Return to bug 59333
Collapse All | Expand All

(-)modules/http/http_core.c (-2 / +4 lines)
Lines 148-154 static int ap_process_http_async_connection(conn_r Link Here
148
            c->keepalive = AP_CONN_UNKNOWN;
148
            c->keepalive = AP_CONN_UNKNOWN;
149
            /* process the request if it was read without error */
149
            /* process the request if it was read without error */
150
150
151
            ap_update_child_status(c->sbh, SERVER_BUSY_WRITE, r);
151
            ap_update_child_status(c->sbh, SERVER_BUSY_WRITE,
152
                                   r->the_request ? r : NULL);
152
            if (r->status == HTTP_OK) {
153
            if (r->status == HTTP_OK) {
153
                cs->state = CONN_STATE_HANDLER;
154
                cs->state = CONN_STATE_HANDLER;
154
                ap_process_async_request(r);
155
                ap_process_async_request(r);
Lines 203-209 static int ap_process_http_sync_connection(conn_re Link Here
203
        c->keepalive = AP_CONN_UNKNOWN;
204
        c->keepalive = AP_CONN_UNKNOWN;
204
        /* process the request if it was read without error */
205
        /* process the request if it was read without error */
205
206
206
        ap_update_child_status(c->sbh, SERVER_BUSY_WRITE, r);
207
        ap_update_child_status(c->sbh, SERVER_BUSY_WRITE,
208
                               r->the_request ? r : NULL);
207
        if (r->status == HTTP_OK) {
209
        if (r->status == HTTP_OK) {
208
            if (cs)
210
            if (cs)
209
                cs->state = CONN_STATE_HANDLER;
211
                cs->state = CONN_STATE_HANDLER;
(-)modules/http2/h2_conn_io.c (-1 / +1 lines)
Lines 191-197 static apr_status_t pass_out(apr_bucket_brigade *b Link Here
191
        return APR_SUCCESS;
191
        return APR_SUCCESS;
192
    }
192
    }
193
    
193
    
194
    ap_update_child_status_from_conn(c->sbh, SERVER_BUSY_WRITE, c);
194
    ap_update_child_status(c->sbh, SERVER_BUSY_WRITE, NULL);
195
    apr_brigade_length(bb, 0, &bblen);
195
    apr_brigade_length(bb, 0, &bblen);
196
    h2_conn_io_bb_log(c, 0, APLOG_TRACE2, "master conn pass", bb);
196
    h2_conn_io_bb_log(c, 0, APLOG_TRACE2, "master conn pass", bb);
197
    status = ap_pass_brigade(c->output_filters, bb);
197
    status = ap_pass_brigade(c->output_filters, bb);
(-)modules/http2/h2_task.c (-1 / +1 lines)
Lines 235-241 static apr_status_t h2_task_process_request(h2_tas Link Here
235
                  "h2_task(%s): create request_rec", task->id);
235
                  "h2_task(%s): create request_rec", task->id);
236
    r = h2_request_create_rec(req, c);
236
    r = h2_request_create_rec(req, c);
237
    if (r && (r->status == HTTP_OK)) {
237
    if (r && (r->status == HTTP_OK)) {
238
        ap_update_child_status(c->sbh, SERVER_BUSY_READ, r);
238
        ap_update_child_status(c->sbh, SERVER_BUSY_WRITE, r);
239
        
239
        
240
        if (cs) {
240
        if (cs) {
241
            cs->state = CONN_STATE_HANDLER;
241
            cs->state = CONN_STATE_HANDLER;
(-)server/core.c (-1 / +1 lines)
Lines 4841-4847 static conn_rec *core_create_conn(apr_pool_t *ptra Link Here
4841
    conn_rec *c = (conn_rec *) apr_pcalloc(ptrans, sizeof(conn_rec));
4841
    conn_rec *c = (conn_rec *) apr_pcalloc(ptrans, sizeof(conn_rec));
4842
4842
4843
    c->sbh = sbh;
4843
    c->sbh = sbh;
4844
    (void)ap_update_child_status(c->sbh, SERVER_BUSY_READ, (request_rec *)NULL);
4844
    ap_update_child_status(c->sbh, SERVER_BUSY_READ, NULL);
4845
4845
4846
    /* Got a connection structure, so initialize what fields we can
4846
    /* Got a connection structure, so initialize what fields we can
4847
     * (the rest are zeroed out by pcalloc).
4847
     * (the rest are zeroed out by pcalloc).
(-)server/mpm/event/event.c (-7 / +6 lines)
Lines 1114-1120 read_request: Link Here
1114
    if (cs->pub.state == CONN_STATE_WRITE_COMPLETION) {
1114
    if (cs->pub.state == CONN_STATE_WRITE_COMPLETION) {
1115
        ap_filter_t *output_filter = c->output_filters;
1115
        ap_filter_t *output_filter = c->output_filters;
1116
        apr_status_t rv;
1116
        apr_status_t rv;
1117
        ap_update_child_status_from_conn(sbh, SERVER_BUSY_WRITE, c);
1117
        ap_update_child_status(sbh, SERVER_BUSY_WRITE, NULL);
1118
        while (output_filter->next != NULL) {
1118
        while (output_filter->next != NULL) {
1119
            output_filter = output_filter->next;
1119
            output_filter = output_filter->next;
1120
        }
1120
        }
Lines 1910-1916 static void *APR_THREAD_FUNC worker_thread(apr_thr Link Here
1910
        }
1910
        }
1911
1911
1912
        ap_update_child_status_from_indexes(process_slot, thread_slot,
1912
        ap_update_child_status_from_indexes(process_slot, thread_slot,
1913
                                            dying ? SERVER_GRACEFUL : SERVER_READY, NULL);
1913
                                            dying ? SERVER_GRACEFUL
1914
                                                  : SERVER_READY, NULL);
1914
      worker_pop:
1915
      worker_pop:
1915
        if (workers_may_exit) {
1916
        if (workers_may_exit) {
1916
            break;
1917
            break;
Lines 1965-1973 static void *APR_THREAD_FUNC worker_thread(apr_thr Link Here
1965
    }
1966
    }
1966
1967
1967
    ap_update_child_status_from_indexes(process_slot, thread_slot,
1968
    ap_update_child_status_from_indexes(process_slot, thread_slot,
1968
                                        dying ? SERVER_DEAD :
1969
                                        dying ? SERVER_DEAD
1969
                                        SERVER_GRACEFUL,
1970
                                              : SERVER_GRACEFUL, NULL);
1970
                                        (request_rec *) NULL);
1971
1971
1972
    apr_thread_exit(thd, APR_SUCCESS);
1972
    apr_thread_exit(thd, APR_SUCCESS);
1973
    return NULL;
1973
    return NULL;
Lines 2728-2735 static void server_main_loop(int remaining_childre Link Here
2728
2728
2729
                for (i = 0; i < threads_per_child; i++)
2729
                for (i = 0; i < threads_per_child; i++)
2730
                    ap_update_child_status_from_indexes(child_slot, i,
2730
                    ap_update_child_status_from_indexes(child_slot, i,
2731
                                                        SERVER_DEAD,
2731
                                                        SERVER_DEAD, NULL);
2732
                                                        (request_rec *) NULL);
2733
2732
2734
                event_note_child_killed(child_slot, 0, 0);
2733
                event_note_child_killed(child_slot, 0, 0);
2735
                ps = &ap_scoreboard_image->parent[child_slot];
2734
                ps = &ap_scoreboard_image->parent[child_slot];
(-)server/mpm/winnt/child.c (-6 / +5 lines)
Lines 894-901 static DWORD __stdcall worker_main(void *thread_nu Link Here
894
        }
894
        }
895
    }
895
    }
896
896
897
    ap_update_child_status_from_indexes(0, thread_num, SERVER_DEAD,
897
    ap_update_child_status_from_indexes(0, thread_num, SERVER_DEAD, NULL);
898
                                        (request_rec *) NULL);
899
898
900
    return 0;
899
    return 0;
901
}
900
}
Lines 1314-1326 void child_main(apr_pool_t *pconf, DWORD parent_pi Link Here
1314
                     threads_created);
1313
                     threads_created);
1315
    }
1314
    }
1316
    for (i = 0; i < threads_created; i++) {
1315
    for (i = 0; i < threads_created; i++) {
1317
        int *score_idx;
1316
        int *idx;
1318
        TerminateThread(child_handles[i], 1);
1317
        TerminateThread(child_handles[i], 1);
1319
        CloseHandle(child_handles[i]);
1318
        CloseHandle(child_handles[i]);
1320
        /* Reset the scoreboard entry for the thread we just whacked */
1319
        /* Reset the scoreboard entry for the thread we just whacked */
1321
        score_idx = apr_hash_get(ht, &child_handles[i], sizeof(HANDLE));
1320
        idx = apr_hash_get(ht, &child_handles[i], sizeof(HANDLE));
1322
        if (score_idx) {
1321
        if (idx) {
1323
            ap_update_child_status_from_indexes(0, *score_idx, SERVER_DEAD, NULL);
1322
            ap_update_child_status_from_indexes(0, *idx, SERVER_DEAD, NULL);
1324
        }
1323
        }
1325
    }
1324
    }
1326
    ap_log_error(APLOG_MARK, APLOG_NOTICE, APR_SUCCESS, ap_server_conf, APLOGNO(00364)
1325
    ap_log_error(APLOG_MARK, APLOG_NOTICE, APR_SUCCESS, ap_server_conf, APLOGNO(00364)
(-)server/mpm/worker/worker.c (-5 / +8 lines)
Lines 928-934 static void * APR_THREAD_FUNC worker_thread(apr_th Link Here
928
    ap_scoreboard_image->servers[process_slot][thread_slot].pid = ap_my_pid;
928
    ap_scoreboard_image->servers[process_slot][thread_slot].pid = ap_my_pid;
929
    ap_scoreboard_image->servers[process_slot][thread_slot].tid = apr_os_thread_current();
929
    ap_scoreboard_image->servers[process_slot][thread_slot].tid = apr_os_thread_current();
930
    ap_scoreboard_image->servers[process_slot][thread_slot].generation = retained->my_generation;
930
    ap_scoreboard_image->servers[process_slot][thread_slot].generation = retained->my_generation;
931
    ap_update_child_status_from_indexes(process_slot, thread_slot, SERVER_STARTING, NULL);
931
    ap_update_child_status_from_indexes(process_slot, thread_slot,
932
                                        SERVER_STARTING, NULL);
932
933
933
#ifdef HAVE_PTHREAD_KILL
934
#ifdef HAVE_PTHREAD_KILL
934
    unblock_signal(WORKER_SIGNAL);
935
    unblock_signal(WORKER_SIGNAL);
Lines 949-955 static void * APR_THREAD_FUNC worker_thread(apr_th Link Here
949
            is_idle = 1;
950
            is_idle = 1;
950
        }
951
        }
951
952
952
        ap_update_child_status_from_indexes(process_slot, thread_slot, SERVER_READY, NULL);
953
        ap_update_child_status_from_indexes(process_slot, thread_slot,
954
                                            SERVER_READY, NULL);
953
worker_pop:
955
worker_pop:
954
        if (workers_may_exit) {
956
        if (workers_may_exit) {
955
            break;
957
            break;
Lines 995-1001 worker_pop: Link Here
995
    }
997
    }
996
998
997
    ap_update_child_status_from_indexes(process_slot, thread_slot,
999
    ap_update_child_status_from_indexes(process_slot, thread_slot,
998
        (dying) ? SERVER_DEAD : SERVER_GRACEFUL, (request_rec *) NULL);
1000
                                        dying ? SERVER_DEAD
1001
                                              : SERVER_GRACEFUL, NULL);
999
1002
1000
    apr_thread_exit(thd, APR_SUCCESS);
1003
    apr_thread_exit(thd, APR_SUCCESS);
1001
    return NULL;
1004
    return NULL;
Lines 1730-1737 static void server_main_loop(int remaining_childre Link Here
1730
                process_score *ps;
1733
                process_score *ps;
1731
1734
1732
                for (i = 0; i < threads_per_child; i++)
1735
                for (i = 0; i < threads_per_child; i++)
1733
                    ap_update_child_status_from_indexes(child_slot, i, SERVER_DEAD,
1736
                    ap_update_child_status_from_indexes(child_slot, i,
1734
                                                        (request_rec *) NULL);
1737
                                                        SERVER_DEAD, NULL);
1735
1738
1736
                worker_note_child_killed(child_slot, 0, 0);
1739
                worker_note_child_killed(child_slot, 0, 0);
1737
                ps = &ap_scoreboard_image->parent[child_slot];
1740
                ps = &ap_scoreboard_image->parent[child_slot];
(-)server/protocol.c (-1 / +1 lines)
Lines 992-998 request_rec *ap_read_request(conn_rec *conn) Link Here
992
            goto traceout;
992
            goto traceout;
993
        }
993
        }
994
        else if (r->status == HTTP_REQUEST_TIME_OUT) {
994
        else if (r->status == HTTP_REQUEST_TIME_OUT) {
995
            ap_update_child_status(conn->sbh, SERVER_BUSY_LOG, r);
995
            ap_update_child_status(conn->sbh, SERVER_BUSY_LOG, NULL);
996
            if (!r->connection->keepalives) {
996
            if (!r->connection->keepalives) {
997
                ap_run_log_transaction(r);
997
                ap_run_log_transaction(r);
998
            }
998
            }
(-)server/scoreboard.c (-47 / +45 lines)
Lines 464-485 static int update_child_status_internal(int child_ Link Here
464
{
464
{
465
    int old_status;
465
    int old_status;
466
    worker_score *ws;
466
    worker_score *ws;
467
    process_score *ps;
468
    int mpm_generation;
467
    int mpm_generation;
469
468
470
    ws = &ap_scoreboard_image->servers[child_num][thread_num];
469
    ws = &ap_scoreboard_image->servers[child_num][thread_num];
471
    old_status = ws->status;
470
    old_status = ws->status;
472
    if (status >= 0) {
471
    ws->status = status;
473
        ws->status = status;
472
    
474
        
473
    if (status == SERVER_READY
475
        ps = &ap_scoreboard_image->parent[child_num];
474
        && old_status == SERVER_STARTING) {
476
        
475
        process_score *ps = &ap_scoreboard_image->parent[child_num];
477
        if (status == SERVER_READY
476
        ws->thread_num = child_num * thread_limit + thread_num;
478
            && old_status == SERVER_STARTING) {
477
        ap_mpm_query(AP_MPMQ_GENERATION, &mpm_generation);
479
            ws->thread_num = child_num * thread_limit + thread_num;
478
        ps->generation = mpm_generation;
480
            ap_mpm_query(AP_MPMQ_GENERATION, &mpm_generation);
481
            ps->generation = mpm_generation;
482
        }
483
    }
479
    }
484
480
485
    if (ap_extended_status) {
481
    if (ap_extended_status) {
Lines 497-542 static int update_child_status_internal(int child_ Link Here
497
            ws->conn_bytes = 0;
493
            ws->conn_bytes = 0;
498
            ws->last_used = apr_time_now();
494
            ws->last_used = apr_time_now();
499
        }
495
        }
500
        if (status == SERVER_READY) {
496
501
            ws->client[0]='\0';
497
        if (descr) {
502
            ws->vhost[0]='\0';
498
            apr_cpystrn(ws->request, descr, sizeof(ws->request));
499
        }
500
        else if (r) {
501
            copy_request(ws->request, sizeof(ws->request), r);
502
        }
503
        else if (c) {
503
            ws->request[0]='\0';
504
            ws->request[0]='\0';
504
            ws->protocol[0]='\0';
505
        }
505
        }
506
        else {
506
507
            if (descr) {
507
        if (r && r->useragent_ip) {
508
                apr_cpystrn(ws->request, descr, sizeof(ws->request));
508
            if (!(val = ap_get_useragent_host(r, REMOTE_NOLOOKUP, NULL)))
509
                apr_cpystrn(ws->client, r->useragent_ip, sizeof(ws->client));
510
            else
511
                apr_cpystrn(ws->client, val, sizeof(ws->client));
512
        }
513
        else if (c) {
514
            if (!(val = ap_get_remote_host(c, c->base_server->lookup_defaults,
515
                                           REMOTE_NOLOOKUP, NULL)))
516
                apr_cpystrn(ws->client, c->client_ip, sizeof(ws->client));
517
            else
518
                apr_cpystrn(ws->client, val, sizeof(ws->client));
519
        }
520
521
        if (s) {
522
            if (c) {
523
                apr_snprintf(ws->vhost, sizeof(ws->vhost), "%s:%d",
524
                             s->server_hostname, c->local_addr->port);
509
            }
525
            }
510
            else if (r) {
526
            else {
511
                copy_request(ws->request, sizeof(ws->request), r);
527
                apr_cpystrn(ws->vhost, s->server_hostname, sizeof(ws->vhost));
512
            }
528
            }
513
            if (r) {
514
                if (!(val = ap_get_useragent_host(r, REMOTE_NOLOOKUP, NULL)))
515
                    apr_cpystrn(ws->client, r->useragent_ip, sizeof(ws->client));
516
                else
517
                    apr_cpystrn(ws->client, val, sizeof(ws->client));
518
            }
519
            else if (c) {
520
                if (!(val = ap_get_remote_host(c, c->base_server->lookup_defaults,
521
                                               REMOTE_NOLOOKUP, NULL)))
522
                    apr_cpystrn(ws->client, c->client_ip, sizeof(ws->client));
523
                else
524
                    apr_cpystrn(ws->client, val, sizeof(ws->client));
525
            }
526
            if (s) {
527
                if (c) {
528
                    apr_snprintf(ws->vhost, sizeof(ws->vhost), "%s:%d",
529
                                 s->server_hostname, c->local_addr->port);
530
                }
531
                else {
532
                    apr_cpystrn(ws->vhost, s->server_hostname, sizeof(ws->vhost));
533
                }
534
            }
535
            if (c) {
536
                val = ap_get_protocol(c);
537
                apr_cpystrn(ws->protocol, val, sizeof(ws->protocol));
538
            }
539
        }
529
        }
530
        else if (c) {
531
            ws->vhost[0]='\0';
532
        }
533
534
        if (c) {
535
            val = ap_get_protocol(c);
536
            apr_cpystrn(ws->protocol, val, sizeof(ws->protocol));
537
        }
540
    }
538
    }
541
539
542
    return old_status;
540
    return old_status;

Return to bug 59333