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

(-)native/common/jk_ajp_common.c-orig (-120 / +150 lines)
Lines 445-451 Link Here
445
        jk_b_append_int(msg, (unsigned short)(s->num_headers))) {
445
        jk_b_append_int(msg, (unsigned short)(s->num_headers))) {
446
446
447
        jk_log(l, JK_LOG_ERROR,
447
        jk_log(l, JK_LOG_ERROR,
448
               "failed appending the message begining");
448
               "(%s) failed appending the message begining", ae->worker->name);
449
        JK_TRACE_EXIT(l);
449
        JK_TRACE_EXIT(l);
450
        return JK_FALSE;
450
        return JK_FALSE;
451
    }
451
    }
Lines 456-462 Link Here
456
        if ((sc = sc_for_req_header(s->headers_names[i])) != UNKNOWN_METHOD) {
456
        if ((sc = sc_for_req_header(s->headers_names[i])) != UNKNOWN_METHOD) {
457
            if (jk_b_append_int(msg, (unsigned short)sc)) {
457
            if (jk_b_append_int(msg, (unsigned short)sc)) {
458
                jk_log(l, JK_LOG_ERROR,
458
                jk_log(l, JK_LOG_ERROR,
459
                       "failed appending the header code for '%s'", s->headers_names[i]);
459
                       "(%s) failed appending the header code for '%s'",
460
			ae->worker->name, s->headers_names[i]);
460
                JK_TRACE_EXIT(l);
461
                JK_TRACE_EXIT(l);
461
                return JK_FALSE;
462
                return JK_FALSE;
462
            }
463
            }
Lines 464-470 Link Here
464
        else {
465
        else {
465
            if (jk_b_append_string(msg, s->headers_names[i])) {
466
            if (jk_b_append_string(msg, s->headers_names[i])) {
466
                jk_log(l, JK_LOG_ERROR,
467
                jk_log(l, JK_LOG_ERROR,
467
                       "failed appending the header name '%s'", s->headers_names[i]);
468
                       "(%s) failed appending the header name '%s'",
469
			ae->worker->name, s->headers_names[i]);
468
                JK_TRACE_EXIT(l);
470
                JK_TRACE_EXIT(l);
469
                return JK_FALSE;
471
                return JK_FALSE;
470
            }
472
            }
Lines 472-479 Link Here
472
474
473
        if (jk_b_append_string(msg, s->headers_values[i])) {
475
        if (jk_b_append_string(msg, s->headers_values[i])) {
474
            jk_log(l, JK_LOG_ERROR,
476
            jk_log(l, JK_LOG_ERROR,
475
                   "failed appending the header value for header '%s' of length %u",
477
                   "(%s) failed appending the header value for header '%s' of length %u",
476
                   s->headers_names[i], strlen(s->headers_names[i]));
478
                   ae->worker->name, s->headers_names[i], strlen(s->headers_names[i]));
477
            JK_TRACE_EXIT(l);
479
            JK_TRACE_EXIT(l);
478
            return JK_FALSE;
480
            return JK_FALSE;
479
        }
481
        }
Lines 483-489 Link Here
483
        if (jk_b_append_byte(msg, SC_A_SECRET) ||
485
        if (jk_b_append_byte(msg, SC_A_SECRET) ||
484
            jk_b_append_string(msg, s->secret)) {
486
            jk_b_append_string(msg, s->secret)) {
485
            jk_log(l, JK_LOG_ERROR,
487
            jk_log(l, JK_LOG_ERROR,
486
                   "failed appending secret");
488
                   "(%s) failed appending secret", ae->worker->name);
487
            JK_TRACE_EXIT(l);
489
            JK_TRACE_EXIT(l);
488
            return JK_FALSE;
490
            return JK_FALSE;
489
        }
491
        }
Lines 493-499 Link Here
493
        if (jk_b_append_byte(msg, SC_A_REMOTE_USER) ||
495
        if (jk_b_append_byte(msg, SC_A_REMOTE_USER) ||
494
            jk_b_append_string(msg, s->remote_user)) {
496
            jk_b_append_string(msg, s->remote_user)) {
495
            jk_log(l, JK_LOG_ERROR,
497
            jk_log(l, JK_LOG_ERROR,
496
                   "failed appending the remote user");
498
                   "(%s) failed appending the remote user", ae->worker->name);
497
            JK_TRACE_EXIT(l);
499
            JK_TRACE_EXIT(l);
498
            return JK_FALSE;
500
            return JK_FALSE;
499
        }
501
        }
Lines 502-508 Link Here
502
        if (jk_b_append_byte(msg, SC_A_AUTH_TYPE) ||
504
        if (jk_b_append_byte(msg, SC_A_AUTH_TYPE) ||
503
            jk_b_append_string(msg, s->auth_type)) {
505
            jk_b_append_string(msg, s->auth_type)) {
504
            jk_log(l, JK_LOG_ERROR,
506
            jk_log(l, JK_LOG_ERROR,
505
                   "failed appending the auth type");
507
                   "(%s) failed appending the auth type", ae->worker->name);
506
            JK_TRACE_EXIT(l);
508
            JK_TRACE_EXIT(l);
507
            return JK_FALSE;
509
            return JK_FALSE;
508
        }
510
        }
Lines 515-522 Link Here
515
            jk_b_append_string(msg, s->query_string)) {
517
            jk_b_append_string(msg, s->query_string)) {
516
#endif
518
#endif
517
            jk_log(l, JK_LOG_ERROR,
519
            jk_log(l, JK_LOG_ERROR,
518
                   "failed appending the query string of length %u",
520
                   "(%s) failed appending the query string of length %u",
519
                   strlen(s->query_string));
521
                   ae->worker->name, strlen(s->query_string));
520
            JK_TRACE_EXIT(l);
522
            JK_TRACE_EXIT(l);
521
            return JK_FALSE;
523
            return JK_FALSE;
522
        }
524
        }
Lines 525-531 Link Here
525
        if (jk_b_append_byte(msg, SC_A_ROUTE) ||
527
        if (jk_b_append_byte(msg, SC_A_ROUTE) ||
526
            jk_b_append_string(msg, s->route)) {
528
            jk_b_append_string(msg, s->route)) {
527
            jk_log(l, JK_LOG_ERROR,
529
            jk_log(l, JK_LOG_ERROR,
528
                   "failed appending the route");
530
                   "(%s) failed appending the route", ae->worker->name);
529
            JK_TRACE_EXIT(l);
531
            JK_TRACE_EXIT(l);
530
            return JK_FALSE;
532
            return JK_FALSE;
531
        }
533
        }
Lines 534-540 Link Here
534
        if (jk_b_append_byte(msg, SC_A_SSL_CERT) ||
536
        if (jk_b_append_byte(msg, SC_A_SSL_CERT) ||
535
            jk_b_append_string(msg, s->ssl_cert)) {
537
            jk_b_append_string(msg, s->ssl_cert)) {
536
            jk_log(l, JK_LOG_ERROR,
538
            jk_log(l, JK_LOG_ERROR,
537
                   "failed appending the SSL certificates");
539
                   "(%s) failed appending the SSL certificates", ae->worker->name);
538
            JK_TRACE_EXIT(l);
540
            JK_TRACE_EXIT(l);
539
            return JK_FALSE;
541
            return JK_FALSE;
540
        }
542
        }
Lines 544-550 Link Here
544
        if (jk_b_append_byte(msg, SC_A_SSL_CIPHER) ||
546
        if (jk_b_append_byte(msg, SC_A_SSL_CIPHER) ||
545
            jk_b_append_string(msg, s->ssl_cipher)) {
547
            jk_b_append_string(msg, s->ssl_cipher)) {
546
            jk_log(l, JK_LOG_ERROR,
548
            jk_log(l, JK_LOG_ERROR,
547
                   "failed appending the SSL ciphers");
549
                   "(%s) failed appending the SSL ciphers", ae->worker->name);
548
            JK_TRACE_EXIT(l);
550
            JK_TRACE_EXIT(l);
549
            return JK_FALSE;
551
            return JK_FALSE;
550
        }
552
        }
Lines 553-559 Link Here
553
        if (jk_b_append_byte(msg, SC_A_SSL_SESSION) ||
555
        if (jk_b_append_byte(msg, SC_A_SSL_SESSION) ||
554
            jk_b_append_string(msg, s->ssl_session)) {
556
            jk_b_append_string(msg, s->ssl_session)) {
555
            jk_log(l, JK_LOG_ERROR,
557
            jk_log(l, JK_LOG_ERROR,
556
                   "failed appending the SSL session");
558
                   "(%s) failed appending the SSL session", ae->worker->name);
557
            JK_TRACE_EXIT(l);
559
            JK_TRACE_EXIT(l);
558
            return JK_FALSE;
560
            return JK_FALSE;
559
        }
561
        }
Lines 568-575 Link Here
568
        if (jk_b_append_byte(msg, SC_A_SSL_KEY_SIZE) ||
570
        if (jk_b_append_byte(msg, SC_A_SSL_KEY_SIZE) ||
569
            jk_b_append_int(msg, (unsigned short)s->ssl_key_size)) {
571
            jk_b_append_int(msg, (unsigned short)s->ssl_key_size)) {
570
            jk_log(l, JK_LOG_ERROR,
572
            jk_log(l, JK_LOG_ERROR,
571
                   "failed appending the SSL key size of length %d",
573
                   "(%s) failed appending the SSL key size of length %d",
572
                  s->ssl_key_size);
574
                  ae->worker->name, s->ssl_key_size);
573
            JK_TRACE_EXIT(l);
575
            JK_TRACE_EXIT(l);
574
            return JK_FALSE;
576
            return JK_FALSE;
575
        }
577
        }
Lines 578-588 Link Here
578
    /* If the method was unrecognized, encode it as an attribute */
580
    /* If the method was unrecognized, encode it as an attribute */
579
    if (method == SC_M_JK_STORED) {
581
    if (method == SC_M_JK_STORED) {
580
        if (JK_IS_DEBUG_LEVEL(l))
582
        if (JK_IS_DEBUG_LEVEL(l))
581
            jk_log(l, JK_LOG_DEBUG, "unknown method %s", s->method);
583
            jk_log(l, JK_LOG_DEBUG, "(%s) unknown method %s", ae->worker->name, s->method);
582
        if (jk_b_append_byte(msg, SC_A_STORED_METHOD) ||
584
        if (jk_b_append_byte(msg, SC_A_STORED_METHOD) ||
583
            jk_b_append_string(msg, s->method)) {
585
            jk_b_append_string(msg, s->method)) {
584
            jk_log(l, JK_LOG_ERROR,
586
            jk_log(l, JK_LOG_ERROR,
585
                   "failed appending the request method");
587
                   "(%s) failed appending the request method", ae->worker->name);
586
            JK_TRACE_EXIT(l);
588
            JK_TRACE_EXIT(l);
587
            return JK_FALSE;
589
            return JK_FALSE;
588
        }
590
        }
Lines 599-606 Link Here
599
        jk_b_append_string(msg, SC_A_REQ_REMOTE_PORT)   ||
601
        jk_b_append_string(msg, SC_A_REQ_REMOTE_PORT)   ||
600
        jk_b_append_string(msg, s->remote_port)) {
602
        jk_b_append_string(msg, s->remote_port)) {
601
        jk_log(l, JK_LOG_ERROR,
603
        jk_log(l, JK_LOG_ERROR,
602
               "failed appending the remote port %s",
604
               "(%s) failed appending the remote port %s",
603
               s->remote_port);
605
               ae->worker->name, s->remote_port);
604
        JK_TRACE_EXIT(l);
606
        JK_TRACE_EXIT(l);
605
        return JK_FALSE;
607
        return JK_FALSE;
606
    }
608
    }
Lines 615-622 Link Here
615
        jk_b_append_string(msg, SC_A_REQ_LOCAL_ADDR)   ||
617
        jk_b_append_string(msg, SC_A_REQ_LOCAL_ADDR)   ||
616
        jk_b_append_string(msg, s->local_addr)) {
618
        jk_b_append_string(msg, s->local_addr)) {
617
        jk_log(l, JK_LOG_ERROR,
619
        jk_log(l, JK_LOG_ERROR,
618
               "failed appending the local address %s",
620
               "(s) failed appending the local address %s",
619
               s->local_addr);
621
               ae->worker->name, s->local_addr);
620
        JK_TRACE_EXIT(l);
622
        JK_TRACE_EXIT(l);
621
        return JK_FALSE;
623
        return JK_FALSE;
622
    }
624
    }
