--- native/common/jk_ajp_common.c-orig 2014-07-24 15:13:41.000000000 +0200 +++ native/common/jk_ajp_common.c-orig 2014-07-24 16:37:08.000000000 +0200 @@ -445,7 +445,7 @@ jk_b_append_int(msg, (unsigned short)(s->num_headers))) { jk_log(l, JK_LOG_ERROR, - "failed appending the message begining"); + "(%s) failed appending the message begining", ae->worker->name); JK_TRACE_EXIT(l); return JK_FALSE; } @@ -456,7 +456,8 @@ if ((sc = sc_for_req_header(s->headers_names[i])) != UNKNOWN_METHOD) { if (jk_b_append_int(msg, (unsigned short)sc)) { jk_log(l, JK_LOG_ERROR, - "failed appending the header code for '%s'", s->headers_names[i]); + "(%s) failed appending the header code for '%s'", + ae->worker->name, s->headers_names[i]); JK_TRACE_EXIT(l); return JK_FALSE; } @@ -464,7 +465,8 @@ else { if (jk_b_append_string(msg, s->headers_names[i])) { jk_log(l, JK_LOG_ERROR, - "failed appending the header name '%s'", s->headers_names[i]); + "(%s) failed appending the header name '%s'", + ae->worker->name, s->headers_names[i]); JK_TRACE_EXIT(l); return JK_FALSE; } @@ -472,8 +474,8 @@ if (jk_b_append_string(msg, s->headers_values[i])) { jk_log(l, JK_LOG_ERROR, - "failed appending the header value for header '%s' of length %u", - s->headers_names[i], strlen(s->headers_names[i])); + "(%s) failed appending the header value for header '%s' of length %u", + ae->worker->name, s->headers_names[i], strlen(s->headers_names[i])); JK_TRACE_EXIT(l); return JK_FALSE; } @@ -483,7 +485,7 @@ if (jk_b_append_byte(msg, SC_A_SECRET) || jk_b_append_string(msg, s->secret)) { jk_log(l, JK_LOG_ERROR, - "failed appending secret"); + "(%s) failed appending secret", ae->worker->name); JK_TRACE_EXIT(l); return JK_FALSE; } @@ -493,7 +495,7 @@ if (jk_b_append_byte(msg, SC_A_REMOTE_USER) || jk_b_append_string(msg, s->remote_user)) { jk_log(l, JK_LOG_ERROR, - "failed appending the remote user"); + "(%s) failed appending the remote user", ae->worker->name); JK_TRACE_EXIT(l); return JK_FALSE; } @@ -502,7 +504,7 @@ if (jk_b_append_byte(msg, SC_A_AUTH_TYPE) || jk_b_append_string(msg, s->auth_type)) { jk_log(l, JK_LOG_ERROR, - "failed appending the auth type"); + "(%s) failed appending the auth type", ae->worker->name); JK_TRACE_EXIT(l); return JK_FALSE; } @@ -515,8 +517,8 @@ jk_b_append_string(msg, s->query_string)) { #endif jk_log(l, JK_LOG_ERROR, - "failed appending the query string of length %u", - strlen(s->query_string)); + "(%s) failed appending the query string of length %u", + ae->worker->name, strlen(s->query_string)); JK_TRACE_EXIT(l); return JK_FALSE; } @@ -525,7 +527,7 @@ if (jk_b_append_byte(msg, SC_A_ROUTE) || jk_b_append_string(msg, s->route)) { jk_log(l, JK_LOG_ERROR, - "failed appending the route"); + "(%s) failed appending the route", ae->worker->name); JK_TRACE_EXIT(l); return JK_FALSE; } @@ -534,7 +536,7 @@ if (jk_b_append_byte(msg, SC_A_SSL_CERT) || jk_b_append_string(msg, s->ssl_cert)) { jk_log(l, JK_LOG_ERROR, - "failed appending the SSL certificates"); + "(%s) failed appending the SSL certificates", ae->worker->name); JK_TRACE_EXIT(l); return JK_FALSE; } @@ -544,7 +546,7 @@ if (jk_b_append_byte(msg, SC_A_SSL_CIPHER) || jk_b_append_string(msg, s->ssl_cipher)) { jk_log(l, JK_LOG_ERROR, - "failed appending the SSL ciphers"); + "(%s) failed appending the SSL ciphers", ae->worker->name); JK_TRACE_EXIT(l); return JK_FALSE; } @@ -553,7 +555,7 @@ if (jk_b_append_byte(msg, SC_A_SSL_SESSION) || jk_b_append_string(msg, s->ssl_session)) { jk_log(l, JK_LOG_ERROR, - "failed appending the SSL session"); + "(%s) failed appending the SSL session", ae->worker->name); JK_TRACE_EXIT(l); return JK_FALSE; } @@ -568,8 +570,8 @@ if (jk_b_append_byte(msg, SC_A_SSL_KEY_SIZE) || jk_b_append_int(msg, (unsigned short)s->ssl_key_size)) { jk_log(l, JK_LOG_ERROR, - "failed appending the SSL key size of length %d", - s->ssl_key_size); + "(%s) failed appending the SSL key size of length %d", + ae->worker->name, s->ssl_key_size); JK_TRACE_EXIT(l); return JK_FALSE; } @@ -578,11 +580,11 @@ /* If the method was unrecognized, encode it as an attribute */ if (method == SC_M_JK_STORED) { if (JK_IS_DEBUG_LEVEL(l)) - jk_log(l, JK_LOG_DEBUG, "unknown method %s", s->method); + jk_log(l, JK_LOG_DEBUG, "(%s) unknown method %s", ae->worker->name, s->method); if (jk_b_append_byte(msg, SC_A_STORED_METHOD) || jk_b_append_string(msg, s->method)) { jk_log(l, JK_LOG_ERROR, - "failed appending the request method"); + "(%s) failed appending the request method", ae->worker->name); JK_TRACE_EXIT(l); return JK_FALSE; } @@ -599,8 +601,8 @@ jk_b_append_string(msg, SC_A_REQ_REMOTE_PORT) || jk_b_append_string(msg, s->remote_port)) { jk_log(l, JK_LOG_ERROR, - "failed appending the remote port %s", - s->remote_port); + "(%s) failed appending the remote port %s", + ae->worker->name, s->remote_port); JK_TRACE_EXIT(l); return JK_FALSE; } @@ -615,8 +617,8 @@ jk_b_append_string(msg, SC_A_REQ_LOCAL_ADDR) || jk_b_append_string(msg, s->local_addr)) { jk_log(l, JK_LOG_ERROR, - "failed appending the local address %s", - s->local_addr); + "(s) failed appending the local address %s", + ae->worker->name, s->local_addr); JK_TRACE_EXIT(l); return JK_FALSE; } @@ -635,8 +637,8 @@ jk_b_append_string(msg, SC_A_JK_LB_ACTIVATION) || jk_b_append_string(msg, s->activation)) { jk_log(l, JK_LOG_ERROR, - "failed appending the activation state %s", - s->activation); + "(%s) failed appending the activation state %s", + ae->worker->name, s->activation); JK_TRACE_EXIT(l); return JK_FALSE; } @@ -647,8 +649,8 @@ jk_b_append_string(msg, s->attributes_names[i]) || jk_b_append_string(msg, s->attributes_values[i])) { jk_log(l, JK_LOG_ERROR, - "failed appending attribute %s=%s", - s->attributes_names[i], s->attributes_values[i]); + "(%s) failed appending attribute %s=%s", + ae->worker->name, s->attributes_names[i], s->attributes_values[i]); JK_TRACE_EXIT(l); return JK_FALSE; } @@ -657,13 +659,13 @@ if (jk_b_append_byte(msg, SC_A_ARE_DONE)) { jk_log(l, JK_LOG_ERROR, - "failed appending the message end"); + "(%s) failed appending the message end", ae->worker->name); JK_TRACE_EXIT(l); return JK_FALSE; } if (JK_IS_DEBUG_LEVEL(l)) - jk_log(l, JK_LOG_DEBUG, "ajp marshaling done"); + jk_log(l, JK_LOG_DEBUG, "(%s) ajp marshaling done", ae->worker->name); JK_TRACE_EXIT(l); return JK_TRUE; } @@ -705,7 +707,7 @@ d->status = jk_b_get_int(msg); if (!d->status) { jk_log(l, JK_LOG_ERROR, - "NULL status"); + "(%s) NULL status",ae->worker->name); JK_TRACE_EXIT(l); return JK_FALSE; } @@ -719,7 +721,7 @@ if (JK_IS_DEBUG_LEVEL(l)) jk_log(l, JK_LOG_DEBUG, - "status = %d", d->status); + "(%s) status = %d", ae->worker->name, d->status); d->num_headers = jk_b_get_int(msg); d->header_names = d->header_values = NULL; @@ -747,7 +749,7 @@ } else { jk_log(l, JK_LOG_ERROR, - "No such sc (%d)", name); + "(%s) No such sc (%d)", ae->worker->name, name); JK_TRACE_EXIT(l); return JK_FALSE; } @@ -756,7 +758,7 @@ d->header_names[i] = jk_b_get_string(msg); if (!d->header_names[i]) { jk_log(l, JK_LOG_ERROR, - "NULL header name"); + "(%s) NULL header name", ae->worker->name); JK_TRACE_EXIT(l); return JK_FALSE; } @@ -770,7 +772,7 @@ d->header_values[i] = jk_b_get_string(msg); if (!d->header_values[i]) { jk_log(l, JK_LOG_ERROR, - "NULL header value"); + "(%s) NULL header value", ae->worker->name); JK_TRACE_EXIT(l); return JK_FALSE; } @@ -782,8 +784,8 @@ if (JK_IS_DEBUG_LEVEL(l)) jk_log(l, JK_LOG_DEBUG, - "Header[%d] [%s] = [%s]", - i, d->header_names[i], d->header_values[i]); + "(%s) Header[%d] [%s] = [%s]", + ae->worker->name, i, d->header_names[i], d->header_values[i]); } } } @@ -798,6 +800,11 @@ static void ajp_abort_endpoint(ajp_endpoint_t * ae, int shutdown, jk_logger_t *l) { JK_TRACE_ENTER(l); + + if (JK_IS_DEBUG_LEVEL(l)) + jk_log(l, JK_LOG_DEBUG, + "(%s) aborting endpoint with socket %d", + ae->worker->name, ae->sd); if (shutdown == JK_TRUE && IS_VALID_SOCKET(ae->sd)) { if (ae->hard_close) { /* Force unclean connection close to communicate client write errors @@ -923,13 +930,15 @@ msg = jk_b_new(&ae->pool); if (!msg) { jk_log(l, JK_LOG_ERROR, - "Failed allocating AJP message"); + "(%s) Failed allocating AJP message", + ae->worker->name); JK_TRACE_EXIT(l); return JK_FALSE; } if (jk_b_set_buffer_size(msg, 16)) { jk_log(l, JK_LOG_ERROR, - "Failed allocating AJP message buffer"); + "(%s) Failed allocating AJP message buffer", + ae->worker->name); JK_TRACE_EXIT(l); return JK_FALSE; } @@ -940,7 +949,8 @@ */ if (ajp_connection_tcp_send_message(ae, msg, l) != JK_TRUE) { jk_log(l, JK_LOG_INFO, - "can't send cping query"); + "(%s) can't send cping query", + ae->worker->name); JK_TRACE_EXIT(l); return JK_FALSE; } @@ -950,7 +960,8 @@ */ if (jk_is_input_event(ae->sd, timeout, l) == JK_FALSE) { ae->last_errno = errno; - jk_log(l, JK_LOG_INFO, "timeout in reply cpong"); + jk_log(l, JK_LOG_INFO, "(%s) timeout in reply cpong after %d ms. Socket = %d (event=%d)", + ae->worker->name, timeout, ae->sd, errno); /* We can't trust this connection any more. */ ajp_abort_endpoint(ae, JK_TRUE, l); @@ -962,7 +973,8 @@ */ if (ajp_connection_tcp_get_message(ae, msg, l) != JK_TRUE) { jk_log(l, JK_LOG_INFO, - "awaited reply cpong, not received"); + "(%s) awaited reply cpong, not received", + ae->worker->name); JK_TRACE_EXIT(l); return JK_FALSE; } @@ -979,9 +991,9 @@ cmd < JK_AJP13_SEND_BODY_CHUNK || cmd > AJP13_CPONG_REPLY) { jk_log(l, JK_LOG_WARNING, - "awaited reply cpong, received %d instead. " + "(%s) awaited reply cpong, received %d instead. " "Closing connection", - cmd); + ae->worker->name, cmd); /* We can't trust this connection any more. */ ajp_abort_endpoint(ae, JK_TRUE, l); @@ -990,9 +1002,9 @@ } else { jk_log(l, JK_LOG_INFO, - "awaited reply cpong, received %d instead. " + "(%s) awaited reply cpong, received %d instead. " "Retrying next packet", - cmd); + ae->worker->name, cmd); } } @@ -1033,8 +1045,8 @@ if (!IS_VALID_SOCKET(ae->sd)) { ae->last_errno = errno; jk_log(l, JK_LOG_INFO, - "Failed opening socket to (%s) (errno=%d)", - jk_dump_hinfo(&ae->worker->worker_inet_addr, buf), ae->last_errno); + "(%s)Failed opening socket to (%s) (errno=%d)", + ae->worker->name, jk_dump_hinfo(&ae->worker->worker_inet_addr, buf), ae->last_errno); JK_TRACE_EXIT(l); return JK_FALSE; } @@ -1254,8 +1266,8 @@ } ae->last_errno = errno; jk_log(l, JK_LOG_INFO, - "sendfull for socket %d returned %d (errno=%d)", - ae->sd, rc, ae->last_errno); + "(%s) sendfull for socket %d returned %d (errno=%d)", + ae->worker->name, ae->sd, rc, ae->last_errno); ajp_abort_endpoint(ae, JK_FALSE, l); JK_TRACE_EXIT(l); return JK_FALSE; @@ -1322,13 +1334,13 @@ if (header == AJP14_SW_HEADER) { jk_log(l, JK_LOG_ERROR, - "received AJP14 reply on an AJP13 connection from %s", - jk_dump_hinfo(&ae->worker->worker_inet_addr, buf)); + "(%s) received AJP14 reply on an AJP13 connection from %s", + ae->worker->name, jk_dump_hinfo(&ae->worker->worker_inet_addr, buf)); } else { jk_log(l, JK_LOG_ERROR, - "wrong message format 0x%04x from %s", - header, jk_dump_hinfo(&ae->worker->worker_inet_addr, + "(%s) wrong message format 0x%04x from %s", + ae->worker->name, header, jk_dump_hinfo(&ae->worker->worker_inet_addr, buf)); } /* We've got a protocol error. @@ -1344,13 +1356,13 @@ if (header == AJP13_SW_HEADER) { jk_log(l, JK_LOG_ERROR, - "received AJP13 reply on an AJP14 connection from %s", - jk_dump_hinfo(&ae->worker->worker_inet_addr, buf)); + "(%s) received AJP13 reply on an AJP14 connection from %s", + ae->worker->name, jk_dump_hinfo(&ae->worker->worker_inet_addr, buf)); } else { jk_log(l, JK_LOG_ERROR, - "wrong message format 0x%04x from %s", - header, jk_dump_hinfo(&ae->worker->worker_inet_addr, + "(%s) wrong message format 0x%04x from %s", + ae->worker->name, header, jk_dump_hinfo(&ae->worker->worker_inet_addr, buf)); } /* We've got a protocol error. @@ -1367,8 +1379,8 @@ if (msglen > msg->maxlen) { jk_log(l, JK_LOG_ERROR, - "wrong message size %d %d from %s", - msglen, msg->maxlen, + "(%s) wrong message size %d %d from %s", + ae->worker->name, msglen, msg->maxlen, jk_dump_hinfo(&ae->worker->worker_inet_addr, buf)); /* We've got a protocol error. * We can't trust this connection any more. @@ -1525,7 +1537,7 @@ */ if (0 != jk_b_append_int(msg, (unsigned short)len)) { jk_log(l, JK_LOG_INFO, - "Failed appending message length"); + "(%s) Failed appending message length", ae->worker->name); JK_TRACE_EXIT(l); return JK_CLIENT_RD_ERROR; } @@ -1761,8 +1773,8 @@ } else { if (JK_IS_DEBUG_LEVEL(l)) - jk_log(l, JK_LOG_DEBUG, "Resent the request body (%d)", - postlen); + jk_log(l, JK_LOG_DEBUG, "(%s) Resent the request body (%d)", + ae->worker->name, postlen); } } else if (s->reco_status == RECO_FILLED) { @@ -1789,7 +1801,7 @@ else { if (JK_IS_DEBUG_LEVEL(l)) jk_log(l, JK_LOG_DEBUG, - "Resent the request body (lb mode) (%d)", postlen); + "(%s) Resent the request body (lb mode) (%d)", ae->worker->name, postlen); } } else { @@ -1881,14 +1893,14 @@ */ if (JK_IS_DEBUG_LEVEL(l)) { jk_log(l, JK_LOG_DEBUG, - "Already received AJP13_SEND HEADERS"); + "(%s) Already received AJP13_SEND HEADERS", ae->worker->name); } JK_TRACE_EXIT(l); return JK_AJP13_ERROR; } if (!ajp_unmarshal_response(msg, &res, ae, l)) { jk_log(l, JK_LOG_ERROR, - "ajp_unmarshal_response failed"); + "(%s) ajp_unmarshal_response failed", ae->worker->name); JK_TRACE_EXIT(l); return JK_AJP13_ERROR; } @@ -1896,14 +1908,16 @@ char **old_names = res.header_names; char **old_values = res.header_values; if (JK_IS_DEBUG_LEVEL(l)) - jk_log(l, JK_LOG_DEBUG, "Adding %d response headers to %d headers received from tomcat", r->num_resp_headers, res.num_headers); + jk_log(l, JK_LOG_DEBUG, "(%s) Adding %d response headers to %d headers received from tomcat", + ae->worker->name, r->num_resp_headers, res.num_headers); res.header_names = jk_pool_alloc(r->pool, (r->num_resp_headers + res.num_headers) * sizeof(char *)); res.header_values = jk_pool_alloc(r->pool, (r->num_resp_headers + res.num_headers) * sizeof(char *)); if (!res.header_names || !res.header_values) { jk_log(l, JK_LOG_ERROR, - "Failed allocating one %d response headers.", r->num_resp_headers + res.num_headers); + "(%s) Failed allocating one %d response headers.", + ae->worker->name, r->num_resp_headers + res.num_headers); res.header_names = old_names; res.header_values = old_values; } else { @@ -1966,7 +1980,8 @@ */ if (jk_b_get_int(msg) == 0) { jk_log(l, JK_LOG_DEBUG, - "Ignoring flush message received while sending the request"); + "(%s) Ignoring flush message received while sending the request", + ae->worker->name); return ae->last_op; } /* We have just send a request but received something @@ -1974,7 +1989,8 @@ */ if (JK_IS_DEBUG_LEVEL(l)) { jk_log(l, JK_LOG_DEBUG, - "Unexpected AJP13_SEND_BODY_CHUNK"); + "(%s) Unexpected AJP13_SEND_BODY_CHUNK", + ae->worker->name); } JK_TRACE_EXIT(l); return JK_AJP13_ERROR; @@ -1992,8 +2008,8 @@ */ if (len > (unsigned int)(msg->len - 3)) { jk_log(l, JK_LOG_ERROR, - "Chunk length too large. Length of AJP message is %d," - " chunk length is %d.", msg->len, len); + "(%s) Chunk length too large. Length of AJP message is %d," + " chunk length is %d.", ae->worker->name, msg->len, len); JK_TRACE_EXIT(l); return JK_INTERNAL_ERROR; } @@ -2008,13 +2024,15 @@ } else { jk_log(l, JK_LOG_DEBUG, - "Ignoring flush message received before headers"); + "(%s) Ignoring flush message received before headers", + ae->worker->name); } } else { if (!r->write(r, msg->buf + msg->pos, len)) { jk_log(l, JK_LOG_INFO, - "Writing to client aborted or client network problems"); + "(%s) Writing to client aborted or client network problems", + ae->worker->name); JK_TRACE_EXIT(l); return JK_CLIENT_WR_ERROR; } @@ -2041,7 +2059,8 @@ } jk_log(l, JK_LOG_INFO, - "Reading from client aborted or client network problems"); + "(%s) Reading from client aborted or client network problems", + ae->worker->name); JK_TRACE_EXIT(l); return JK_CLIENT_RD_ERROR; @@ -2055,11 +2074,13 @@ * AJP13 protocol reuse flag set to false. * Tomcat will close its side of the connection. */ - jk_log(l, JK_LOG_WARNING, "AJP13 protocol: Reuse is set to false"); + jk_log(l, JK_LOG_WARNING, "(%s) AJP13 protocol: Reuse is set to false", + ae->worker->name); } else if (r->disable_reuse) { if (JK_IS_DEBUG_LEVEL(l)) { - jk_log(l, JK_LOG_DEBUG, "AJP13 protocol: Reuse is disabled"); + jk_log(l, JK_LOG_DEBUG, "(%s) AJP13 protocol: Reuse is disabled", + ae->worker->name); } ae->reuse = JK_FALSE; } @@ -2067,7 +2088,8 @@ /* Reuse in all cases */ if (JK_IS_DEBUG_LEVEL(l)) { - jk_log(l, JK_LOG_DEBUG, "AJP13 protocol: Reuse is OK"); + jk_log(l, JK_LOG_DEBUG, "(%s) AJP13 protocol: Reuse is OK", + ae->worker->name); } ae->reuse = JK_TRUE; } @@ -2089,7 +2111,7 @@ default: jk_log(l, JK_LOG_ERROR, - "Unknown AJP protocol code: %02X", code); + "(%s) Unknown AJP protocol code: %02X", ae->worker->name, code); JK_TRACE_EXIT(l); return JK_AJP13_ERROR; } @@ -2445,13 +2467,13 @@ op->request = jk_b_new(&(p->pool)); if (!op->request) { jk_log(l, JK_LOG_ERROR, - "Failed allocating AJP message"); + "(%s) Failed allocating AJP message",aw->name); JK_TRACE_EXIT(l); return JK_SERVER_ERROR; } if (jk_b_set_buffer_size(op->request, aw->max_packet_size)) { jk_log(l, JK_LOG_ERROR, - "Failed allocating AJP message buffer"); + "(%s) Failed allocating AJP message buffer", aw->name); JK_TRACE_EXIT(l); return JK_SERVER_ERROR; } @@ -2460,13 +2482,13 @@ op->reply = jk_b_new(&(p->pool)); if (!op->reply) { jk_log(l, JK_LOG_ERROR, - "Failed allocating AJP message"); + "(%s) Failed allocating AJP message", aw->name); JK_TRACE_EXIT(l); return JK_SERVER_ERROR; } if (jk_b_set_buffer_size(op->reply, aw->max_packet_size)) { jk_log(l, JK_LOG_ERROR, - "Failed allocating AJP message buffer"); + "(%s) Failed allocating AJP message buffer", aw->name); JK_TRACE_EXIT(l); return JK_SERVER_ERROR; } @@ -2474,13 +2496,13 @@ op->post = jk_b_new(&(p->pool)); if (!op->post) { jk_log(l, JK_LOG_ERROR, - "Failed allocating AJP message"); + "(%s) Failed allocating AJP message", aw->name); JK_TRACE_EXIT(l); return JK_SERVER_ERROR; } if (jk_b_set_buffer_size(op->post, aw->max_packet_size)) { jk_log(l, JK_LOG_ERROR, - "Failed allocating AJP message buffer"); + "(%s) Failed allocating AJP message buffer", aw->name); JK_TRACE_EXIT(l); return JK_SERVER_ERROR; } @@ -2505,8 +2527,8 @@ if (!ajp_marshal_into_msgb(op->request, s, l, p)) { *is_error = JK_HTTP_REQUEST_TOO_LARGE; jk_log(l, JK_LOG_INFO, - "Creating AJP message failed " - "without recovery - check max_packet_size"); + "(%s) Creating AJP message failed " + "without recovery - check max_packet_size", aw->name); aw->s->client_errors++; JK_TRACE_EXIT(l); return JK_CLIENT_ERROR; @@ -2536,8 +2558,8 @@ if (i > 0 && retry_interval >= 0) { if (JK_IS_DEBUG_LEVEL(l)) jk_log(l, JK_LOG_DEBUG, - "retry %d, sleeping for %d ms before retrying", - i, retry_interval); + "(%s) retry %d, sleeping for %d ms before retrying", + aw->name, i, retry_interval); jk_sleep(retry_interval); /* Pull shared memory if something changed during sleep */ @@ -2704,13 +2726,13 @@ */ ajp_next_connection(p, l); } + ajp_update_stats(e, aw, rc, l); /* Log the error only once per failed request. */ jk_log(l, JK_LOG_ERROR, - "(%s) connecting to tomcat failed.", - aw->name); + "(%s) connecting to tomcat failed (rc=%d, errors=%d, client_errors=%d).", + aw->name,rc,aw->s->errors,aw->s->client_errors); - ajp_update_stats(e, aw, rc, l); JK_TRACE_EXIT(l); return rc; } @@ -2736,8 +2758,15 @@ host = AJP14_DEF_HOST; } else { - jk_log(l, JK_LOG_ERROR, - "unknown protocol %d", proto); + if (pThis && pThis->worker_private) { + ajp_worker_t *p = pThis->worker_private; + jk_log(l, JK_LOG_ERROR, + "(%s) unknown protocol %d", p->name, proto); + } + else { + jk_log(l, JK_LOG_ERROR, + "(Worker not set, unknown protocol %d", proto); + } JK_TRACE_EXIT(l); return JK_FALSE; } @@ -2816,14 +2845,14 @@ } if (JK_IS_DEBUG_LEVEL(l)) jk_log(l, JK_LOG_DEBUG, - "setting connection pool size to %u with min %u and acquire timeout %d", - p->ep_cache_sz, p->ep_mincache_sz, p->cache_acquire_timeout); + "(%s) setting connection pool size to %u with min %u and acquire timeout %d", + p->name, p->ep_cache_sz, p->ep_mincache_sz, p->cache_acquire_timeout); for (i = 0; i < p->ep_cache_sz; i++) { p->ep_cache[i] = (ajp_endpoint_t *)calloc(1, sizeof(ajp_endpoint_t)); if (!p->ep_cache[i]) { jk_log(l, JK_LOG_ERROR, - "allocating endpoint slot %d (errno=%d)", - i, errno); + "(%s) allocating endpoint slot %d (errno=%d)", + p->name, i, errno); JK_TRACE_EXIT(l); return JK_FALSE; } @@ -2942,8 +2971,8 @@ if (p->retries < 1) { jk_log(l, JK_LOG_INFO, - "number of retries must be greater then 1. Setting to default=%d", - JK_RETRIES); + "(%s) number of retries must be greater then 1. Setting to default=%d", + p->name, JK_RETRIES); p->retries = JK_RETRIES; } @@ -2953,8 +2982,9 @@ if (JK_IS_DEBUG_LEVEL(l)) { jk_log(l, JK_LOG_DEBUG, - "setting endpoint options:", - p->keepalive); + "(%s) setting endpoint options:", + p->name); + jk_log(l, JK_LOG_DEBUG, "keepalive: %d", p->keepalive); @@ -3014,8 +3044,8 @@ p->secret = jk_get_worker_secret(props, p->name); if (!ajp_create_endpoint_cache(p, proto, l)) { jk_log(l, JK_LOG_ERROR, - "allocating connection pool of size %u", - p->ep_cache_sz); + "(%s) allocating connection pool of size %u", + p->name, p->ep_cache_sz); JK_TRACE_EXIT(l); return JK_FALSE; } @@ -3045,7 +3075,7 @@ aw = (ajp_worker_t *) calloc(1, sizeof(ajp_worker_t)); if (!aw) { jk_log(l, JK_LOG_ERROR, - "malloc of private_data failed"); + "(%s) malloc of private_data failed", name); JK_TRACE_EXIT(l); return JK_FALSE; } @@ -3073,15 +3103,15 @@ jk_close_pool(&aw->p); free(aw); jk_log(l, JK_LOG_ERROR, - "allocating ajp worker record from shared memory"); + "(%s) allocating ajp worker record from shared memory", aw->name); JK_TRACE_EXIT(l); return JK_FALSE; } JK_INIT_CS(&aw->cs, rc); if (!rc) { jk_log(l, JK_LOG_ERROR, - "creating thread lock (errno=%d)", - errno); + "(%s) creating thread lock (errno=%d)", + aw->name, errno); jk_close_pool(&aw->p); free(aw); JK_TRACE_EXIT(l); @@ -3105,8 +3135,8 @@ if (JK_IS_DEBUG_LEVEL(l)) jk_log(l, JK_LOG_DEBUG, - "up to %u endpoints to close", - aw->ep_cache_sz); + "(%s) up to %u endpoints to close", + aw->name, aw->ep_cache_sz); for (i = 0; i < aw->ep_cache_sz; i++) { if (aw->ep_cache[i]) @@ -3204,7 +3234,7 @@ ae->avail = JK_TRUE; ae = NULL; jk_log(l, JK_LOG_WARNING, - "closing non reusable pool slot=%d", slot); + "(%s) closing non reusable pool slot=%d", aw->name, slot); } } } @@ -3227,8 +3257,8 @@ *je = &ae->endpoint; if (JK_IS_DEBUG_LEVEL(l)) jk_log(l, JK_LOG_DEBUG, - "acquired connection pool slot=%u after %d retries", - slot, retry); + "(%s) acquired connection pool slot=%u after %d retries", + aw->name, slot, retry); JK_TRACE_EXIT(l); return JK_TRUE; } @@ -3325,15 +3355,15 @@ ajp_reset_endpoint(aw->ep_cache[i], l); if (JK_IS_DEBUG_LEVEL(l)) jk_log(l, JK_LOG_DEBUG, - "cleaning pool slot=%d elapsed %d in %d", - i, elapsed, (int)(difftime(time(NULL), rt))); + "(%s) cleaning pool slot=%d elapsed %d in %d", + aw->name, i, elapsed, (int)(difftime(time(NULL), rt))); } } if (cnt <= aw->ep_mincache_sz + n) { if (JK_IS_DEBUG_LEVEL(l)) { jk_log(l, JK_LOG_DEBUG, - "reached pool min size %u from %u cache slots", - aw->ep_mincache_sz, aw->ep_cache_sz); + "(%s) reached pool min size %u from %u cache slots", + aw->name, aw->ep_mincache_sz, aw->ep_cache_sz); } break; } @@ -3357,7 +3387,7 @@ jk_log(l, JK_LOG_INFO, "(%s) failed sending request, " "socket %d keepalive cping/cpong " - "failure (errno=%d)", + "failure (errno/event=%d)", aw->name, aw->ep_cache[i]->sd, aw->ep_cache[i]->last_errno); @@ -3388,13 +3418,13 @@ free(m_sock); if (n && JK_IS_DEBUG_LEVEL(l)) jk_log(l, JK_LOG_DEBUG, - "recycled %u sockets in %d seconds from %u pool slots", - n, (int)(difftime(time(NULL), mstarted)), + "(%s) recycled %u sockets in %d seconds from %u pool slots", + aw->name, n, (int)(difftime(time(NULL), mstarted)), aw->ep_cache_sz); if (k && JK_IS_DEBUG_LEVEL(l)) jk_log(l, JK_LOG_DEBUG, - "pinged %u sockets in %d seconds from %u pool slots", - k, (int)(difftime(time(NULL), mstarted)), + "(%s) pinged %u sockets in %d seconds from %u pool slots", + aw->name, k, (int)(difftime(time(NULL), mstarted)), aw->ep_cache_sz); JK_TRACE_EXIT(l); return JK_TRUE;