Lines 635-642 Link Here
635
        jk_b_append_string(msg, SC_A_JK_LB_ACTIVATION)   ||
637
        jk_b_append_string(msg, SC_A_JK_LB_ACTIVATION)   ||
636
        jk_b_append_string(msg, s->activation)) {
638
        jk_b_append_string(msg, s->activation)) {
637
        jk_log(l, JK_LOG_ERROR,
639
        jk_log(l, JK_LOG_ERROR,
638
               "failed appending the activation state %s",
640
               "(%s) failed appending the activation state %s",
639
               s->activation);
641
               ae->worker->name, s->activation);
640
        JK_TRACE_EXIT(l);
642
        JK_TRACE_EXIT(l);
641
        return JK_FALSE;
643
        return JK_FALSE;
642
    }
644
    }
Lines 647-654 Link Here
647
                jk_b_append_string(msg, s->attributes_names[i]) ||
649
                jk_b_append_string(msg, s->attributes_names[i]) ||
648
                jk_b_append_string(msg, s->attributes_values[i])) {
650
                jk_b_append_string(msg, s->attributes_values[i])) {
649
                jk_log(l, JK_LOG_ERROR,
651
                jk_log(l, JK_LOG_ERROR,
650
                       "failed appending attribute %s=%s",
652
                       "(%s) failed appending attribute %s=%s",
651
                       s->attributes_names[i], s->attributes_values[i]);
653
                       ae->worker->name, s->attributes_names[i], s->attributes_values[i]);
652
                JK_TRACE_EXIT(l);
654
                JK_TRACE_EXIT(l);
653
                return JK_FALSE;
655
                return JK_FALSE;
654
            }
656
            }
Lines 657-669 Link Here
657
659
658
    if (jk_b_append_byte(msg, SC_A_ARE_DONE)) {
660
    if (jk_b_append_byte(msg, SC_A_ARE_DONE)) {
659
        jk_log(l, JK_LOG_ERROR,
661
        jk_log(l, JK_LOG_ERROR,
660
               "failed appending the message end");
662
               "(%s) failed appending the message end", ae->worker->name);
661
        JK_TRACE_EXIT(l);
663
        JK_TRACE_EXIT(l);
662
        return JK_FALSE;
664
        return JK_FALSE;
663
    }
665
    }
664
666
665
    if (JK_IS_DEBUG_LEVEL(l))
667
    if (JK_IS_DEBUG_LEVEL(l))
666
        jk_log(l, JK_LOG_DEBUG, "ajp marshaling done");
668
        jk_log(l, JK_LOG_DEBUG, "(%s) ajp marshaling done", ae->worker->name);
667
    JK_TRACE_EXIT(l);
669
    JK_TRACE_EXIT(l);
668
    return JK_TRUE;
670
    return JK_TRUE;
669
}
671
}
Lines 705-711 Link Here
705
    d->status = jk_b_get_int(msg);
707
    d->status = jk_b_get_int(msg);
706
    if (!d->status) {
708
    if (!d->status) {
707
        jk_log(l, JK_LOG_ERROR,
709
        jk_log(l, JK_LOG_ERROR,
708
               "NULL status");
710
               "(%s) NULL status",ae->worker->name);
709
        JK_TRACE_EXIT(l);
711
        JK_TRACE_EXIT(l);
710
        return JK_FALSE;
712
        return JK_FALSE;
711
    }
713
    }
Lines 719-725 Link Here
719
721
720
    if (JK_IS_DEBUG_LEVEL(l))
722
    if (JK_IS_DEBUG_LEVEL(l))
721
        jk_log(l, JK_LOG_DEBUG,
723
        jk_log(l, JK_LOG_DEBUG,
722
               "status = %d", d->status);
724
               "(%s) status = %d", ae->worker->name, d->status);
723
725
724
    d->num_headers = jk_b_get_int(msg);
726
    d->num_headers = jk_b_get_int(msg);
725
    d->header_names = d->header_values = NULL;
727
    d->header_names = d->header_values = NULL;
Lines 747-753 Link Here
747
                    }
749
                    }
748
                    else {
750
                    else {
749
                        jk_log(l, JK_LOG_ERROR,
751
                        jk_log(l, JK_LOG_ERROR,
750
                               "No such sc (%d)", name);
752
                               "(%s) No such sc (%d)", ae->worker->name, name);
751
                        JK_TRACE_EXIT(l);
753
                        JK_TRACE_EXIT(l);
752
                        return JK_FALSE;
754
                        return JK_FALSE;
753
                    }
755
                    }
Lines 756-762 Link Here
756
                    d->header_names[i] = jk_b_get_string(msg);
758
                    d->header_names[i] = jk_b_get_string(msg);
757
                    if (!d->header_names[i]) {
759
                    if (!d->header_names[i]) {
758
                        jk_log(l, JK_LOG_ERROR,
760
                        jk_log(l, JK_LOG_ERROR,
759
                               "NULL header name");
761
                               "(%s) NULL header name", ae->worker->name);
760
                        JK_TRACE_EXIT(l);
762
                        JK_TRACE_EXIT(l);
761
                        return JK_FALSE;
763
                        return JK_FALSE;
762
                    }
764
                    }
Lines 770-776 Link Here
770
                d->header_values[i] = jk_b_get_string(msg);
772
                d->header_values[i] = jk_b_get_string(msg);
771
                if (!d->header_values[i]) {
773
                if (!d->header_values[i]) {
772
                    jk_log(l, JK_LOG_ERROR,
774
                    jk_log(l, JK_LOG_ERROR,
773
                           "NULL header value");
775
                           "(%s) NULL header value", ae->worker->name);
774
                    JK_TRACE_EXIT(l);
776
                    JK_TRACE_EXIT(l);
775
                    return JK_FALSE;
777
                    return JK_FALSE;
776
                }
778
                }
Lines 782-789 Link Here
782
784
783
                if (JK_IS_DEBUG_LEVEL(l))
785
                if (JK_IS_DEBUG_LEVEL(l))
784
                    jk_log(l, JK_LOG_DEBUG,
786
                    jk_log(l, JK_LOG_DEBUG,
785
                           "Header[%d] [%s] = [%s]",
787
                           "(%s) Header[%d] [%s] = [%s]",
786
                           i, d->header_names[i], d->header_values[i]);
788
                           ae->worker->name, i, d->header_names[i], d->header_values[i]);
787
            }
789
            }
788
        }
790
        }
789
    }
791
    }
Lines 798-803 Link Here
798
static void ajp_abort_endpoint(ajp_endpoint_t * ae, int shutdown, jk_logger_t *l)
800
static void ajp_abort_endpoint(ajp_endpoint_t * ae, int shutdown, jk_logger_t *l)
799
{
801
{
800
    JK_TRACE_ENTER(l);
802
    JK_TRACE_ENTER(l);
803
804
    if (JK_IS_DEBUG_LEVEL(l))
805
        jk_log(l, JK_LOG_DEBUG,
806
        "(%s) aborting endpoint with socket %d",
807
         ae->worker->name, ae->sd);
801
    if (shutdown == JK_TRUE && IS_VALID_SOCKET(ae->sd)) {
808
    if (shutdown == JK_TRUE && IS_VALID_SOCKET(ae->sd)) {
802
        if (ae->hard_close) {
809
        if (ae->hard_close) {
803
            /* Force unclean connection close to communicate client write errors
810
            /* Force unclean connection close to communicate client write errors
Lines 923-935 Link Here
923
    msg = jk_b_new(&ae->pool);
930
    msg = jk_b_new(&ae->pool);
924
    if (!msg) {
931
    if (!msg) {
925
        jk_log(l, JK_LOG_ERROR,
932
        jk_log(l, JK_LOG_ERROR,
926
               "Failed allocating AJP message");
933
               "(%s) Failed allocating AJP message",
934
		ae->worker->name);
927
        JK_TRACE_EXIT(l);
935
        JK_TRACE_EXIT(l);
928
        return JK_FALSE;
936
        return JK_FALSE;
929
    }
937
    }
930
    if (jk_b_set_buffer_size(msg, 16)) {
938
    if (jk_b_set_buffer_size(msg, 16)) {
931
        jk_log(l, JK_LOG_ERROR,
939
        jk_log(l, JK_LOG_ERROR,
932
               "Failed allocating AJP message buffer");
940
               "(%s) Failed allocating AJP message buffer",
941
		ae->worker->name);
933
        JK_TRACE_EXIT(l);
942
        JK_TRACE_EXIT(l);
934
        return JK_FALSE;
943
        return JK_FALSE;
935
    }
944
    }
Lines 940-946 Link Here
940
     */
949
     */
941
    if (ajp_connection_tcp_send_message(ae, msg, l) != JK_TRUE) {
950
    if (ajp_connection_tcp_send_message(ae, msg, l) != JK_TRUE) {
942
        jk_log(l, JK_LOG_INFO,
951
        jk_log(l, JK_LOG_INFO,
943
               "can't send cping query");
952
               "(%s) can't send cping query",
953
		ae->worker->name);
944
        JK_TRACE_EXIT(l);
954
        JK_TRACE_EXIT(l);
945
        return JK_FALSE;
955
        return JK_FALSE;
946
    }
956
    }
Lines 950-956 Link Here
950
         */
960
         */
951
        if (jk_is_input_event(ae->sd, timeout, l) == JK_FALSE) {
961
        if (jk_is_input_event(ae->sd, timeout, l) == JK_FALSE) {
952
            ae->last_errno = errno;
962
            ae->last_errno = errno;
953
            jk_log(l, JK_LOG_INFO, "timeout in reply cpong");
963
            jk_log(l, JK_LOG_INFO, "(%s) timeout in reply cpong after %d ms. Socket = %d (event=%d)",
964
		ae->worker->name, timeout, ae->sd, errno);
954
            /* We can't trust this connection any more.
965
            /* We can't trust this connection any more.
955
             */
966
             */
956
            ajp_abort_endpoint(ae, JK_TRUE, l);
967
            ajp_abort_endpoint(ae, JK_TRUE, l);
Lines 962-968 Link Here
962
         */
973
         */
963
        if (ajp_connection_tcp_get_message(ae, msg, l) != JK_TRUE) {
974
        if (ajp_connection_tcp_get_message(ae, msg, l) != JK_TRUE) {
964
            jk_log(l, JK_LOG_INFO,
975
            jk_log(l, JK_LOG_INFO,
965
                   "awaited reply cpong, not received");
976
                   "(%s) awaited reply cpong, not received",
977
		ae->worker->name);
966
            JK_TRACE_EXIT(l);
978
            JK_TRACE_EXIT(l);
967
            return JK_FALSE;
979
            return JK_FALSE;
968
        }
980
        }
Lines 979-987 Link Here
979
                     cmd < JK_AJP13_SEND_BODY_CHUNK ||
991
                     cmd < JK_AJP13_SEND_BODY_CHUNK ||
980
                     cmd > AJP13_CPONG_REPLY) {
992
                     cmd > AJP13_CPONG_REPLY) {
981
                jk_log(l, JK_LOG_WARNING,
993
                jk_log(l, JK_LOG_WARNING,
982
                       "awaited reply cpong, received %d instead. "
994
                       "(%s) awaited reply cpong, received %d instead. "
983
                       "Closing connection",
995
                       "Closing connection",
984
                       cmd);
996
                       ae->worker->name, cmd);
985
                /* We can't trust this connection any more.
997
                /* We can't trust this connection any more.
986
                 */
998
                 */
987
                ajp_abort_endpoint(ae, JK_TRUE, l);
999
                ajp_abort_endpoint(ae, JK_TRUE, l);
Lines 990-998 Link Here
990
            }
1002
            }
991
            else {
1003
            else {
992
                jk_log(l, JK_LOG_INFO,
1004
                jk_log(l, JK_LOG_INFO,
993
                       "awaited reply cpong, received %d instead. "
1005
                       "(%s) awaited reply cpong, received %d instead. "
994
                       "Retrying next packet",
1006
                       "Retrying next packet",
995
                       cmd);
1007
                       ae->worker->name, cmd);
996
1008
997
            }
1009
            }
998
        }
1010
        }
Lines 1033-1040 Link Here
1033
    if (!IS_VALID_SOCKET(ae->sd)) {
1045
    if (!IS_VALID_SOCKET(ae->sd)) {
1034
        ae->last_errno = errno;
1046
        ae->last_errno = errno;
1035
        jk_log(l, JK_LOG_INFO,
1047
        jk_log(l, JK_LOG_INFO,
1036
               "Failed opening socket to (%s) (errno=%d)",
1048
               "(%s)Failed opening socket to (%s) (errno=%d)",
1037
               jk_dump_hinfo(&ae->worker->worker_inet_addr, buf), ae->last_errno);
1049
               ae->worker->name, jk_dump_hinfo(&ae->worker->worker_inet_addr, buf), ae->last_errno);
1038
        JK_TRACE_EXIT(l);
1050
        JK_TRACE_EXIT(l);
1039
        return JK_FALSE;
1051
        return JK_FALSE;
1040
    }
1052
    }
Lines 1254-1261 Link Here
1254
    }
1266
    }
1255
    ae->last_errno = errno;
1267
    ae->last_errno = errno;
1256
    jk_log(l, JK_LOG_INFO,
1268
    jk_log(l, JK_LOG_INFO,
1257
           "sendfull for socket %d returned %d (errno=%d)",
1269
           "(%s) sendfull for socket %d returned %d (errno=%d)",
1258
           ae->sd, rc, ae->last_errno);
1270
           ae->worker->name, ae->sd, rc, ae->last_errno);
1259
    ajp_abort_endpoint(ae, JK_FALSE, l);
1271
    ajp_abort_endpoint(ae, JK_FALSE, l);
1260
    JK_TRACE_EXIT(l);
1272
    JK_TRACE_EXIT(l);
1261
    return JK_FALSE;
1273
    return JK_FALSE;
Lines 1322-1334 Link Here
1322
1334
1323
            if (header == AJP14_SW_HEADER) {
1335
            if (header == AJP14_SW_HEADER) {
1324
                jk_log(l, JK_LOG_ERROR,
1336
                jk_log(l, JK_LOG_ERROR,
1325
                       "received AJP14 reply on an AJP13 connection from %s",
1337
                       "(%s) received AJP14 reply on an AJP13 connection from %s",
1326
                       jk_dump_hinfo(&ae->worker->worker_inet_addr, buf));
1338
                       ae->worker->name, jk_dump_hinfo(&ae->worker->worker_inet_addr, buf));
1327
            }
1339
            }
1328
            else {
1340
            else {
1329
                jk_log(l, JK_LOG_ERROR,
1341
                jk_log(l, JK_LOG_ERROR,
1330
                       "wrong message format 0x%04x from %s",
1342
                       "(%s) wrong message format 0x%04x from %s",
1331
                       header, jk_dump_hinfo(&ae->worker->worker_inet_addr,
1343
                       ae->worker->name, header, jk_dump_hinfo(&ae->worker->worker_inet_addr,
1332
                                             buf));
1344
                                             buf));
1333
            }
1345
            }
1334
            /* We've got a protocol error.
1346
            /* We've got a protocol error.
Lines 1344-1356 Link Here
1344
1356
1345
            if (header == AJP13_SW_HEADER) {
1357
            if (header == AJP13_SW_HEADER) {
1346
                jk_log(l, JK_LOG_ERROR,
1358
                jk_log(l, JK_LOG_ERROR,
1347
                       "received AJP13 reply on an AJP14 connection from %s",
1359
                       "(%s) received AJP13 reply on an AJP14 connection from %s",
1348
                       jk_dump_hinfo(&ae->worker->worker_inet_addr, buf));
1360
                       ae->worker->name, jk_dump_hinfo(&ae->worker->worker_inet_addr, buf));
1349
            }
1361
            }
1350
            else {
1362
            else {
1351
                jk_log(l, JK_LOG_ERROR,
1363
                jk_log(l, JK_LOG_ERROR,
1352
                       "wrong message format 0x%04x from %s",
1364
                       "(%s) wrong message format 0x%04x from %s",
1353
                       header, jk_dump_hinfo(&ae->worker->worker_inet_addr,
1365
                       ae->worker->name, header, jk_dump_hinfo(&ae->worker->worker_inet_addr,
1354
                                             buf));
1366
                                             buf));
1355
            }
1367
            }
1356
            /* We've got a protocol error.
1368
            /* We've got a protocol error.
Lines 1367-1374 Link Here
1367
1379
1368
    if (msglen > msg->maxlen) {
1380
    if (msglen > msg->maxlen) {
1369
        jk_log(l, JK_LOG_ERROR,
1381
        jk_log(l, JK_LOG_ERROR,
1370
               "wrong message size %d %d from %s",
1382
               "(%s) wrong message size %d %d from %s",
1371
               msglen, msg->maxlen,
1383
               ae->worker->name, msglen, msg->maxlen,
1372
               jk_dump_hinfo(&ae->worker->worker_inet_addr, buf));
1384
               jk_dump_hinfo(&ae->worker->worker_inet_addr, buf));
1373
        /* We've got a protocol error.
1385
        /* We've got a protocol error.
1374
         * We can't trust this connection any more.
1386
         * We can't trust this connection any more.
Lines 1525-1531 Link Here
1525
         */
1537
         */
1526
        if (0 != jk_b_append_int(msg, (unsigned short)len)) {
1538
        if (0 != jk_b_append_int(msg, (unsigned short)len)) {
1527
            jk_log(l, JK_LOG_INFO,
1539
            jk_log(l, JK_LOG_INFO,
1528
                   "Failed appending message length");
1540
                   "(%s) Failed appending message length", ae->worker->name);
1529
            JK_TRACE_EXIT(l);
1541
            JK_TRACE_EXIT(l);
1530
            return JK_CLIENT_RD_ERROR;
1542
            return JK_CLIENT_RD_ERROR;
1531
        }
1543
        }
Lines 1761-1768 Link Here
1761
        }
1773
        }
1762
        else {
1774
        else {
1763
            if (JK_IS_DEBUG_LEVEL(l))
1775
            if (JK_IS_DEBUG_LEVEL(l))
1764
                jk_log(l, JK_LOG_DEBUG, "Resent the request body (%d)",
1776
                jk_log(l, JK_LOG_DEBUG, "(%s) Resent the request body (%d)",
1765
                       postlen);
1777
                       ae->worker->name, postlen);
1766
        }
1778
        }
1767
    }
1779
    }
1768
    else if (s->reco_status == RECO_FILLED) {
1780
    else if (s->reco_status == RECO_FILLED) {
Lines 1789-1795 Link Here
1789
        else {
1801
        else {
1790
            if (JK_IS_DEBUG_LEVEL(l))
1802
            if (JK_IS_DEBUG_LEVEL(l))
1791
                jk_log(l, JK_LOG_DEBUG,
1803
                jk_log(l, JK_LOG_DEBUG,
1792
                       "Resent the request body (lb mode) (%d)", postlen);
1804
                       "(%s) Resent the request body (lb mode) (%d)", ae->worker->name, postlen);
1793
        }
1805
        }
1794
    }
1806
    }
1795
    else {
1807
    else {
Lines 1881-1894 Link Here
1881
                 */
1893
                 */
1882
                if (JK_IS_DEBUG_LEVEL(l)) {
1894
                if (JK_IS_DEBUG_LEVEL(l)) {
1883
                    jk_log(l, JK_LOG_DEBUG,
1895
                    jk_log(l, JK_LOG_DEBUG,
1884
                           "Already received AJP13_SEND HEADERS");
1896
                           "(%s) Already received AJP13_SEND HEADERS", ae->worker->name);
1885
                }
1897
                }
1886
                JK_TRACE_EXIT(l);
1898
                JK_TRACE_EXIT(l);
1887
                return JK_AJP13_ERROR;
1899
                return JK_AJP13_ERROR;
1888
            }
1900
            }
1889
            if (!ajp_unmarshal_response(msg, &res, ae, l)) {
1901
            if (!ajp_unmarshal_response(msg, &res, ae, l)) {
1890
                jk_log(l, JK_LOG_ERROR,
1902
                jk_log(l, JK_LOG_ERROR,
1891
                       "ajp_unmarshal_response failed");
1903
                       "(%s) ajp_unmarshal_response failed", ae->worker->name);
1892
                JK_TRACE_EXIT(l);
1904
                JK_TRACE_EXIT(l);
1893
                return JK_AJP13_ERROR;
1905
                return JK_AJP13_ERROR;
1894
            }
1906
            }
Lines 1896-1909 Link Here
1896
                char **old_names = res.header_names;
1908
                char **old_names = res.header_names;
1897
                char **old_values = res.header_values;
1909
                char **old_values = res.header_values;
1898
                if (JK_IS_DEBUG_LEVEL(l))
1910
                if (JK_IS_DEBUG_LEVEL(l))
1899
                    jk_log(l, JK_LOG_DEBUG, "Adding %d response headers to %d headers received from tomcat", r->num_resp_headers, res.num_headers);
1911
                    jk_log(l, JK_LOG_DEBUG, "(%s) Adding %d response headers to %d headers received from tomcat",
1912
			ae->worker->name, r->num_resp_headers, res.num_headers);
1900
                res.header_names  = jk_pool_alloc(r->pool,
1913
                res.header_names  = jk_pool_alloc(r->pool,
1901
                                                  (r->num_resp_headers + res.num_headers) * sizeof(char *));
1914
                                                  (r->num_resp_headers + res.num_headers) * sizeof(char *));
1902
                res.header_values = jk_pool_alloc(r->pool,
1915
                res.header_values = jk_pool_alloc(r->pool,
1903
                                                  (r->num_resp_headers + res.num_headers) * sizeof(char *));
1916
                                                  (r->num_resp_headers + res.num_headers) * sizeof(char *));
1904
                if (!res.header_names || !res.header_values) {
1917
                if (!res.header_names || !res.header_values) {
1905
                    jk_log(l, JK_LOG_ERROR,
1918
                    jk_log(l, JK_LOG_ERROR,
1906
                        "Failed allocating one %d response headers.", r->num_resp_headers + res.num_headers);
1919
                        "(%s) Failed allocating one %d response headers.",
1920
			ae->worker->name, r->num_resp_headers + res.num_headers);
1907
                    res.header_names = old_names;
1921
                    res.header_names = old_names;
1908
                    res.header_values = old_values;
1922
                    res.header_values = old_values;
1909
                } else {
1923
                } else {
Lines 1966-1972 Link Here
1966
             */
1980
             */
1967
            if (jk_b_get_int(msg) == 0) {
1981
            if (jk_b_get_int(msg) == 0) {
1968
                jk_log(l, JK_LOG_DEBUG,
1982
                jk_log(l, JK_LOG_DEBUG,
1969
                       "Ignoring flush message received while sending the request");
1983
                       "(%s) Ignoring flush message received while sending the request",
1984
			ae->worker->name);
1970
                return ae->last_op;
1985
                return ae->last_op;
1971
            }
1986
            }
1972
            /* We have just send a request but received something
1987
            /* We have just send a request but received something
Lines 1974-1980 Link Here
1974
             */
1989
             */
1975
            if (JK_IS_DEBUG_LEVEL(l)) {
1990
            if (JK_IS_DEBUG_LEVEL(l)) {
1976
                jk_log(l, JK_LOG_DEBUG,
1991
                jk_log(l, JK_LOG_DEBUG,
1977
                       "Unexpected AJP13_SEND_BODY_CHUNK");
1992
                       "(%s) Unexpected AJP13_SEND_BODY_CHUNK",
1993
			ae->worker->name);
1978
            }
1994
            }
1979
            JK_TRACE_EXIT(l);
1995
            JK_TRACE_EXIT(l);
1980
            return JK_AJP13_ERROR;
1996
            return JK_AJP13_ERROR;
Lines 1992-1999 Link Here
1992
             */
2008
             */
1993
            if (len > (unsigned int)(msg->len - 3)) {
2009
            if (len > (unsigned int)(msg->len - 3)) {
1994
                jk_log(l, JK_LOG_ERROR,
2010
                jk_log(l, JK_LOG_ERROR,
1995
                       "Chunk length too large. Length of AJP message is %d,"
2011
                       "(%s) Chunk length too large. Length of AJP message is %d,"
1996
                       " chunk length is %d.", msg->len, len);
2012
                       " chunk length is %d.", ae->worker->name, msg->len, len);
1997
                JK_TRACE_EXIT(l);
2013
                JK_TRACE_EXIT(l);
1998
                return JK_INTERNAL_ERROR;
2014
                return JK_INTERNAL_ERROR;
1999
            }
2015
            }
Lines 2008-2020 Link Here
2008
                }
2024
                }
2009
                else {
2025
                else {
2010
                    jk_log(l, JK_LOG_DEBUG,
2026
                    jk_log(l, JK_LOG_DEBUG,
2011
                           "Ignoring flush message received before headers");
2027
                        "(%s) Ignoring flush message received before headers",
2028
			ae->worker->name);
2012
                }
2029
                }
2013
            }
2030
            }
2014
            else {
2031
            else {
2015
                if (!r->write(r, msg->buf + msg->pos, len)) {
2032
                if (!r->write(r, msg->buf + msg->pos, len)) {
2016
                    jk_log(l, JK_LOG_INFO,
2033
                    jk_log(l, JK_LOG_INFO,
2017
                           "Writing to client aborted or client network problems");
2034
                        "(%s) Writing to client aborted or client network problems",
2035
			ae->worker->name);
2018
                    JK_TRACE_EXIT(l);
2036
                    JK_TRACE_EXIT(l);
2019
                    return JK_CLIENT_WR_ERROR;
2037
                    return JK_CLIENT_WR_ERROR;
2020
                }
2038
                }
Lines 2041-2047 Link Here
2041
            }
2059
            }
2042
2060
2043
            jk_log(l, JK_LOG_INFO,
2061
            jk_log(l, JK_LOG_INFO,
2044
                   "Reading from client aborted or client network problems");
2062
                "(%s) Reading from client aborted or client network problems",
2063
		ae->worker->name);
2045
2064
2046
            JK_TRACE_EXIT(l);
2065
            JK_TRACE_EXIT(l);
2047
            return JK_CLIENT_RD_ERROR;
2066
            return JK_CLIENT_RD_ERROR;
Lines 2055-2065 Link Here
2055
             * AJP13 protocol reuse flag set to false.
2074
             * AJP13 protocol reuse flag set to false.
2056
             * Tomcat will close its side of the connection.
2075
             * Tomcat will close its side of the connection.
2057
             */
2076
             */
2058
            jk_log(l, JK_LOG_WARNING, "AJP13 protocol: Reuse is set to false");
2077
            jk_log(l, JK_LOG_WARNING, "(%s) AJP13 protocol: Reuse is set to false",
2078
		ae->worker->name);
2059
        }
2079
        }
2060
        else if (r->disable_reuse) {
2080
        else if (r->disable_reuse) {
2061
            if (JK_IS_DEBUG_LEVEL(l)) {
2081
            if (JK_IS_DEBUG_LEVEL(l)) {
2062
                jk_log(l, JK_LOG_DEBUG, "AJP13 protocol: Reuse is disabled");
2082
                jk_log(l, JK_LOG_DEBUG, "(%s) AJP13 protocol: Reuse is disabled",
2083
			ae->worker->name);
2063
            }
2084
            }
2064
            ae->reuse = JK_FALSE;
2085
            ae->reuse = JK_FALSE;
2065
        }
2086
        }
Lines 2067-2073 Link Here
2067
            /* Reuse in all cases
2088
            /* Reuse in all cases
2068
             */
2089
             */
2069
            if (JK_IS_DEBUG_LEVEL(l)) {
2090
            if (JK_IS_DEBUG_LEVEL(l)) {
2070
                jk_log(l, JK_LOG_DEBUG, "AJP13 protocol: Reuse is OK");
2091
                jk_log(l, JK_LOG_DEBUG, "(%s) AJP13 protocol: Reuse is OK",
2092
			ae->worker->name);
2071
            }
2093
            }
2072
            ae->reuse = JK_TRUE;
2094
            ae->reuse = JK_TRUE;
2073
        }
2095
        }
Lines 2089-2095 Link Here
2089
2111
2090
    default:
2112
    default:
2091
        jk_log(l, JK_LOG_ERROR,
2113
        jk_log(l, JK_LOG_ERROR,
2092
               "Unknown AJP protocol code: %02X", code);
2114
               "(%s) Unknown AJP protocol code: %02X", ae->worker->name, code);
2093
        JK_TRACE_EXIT(l);
2115
        JK_TRACE_EXIT(l);
2094
        return JK_AJP13_ERROR;
2116
        return JK_AJP13_ERROR;
2095
    }
2117
    }
Lines 2445-2457 Link Here
2445
    op->request = jk_b_new(&(p->pool));
2467
    op->request = jk_b_new(&(p->pool));
2446
    if (!op->request) {
2468
    if (!op->request) {
2447
        jk_log(l, JK_LOG_ERROR,
2469
        jk_log(l, JK_LOG_ERROR,
2448
               "Failed allocating AJP message");
2470
               "(%s) Failed allocating AJP message",aw->name);
2449
        JK_TRACE_EXIT(l);
2471
        JK_TRACE_EXIT(l);
2450
        return JK_SERVER_ERROR;
2472
        return JK_SERVER_ERROR;
2451
    }
2473
    }
2452
    if (jk_b_set_buffer_size(op->request, aw->max_packet_size)) {
2474
    if (jk_b_set_buffer_size(op->request, aw->max_packet_size)) {
2453
        jk_log(l, JK_LOG_ERROR,
2475
        jk_log(l, JK_LOG_ERROR,
2454
               "Failed allocating AJP message buffer");
2476
               "(%s) Failed allocating AJP message buffer", aw->name);
2455
        JK_TRACE_EXIT(l);
2477
        JK_TRACE_EXIT(l);
2456
        return JK_SERVER_ERROR;
2478
        return JK_SERVER_ERROR;
2457
    }
2479
    }
Lines 2460-2472 Link Here
2460
    op->reply = jk_b_new(&(p->pool));
2482
    op->reply = jk_b_new(&(p->pool));
2461
    if (!op->reply) {
2483
    if (!op->reply) {
2462
        jk_log(l, JK_LOG_ERROR,
2484
        jk_log(l, JK_LOG_ERROR,
2463
               "Failed allocating AJP message");
2485
               "(%s) Failed allocating AJP message", aw->name);
2464
        JK_TRACE_EXIT(l);
2486
        JK_TRACE_EXIT(l);
2465
        return JK_SERVER_ERROR;
2487
        return JK_SERVER_ERROR;
2466
    }
2488
    }
2467
    if (jk_b_set_buffer_size(op->reply, aw->max_packet_size)) {
2489
    if (jk_b_set_buffer_size(op->reply, aw->max_packet_size)) {
2468
        jk_log(l, JK_LOG_ERROR,
2490
        jk_log(l, JK_LOG_ERROR,
2469
               "Failed allocating AJP message buffer");
2491
               "(%s) Failed allocating AJP message buffer", aw->name);
2470
        JK_TRACE_EXIT(l);
2492
        JK_TRACE_EXIT(l);
2471
        return JK_SERVER_ERROR;
2493
        return JK_SERVER_ERROR;
2472
    }
2494
    }
Lines 2474-2486 Link Here
2474
    op->post = jk_b_new(&(p->pool));
2496
    op->post = jk_b_new(&(p->pool));
2475
    if (!op->post) {
2497
    if (!op->post) {
2476
        jk_log(l, JK_LOG_ERROR,
2498
        jk_log(l, JK_LOG_ERROR,
2477
               "Failed allocating AJP message");
2499
               "(%s) Failed allocating AJP message", aw->name);
2478
        JK_TRACE_EXIT(l);
2500
        JK_TRACE_EXIT(l);
2479
        return JK_SERVER_ERROR;
2501
        return JK_SERVER_ERROR;
2480
    }
2502
    }
2481
    if (jk_b_set_buffer_size(op->post, aw->max_packet_size)) {
2503
    if (jk_b_set_buffer_size(op->post, aw->max_packet_size)) {
2482
        jk_log(l, JK_LOG_ERROR,
2504
        jk_log(l, JK_LOG_ERROR,
2483
               "Failed allocating AJP message buffer");
2505
               "(%s) Failed allocating AJP message buffer", aw->name);
2484
        JK_TRACE_EXIT(l);
2506
        JK_TRACE_EXIT(l);
2485
        return JK_SERVER_ERROR;
2507
        return JK_SERVER_ERROR;
2486
    }
2508
    }
Lines 2505-2512 Link Here
2505
    if (!ajp_marshal_into_msgb(op->request, s, l, p)) {
2527
    if (!ajp_marshal_into_msgb(op->request, s, l, p)) {
2506
        *is_error = JK_HTTP_REQUEST_TOO_LARGE;
2528
        *is_error = JK_HTTP_REQUEST_TOO_LARGE;
2507
        jk_log(l, JK_LOG_INFO,
2529
        jk_log(l, JK_LOG_INFO,
2508
                "Creating AJP message failed "
2530
                "(%s) Creating AJP message failed "
2509
                "without recovery - check max_packet_size");
2531
                "without recovery - check max_packet_size", aw->name);
2510
        aw->s->client_errors++;
2532
        aw->s->client_errors++;
2511
        JK_TRACE_EXIT(l);
2533
        JK_TRACE_EXIT(l);
2512
        return JK_CLIENT_ERROR;
2534
        return JK_CLIENT_ERROR;
Lines 2536-2543 Link Here
2536
        if (i > 0 && retry_interval >= 0) {
2558
        if (i > 0 && retry_interval >= 0) {
2537
            if (JK_IS_DEBUG_LEVEL(l))
2559
            if (JK_IS_DEBUG_LEVEL(l))
2538
                jk_log(l, JK_LOG_DEBUG,
2560
                jk_log(l, JK_LOG_DEBUG,
2539
                       "retry %d, sleeping for %d ms before retrying",
2561
                       "(%s) retry %d, sleeping for %d ms before retrying",
2540
                       i, retry_interval);
2562
                       aw->name, i, retry_interval);
2541
            jk_sleep(retry_interval);
2563
            jk_sleep(retry_interval);
2542
            /* Pull shared memory if something changed during sleep
2564
            /* Pull shared memory if something changed during sleep
2543
             */
2565
             */
Lines 2704-2716 Link Here
2704
         */
2726
         */
2705
        ajp_next_connection(p, l);
2727
        ajp_next_connection(p, l);
2706
    }
2728
    }
2729
    ajp_update_stats(e, aw, rc, l);
2707
    /* Log the error only once per failed request.
2730
    /* Log the error only once per failed request.
2708
     */
2731
     */
2709
    jk_log(l, JK_LOG_ERROR,
2732
    jk_log(l, JK_LOG_ERROR,
2710
           "(%s) connecting to tomcat failed.",
2733
           "(%s) connecting to tomcat failed (rc=%d, errors=%d, client_errors=%d).",
2711
           aw->name);
2734
           aw->name,rc,aw->s->errors,aw->s->client_errors);
2712
2735
2713
    ajp_update_stats(e, aw, rc, l);
2714
    JK_TRACE_EXIT(l);
2736
    JK_TRACE_EXIT(l);
2715
    return rc;
2737
    return rc;
2716
}
2738
}
Lines 2736-2743 Link Here
2736
        host = AJP14_DEF_HOST;
2758
        host = AJP14_DEF_HOST;
2737
    }
2759
    }
2738
    else {
2760
    else {
2739
        jk_log(l, JK_LOG_ERROR,
2761
	if (pThis && pThis->worker_private) {
2740
               "unknown protocol %d", proto);
2762
        	ajp_worker_t *p = pThis->worker_private;
2763
        	jk_log(l, JK_LOG_ERROR,
2764
               		"(%s) unknown protocol %d", p->name, proto);
2765
	}
2766
	else {
2767
        	jk_log(l, JK_LOG_ERROR,
2768
               		"(Worker not set, unknown protocol %d", proto);
2769
	}
2741
        JK_TRACE_EXIT(l);
2770
        JK_TRACE_EXIT(l);
2742
        return JK_FALSE;
2771
        return JK_FALSE;
2743
    }
2772
    }
Lines 2816-2829 Link Here
2816
    }
2845
    }
2817
    if (JK_IS_DEBUG_LEVEL(l))
2846
    if (JK_IS_DEBUG_LEVEL(l))
2818
        jk_log(l, JK_LOG_DEBUG,
2847
        jk_log(l, JK_LOG_DEBUG,
2819
                "setting connection pool size to %u with min %u and acquire timeout %d",
2848
                "(%s) setting connection pool size to %u with min %u and acquire timeout %d",
2820
                p->ep_cache_sz, p->ep_mincache_sz, p->cache_acquire_timeout);
2849
                p->name, p->ep_cache_sz, p->ep_mincache_sz, p->cache_acquire_timeout);
2821
    for (i = 0; i < p->ep_cache_sz; i++) {
2850
    for (i = 0; i < p->ep_cache_sz; i++) {
2822
        p->ep_cache[i] = (ajp_endpoint_t *)calloc(1, sizeof(ajp_endpoint_t));
2851
        p->ep_cache[i] = (ajp_endpoint_t *)calloc(1, sizeof(ajp_endpoint_t));
2823
        if (!p->ep_cache[i]) {
2852
        if (!p->ep_cache[i]) {
2824
            jk_log(l, JK_LOG_ERROR,
2853
            jk_log(l, JK_LOG_ERROR,
2825
                    "allocating endpoint slot %d (errno=%d)",
2854
                    "(%s) allocating endpoint slot %d (errno=%d)",
2826
                    i, errno);
2855
                    p->name, i, errno);
2827
            JK_TRACE_EXIT(l);
2856
            JK_TRACE_EXIT(l);
2828
            return JK_FALSE;
2857
            return JK_FALSE;
2829
        }
2858
        }
Lines 2942-2949 Link Here
2942
2971
2943
        if (p->retries < 1) {
2972
        if (p->retries < 1) {
2944
            jk_log(l, JK_LOG_INFO,
2973
            jk_log(l, JK_LOG_INFO,
2945
                   "number of retries must be greater then 1. Setting to default=%d",
2974
                   "(%s) number of retries must be greater then 1. Setting to default=%d",
2946
                   JK_RETRIES);
2975
                   p->name, JK_RETRIES);
2947
            p->retries = JK_RETRIES;
2976
            p->retries = JK_RETRIES;
2948
        }
2977
        }
2949
2978
Lines 2953-2960 Link Here
2953
        if (JK_IS_DEBUG_LEVEL(l)) {
2982
        if (JK_IS_DEBUG_LEVEL(l)) {
2954
2983
2955
            jk_log(l, JK_LOG_DEBUG,
2984
            jk_log(l, JK_LOG_DEBUG,
2956
                   "setting endpoint options:",
2985
                   "(%s) setting endpoint options:",
2957
                   p->keepalive);
2986
                   p->name);
2987
2958
            jk_log(l, JK_LOG_DEBUG,
2988
            jk_log(l, JK_LOG_DEBUG,
2959
                   "keepalive:              %d",
2989
                   "keepalive:              %d",
2960
                   p->keepalive);
2990
                   p->keepalive);
Lines 3014-3021 Link Here
3014
        p->secret = jk_get_worker_secret(props, p->name);
3044
        p->secret = jk_get_worker_secret(props, p->name);
3015
        if (!ajp_create_endpoint_cache(p, proto, l)) {
3045
        if (!ajp_create_endpoint_cache(p, proto, l)) {
3016
            jk_log(l, JK_LOG_ERROR,
3046
            jk_log(l, JK_LOG_ERROR,
3017
                   "allocating connection pool of size %u",
3047
                   "(%s) allocating connection pool of size %u",
3018
                   p->ep_cache_sz);
3048
                   p->name, p->ep_cache_sz);
3019
            JK_TRACE_EXIT(l);
3049
            JK_TRACE_EXIT(l);
3020
            return JK_FALSE;
3050
            return JK_FALSE;
3021
        }
3051
        }
Lines 3045-3051 Link Here
3045
    aw = (ajp_worker_t *) calloc(1, sizeof(ajp_worker_t));
3075
    aw = (ajp_worker_t *) calloc(1, sizeof(ajp_worker_t));
3046
    if (!aw) {
3076
    if (!aw) {
3047
        jk_log(l, JK_LOG_ERROR,
3077
        jk_log(l, JK_LOG_ERROR,
3048
               "malloc of private_data failed");
3078
               "(%s) malloc of private_data failed", name);
3049
        JK_TRACE_EXIT(l);
3079
        JK_TRACE_EXIT(l);
3050
        return JK_FALSE;
3080
        return JK_FALSE;
3051
    }
3081
    }
Lines 3073-3087 Link Here
3073
        jk_close_pool(&aw->p);
3103
        jk_close_pool(&aw->p);
3074
        free(aw);
3104
        free(aw);
3075
        jk_log(l, JK_LOG_ERROR,
3105
        jk_log(l, JK_LOG_ERROR,
3076
               "allocating ajp worker record from shared memory");
3106
               "(%s) allocating ajp worker record from shared memory", aw->name);
3077
        JK_TRACE_EXIT(l);
3107
        JK_TRACE_EXIT(l);
3078
        return JK_FALSE;
3108
        return JK_FALSE;
3079
    }
3109
    }
3080
    JK_INIT_CS(&aw->cs, rc);
3110
    JK_INIT_CS(&aw->cs, rc);
3081
    if (!rc) {
3111
    if (!rc) {
3082
        jk_log(l, JK_LOG_ERROR,
3112
        jk_log(l, JK_LOG_ERROR,
3083
               "creating thread lock (errno=%d)",
3113
               "(%s) creating thread lock (errno=%d)",
3084
               errno);
3114
               aw->name, errno);
3085
        jk_close_pool(&aw->p);
3115
        jk_close_pool(&aw->p);
3086
        free(aw);
3116
        free(aw);
3087
        JK_TRACE_EXIT(l);
3117
        JK_TRACE_EXIT(l);
Lines 3105-3112 Link Here
3105
3135
3106
        if (JK_IS_DEBUG_LEVEL(l))
3136
        if (JK_IS_DEBUG_LEVEL(l))
3107
            jk_log(l, JK_LOG_DEBUG,
3137
            jk_log(l, JK_LOG_DEBUG,
3108
                   "up to %u endpoints to close",
3138
                   "(%s) up to %u endpoints to close",
3109
                   aw->ep_cache_sz);
3139
                   aw->name, aw->ep_cache_sz);
3110
3140
3111
        for (i = 0; i < aw->ep_cache_sz; i++) {
3141
        for (i = 0; i < aw->ep_cache_sz; i++) {
3112
            if (aw->ep_cache[i])
3142
            if (aw->ep_cache[i])
Lines 3204-3210 Link Here
3204
                        ae->avail = JK_TRUE;
3234
                        ae->avail = JK_TRUE;
3205
                        ae = NULL;
3235
                        ae = NULL;
3206
                        jk_log(l, JK_LOG_WARNING,
3236
                        jk_log(l, JK_LOG_WARNING,
3207
                               "closing non reusable pool slot=%d", slot);
3237
                               "(%s) closing non reusable pool slot=%d", aw->name, slot);
3208
                    }
3238
                    }
3209
                }
3239
                }
3210
            }
3240
            }
Lines 3227-3234 Link Here
3227
                *je = &ae->endpoint;
3257
                *je = &ae->endpoint;
3228
                if (JK_IS_DEBUG_LEVEL(l))
3258
                if (JK_IS_DEBUG_LEVEL(l))
3229
                    jk_log(l, JK_LOG_DEBUG,
3259
                    jk_log(l, JK_LOG_DEBUG,
3230
                           "acquired connection pool slot=%u after %d retries",
3260
                           "(%s) acquired connection pool slot=%u after %d retries",
3231
                           slot, retry);
3261
                           aw->name, slot, retry);
3232
                JK_TRACE_EXIT(l);
3262
                JK_TRACE_EXIT(l);
3233
                return JK_TRUE;
3263
                return JK_TRUE;
3234
            }
3264
            }
Lines 3325-3339 Link Here
3325
                        ajp_reset_endpoint(aw->ep_cache[i], l);
3355
                        ajp_reset_endpoint(aw->ep_cache[i], l);
3326
                        if (JK_IS_DEBUG_LEVEL(l))
3356
                        if (JK_IS_DEBUG_LEVEL(l))
3327
                            jk_log(l, JK_LOG_DEBUG,
3357
                            jk_log(l, JK_LOG_DEBUG,
3328
                                   "cleaning pool slot=%d elapsed %d in %d",
3358
                                   "(%s) cleaning pool slot=%d elapsed %d in %d",
3329
                                   i, elapsed, (int)(difftime(time(NULL), rt)));
3359
                                   aw->name, i, elapsed, (int)(difftime(time(NULL), rt)));
3330
                    }
3360
                    }
3331
                }
3361
                }
3332
                if (cnt <= aw->ep_mincache_sz + n) {
3362
                if (cnt <= aw->ep_mincache_sz + n) {
3333
                    if (JK_IS_DEBUG_LEVEL(l)) {
3363
                    if (JK_IS_DEBUG_LEVEL(l)) {
3334
                        jk_log(l, JK_LOG_DEBUG,
3364
                        jk_log(l, JK_LOG_DEBUG,
3335
                        "reached pool min size %u from %u cache slots",
3365
                        "(%s) reached pool min size %u from %u cache slots",
3336
                        aw->ep_mincache_sz, aw->ep_cache_sz);
3366
                        aw->name, aw->ep_mincache_sz, aw->ep_cache_sz);
3337
                    }
3367
                    }
3338
                    break;
3368
                    break;
3339
                }
3369
                }
Lines 3357-3363 Link Here
3357
                            jk_log(l, JK_LOG_INFO,
3387
                            jk_log(l, JK_LOG_INFO,
3358
                                   "(%s) failed sending request, "
3388
                                   "(%s) failed sending request, "
3359
                                   "socket %d keepalive cping/cpong "
3389
                                   "socket %d keepalive cping/cpong "
3360
                                   "failure (errno=%d)",
3390
                                   "failure (errno/event=%d)",
3361
                                   aw->name,
3391
                                   aw->name,
3362
                                   aw->ep_cache[i]->sd,
3392
                                   aw->ep_cache[i]->sd,
3363
                                   aw->ep_cache[i]->last_errno);
3393
                                   aw->ep_cache[i]->last_errno);
Lines 3388-3400 Link Here
3388
        free(m_sock);
3418
        free(m_sock);
3389
        if (n && JK_IS_DEBUG_LEVEL(l))
3419
        if (n && JK_IS_DEBUG_LEVEL(l))
3390
            jk_log(l, JK_LOG_DEBUG,
3420
            jk_log(l, JK_LOG_DEBUG,
3391
                   "recycled %u sockets in %d seconds from %u pool slots",
3421
                   "(%s) recycled %u sockets in %d seconds from %u pool slots",
3392
                   n, (int)(difftime(time(NULL), mstarted)),
3422
                   aw->name, n, (int)(difftime(time(NULL), mstarted)),
3393
                   aw->ep_cache_sz);
3423
                   aw->ep_cache_sz);
3394
        if (k && JK_IS_DEBUG_LEVEL(l))
3424
        if (k && JK_IS_DEBUG_LEVEL(l))
3395
            jk_log(l, JK_LOG_DEBUG,
3425
            jk_log(l, JK_LOG_DEBUG,
3396
                   "pinged %u sockets in %d seconds from %u pool slots",
3426
                   "(%s) pinged %u sockets in %d seconds from %u pool slots",
3397
                   k, (int)(difftime(time(NULL), mstarted)),
3427
                   aw->name, k, (int)(difftime(time(NULL), mstarted)),
3398
                   aw->ep_cache_sz);
3428
                   aw->ep_cache_sz);
3399
        JK_TRACE_EXIT(l);
3429
        JK_TRACE_EXIT(l);
3400
        return JK_TRUE;
3430
        return JK_TRUE;

Return to bug 56770