cvs commit: jakarta-tomcat-connectors/jk/native/common jk_ajp_common.c jk_connect.c jk_connect.h
mturk 2005/04/21 04:36:29 Modified:jk/native/common jk_ajp_common.c jk_connect.c jk_connect.h Log: Remove unused timeout parameter for testing if socket is connected. Revision ChangesPath 1.98 +3 -3 jakarta-tomcat-connectors/jk/native/common/jk_ajp_common.c Index: jk_ajp_common.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_ajp_common.c,v retrieving revision 1.97 retrieving revision 1.98 diff -u -r1.97 -r1.98 --- jk_ajp_common.c 21 Apr 2005 11:18:44 - 1.97 +++ jk_ajp_common.c 21 Apr 2005 11:36:29 - 1.98 @@ -847,7 +847,7 @@ if (ae-worker-cache_timeout 0 || ae-worker-recycle_timeout 0) ae-last_access = time(NULL); if (ae-worker-socket_timeout 0) { -if (!jk_is_socket_connected(ae-sd, ae-worker-socket_timeout)) { +if (!jk_is_socket_connected(ae-sd)) { jk_log(l, JK_LOG_INFO, Socket is not connected any more (errno=%d), errno); jk_close_socket(ae-sd); @@ -1160,7 +1160,7 @@ while ((ae-sd 0)) { err = 0; if (ae-worker-socket_timeout) { -if (!jk_is_socket_connected(ae-sd, ae-worker-socket_timeout)) { +if (!jk_is_socket_connected(ae-sd)) { jk_log(l, JK_LOG_INFO, Socket is not connected any more (errno=%d), errno); jk_close_socket(ae-sd); 1.53 +2 -8 jakarta-tomcat-connectors/jk/native/common/jk_connect.c Index: jk_connect.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_connect.c,v retrieving revision 1.52 retrieving revision 1.53 diff -u -r1.52 -r1.53 --- jk_connect.c 13 Apr 2005 11:12:38 - 1.52 +++ jk_connect.c 21 Apr 2005 11:36:29 - 1.53 @@ -548,18 +548,12 @@ return buf; } -int jk_is_socket_connected(int sd, int timeout) +int jk_is_socket_connected(int sd) { fd_set fd; struct timeval tv; int rc; -/* socket_timeout is unused in select implemention - * If we change this to non blocking read, then we - * will use the timeout parameter. - */ - timeout = 0; - FD_ZERO(fd); FD_SET(sd, fd); 1.14 +2 -2 jakarta-tomcat-connectors/jk/native/common/jk_connect.h Index: jk_connect.h === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_connect.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- jk_connect.h 17 Feb 2005 07:09:27 - 1.13 +++ jk_connect.h 21 Apr 2005 11:36:29 - 1.14 @@ -51,7 +51,7 @@ char *jk_dump_hinfo(struct sockaddr_in *saddr, char *buf); -int jk_is_socket_connected(int sd, int timeout); +int jk_is_socket_connected(int sd); #ifdef __cplusplus } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/jk/native/common jk_ajp_common.c jk_connect.c
mturk 2005/02/19 01:13:35 Modified:jk/native/common jk_ajp_common.c jk_connect.c Log: Use alternative is_socket_connected implementation using select with 1 microsecond timeout. It should be both faster and usable on netware too. Revision ChangesPath 1.91 +7 -9 jakarta-tomcat-connectors/jk/native/common/jk_ajp_common.c Index: jk_ajp_common.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_ajp_common.c,v retrieving revision 1.90 retrieving revision 1.91 diff -u -r1.90 -r1.91 --- jk_ajp_common.c 18 Feb 2005 08:27:21 - 1.90 +++ jk_ajp_common.c 19 Feb 2005 09:13:35 - 1.91 @@ -847,10 +847,9 @@ if (ae-worker-cache_timeout 0 || ae-worker-recycle_timeout 0) ae-last_access = time(NULL); if (ae-worker-socket_timeout 0) { -int rc = 0; -if ((rc = jk_is_socket_connected(ae-sd, ae-worker-socket_timeout)) != 1) { -jk_log(l, JK_LOG_INFO, -Socket is not connected any more (status=%d), rc); +if (!jk_is_socket_connected(ae-sd, ae-worker-socket_timeout)) { +jk_log(l, JK_LOG_INFO, + Socket is not connected any more (errno=%d), errno); jk_close_socket(ae-sd); ae-sd = -1; JK_TRACE_EXIT(l); @@ -1161,10 +1160,9 @@ while ((ae-sd 0)) { err = 0; if (ae-worker-socket_timeout) { -int rc = 0; -if ((rc = jk_is_socket_connected(ae-sd, ae-worker-socket_timeout)) != 1) { -jk_log(l, JK_LOG_INFO, - Socket is not connected any more (status=%d), rc); +if (!jk_is_socket_connected(ae-sd, ae-worker-socket_timeout)) { +jk_log(l, JK_LOG_INFO, + Socket is not connected any more (errno=%d), errno); jk_close_socket(ae-sd); ae-sd = -1; err++; 1.43 +48 -2 jakarta-tomcat-connectors/jk/native/common/jk_connect.c Index: jk_connect.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_connect.c,v retrieving revision 1.42 retrieving revision 1.43 diff -u -r1.42 -r1.43 --- jk_connect.c 17 Feb 2005 08:26:42 - 1.42 +++ jk_connect.c 19 Feb 2005 09:13:35 - 1.43 @@ -194,18 +194,36 @@ sock_buf); } -#ifdef WIN32 if (timeout 0) { +#ifdef WIN32 timeout = timeout * 1000; setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (char *) timeout, sizeof(int)); setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (char *) timeout, sizeof(int)); +#else +/* TODO: How to set the timeout for other platforms? */ +#endif if (JK_IS_DEBUG_LEVEL(l)) jk_log(l, JK_LOG_DEBUG, timeout %d set for socket=%d, timeout, sock); } +#ifdef SO_NOSIGPIPE +/* The preferred method on Mac OS X (10.2 and later) to prevent SIGPIPEs when + * sending data to a dead peer. Possibly also existing and in use on other BSD + * systems? +*/ +set = 1; +if (setsockopt(sd, SOL_SOCKET, SO_NOSIGPIPE, (const char *)set, + sizeof(int))) { +JK_GET_SOCKET_ERRNO(); +jk_log(l, JK_LOG_ERROR, +failed setting SO_NOSIGPIPE with errno=%d, errno); +jk_close_socket(sock); +JK_TRACE_EXIT(l); +return -1; +} #endif /* Tries to connect to Tomcat (continues trying while error is EINTR) */ do { @@ -405,6 +423,32 @@ return 0; } +#if 1 +int jk_is_socket_connected(int sd, int timeout) +{ +fd_set fd; +struct timeval tv; + +FD_ZERO(fd); +FD_SET(sd, fd); + +/* Wait one microsecond */ +tv.tv_sec = 0; +tv.tv_usec = 1; + +/* If we get a timeout, then we are still connected */ +if (select(1, fd, NULL, NULL, tv) == 0) +return 1; +else { +#if defined(WIN32) || (defined(NETWARE) defined(__NOVELL_LIBC__)) +errno = WSAGetLastError() - WSABASEERR; +#endif +return 0; +} +} + +#else + #if defined(WIN32) || (defined(NETWARE) defined(__NOVELL_LIBC__)) #define EWOULDBLOCK (WSAEWOULDBLOCK - WSABASEERR) #endif @@ -434,3 +478,5 @@ else return rc; } + +#endif - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-connectors/jk/native/common jk_ajp_common.c jk_connect.c
Greetings, Will see... :-) N. [EMAIL PROTECTED] wrote: mturk 2005/02/19 01:13:35 Modified:jk/native/common jk_ajp_common.c jk_connect.c Log: Use alternative is_socket_connected implementation using select with 1 microsecond timeout. It should be both faster and usable on netware too. Revision ChangesPath 1.91 +7 -9 jakarta-tomcat-connectors/jk/native/common/jk_ajp_common.c Index: jk_ajp_common.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_ajp_common.c,v retrieving revision 1.90 retrieving revision 1.91 diff -u -r1.90 -r1.91 --- jk_ajp_common.c 18 Feb 2005 08:27:21 - 1.90 +++ jk_ajp_common.c 19 Feb 2005 09:13:35 - 1.91 @@ -847,10 +847,9 @@ if (ae-worker-cache_timeout 0 || ae-worker-recycle_timeout 0) ae-last_access = time(NULL); if (ae-worker-socket_timeout 0) { -int rc = 0; -if ((rc = jk_is_socket_connected(ae-sd, ae-worker-socket_timeout)) != 1) { -jk_log(l, JK_LOG_INFO, -Socket is not connected any more (status=%d), rc); +if (!jk_is_socket_connected(ae-sd, ae-worker-socket_timeout)) { +jk_log(l, JK_LOG_INFO, + Socket is not connected any more (errno=%d), errno); jk_close_socket(ae-sd); ae-sd = -1; JK_TRACE_EXIT(l); @@ -1161,10 +1160,9 @@ while ((ae-sd 0)) { err = 0; if (ae-worker-socket_timeout) { -int rc = 0; -if ((rc = jk_is_socket_connected(ae-sd, ae-worker-socket_timeout)) != 1) { -jk_log(l, JK_LOG_INFO, - Socket is not connected any more (status=%d), rc); +if (!jk_is_socket_connected(ae-sd, ae-worker-socket_timeout)) { +jk_log(l, JK_LOG_INFO, + Socket is not connected any more (errno=%d), errno); jk_close_socket(ae-sd); ae-sd = -1; err++; 1.43 +48 -2 jakarta-tomcat-connectors/jk/native/common/jk_connect.c Index: jk_connect.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_connect.c,v retrieving revision 1.42 retrieving revision 1.43 diff -u -r1.42 -r1.43 --- jk_connect.c 17 Feb 2005 08:26:42 - 1.42 +++ jk_connect.c 19 Feb 2005 09:13:35 - 1.43 @@ -194,18 +194,36 @@ sock_buf); } -#ifdef WIN32 if (timeout 0) { +#ifdef WIN32 timeout = timeout * 1000; setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (char *) timeout, sizeof(int)); setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (char *) timeout, sizeof(int)); +#else +/* TODO: How to set the timeout for other platforms? */ +#endif if (JK_IS_DEBUG_LEVEL(l)) jk_log(l, JK_LOG_DEBUG, timeout %d set for socket=%d, timeout, sock); } +#ifdef SO_NOSIGPIPE +/* The preferred method on Mac OS X (10.2 and later) to prevent SIGPIPEs when + * sending data to a dead peer. Possibly also existing and in use on other BSD + * systems? +*/ +set = 1; +if (setsockopt(sd, SOL_SOCKET, SO_NOSIGPIPE, (const char *)set, + sizeof(int))) { +JK_GET_SOCKET_ERRNO(); +jk_log(l, JK_LOG_ERROR, +failed setting SO_NOSIGPIPE with errno=%d, errno); +jk_close_socket(sock); +JK_TRACE_EXIT(l); +return -1; +} #endif /* Tries to connect to Tomcat (continues trying while error is EINTR) */ do { @@ -405,6 +423,32 @@ return 0; } +#if 1 +int jk_is_socket_connected(int sd, int timeout) +{ +fd_set fd; +struct timeval tv; + +FD_ZERO(fd); +FD_SET(sd, fd); + +/* Wait one microsecond */ +tv.tv_sec = 0; +tv.tv_usec = 1; + +/* If we get a timeout, then we are still connected */ +if (select(1, fd, NULL, NULL, tv) == 0) +return 1; +else { +#if defined(WIN32) || (defined(NETWARE) defined(__NOVELL_LIBC__)) +errno = WSAGetLastError() - WSABASEERR; +#endif +return 0; +} +} + +#else + #if defined(WIN32) || (defined(NETWARE) defined(__NOVELL_LIBC__)) #define EWOULDBLOCK (WSAEWOULDBLOCK - WSABASEERR) #endif @@ -434,3 +478,5 @@ else return rc; } + +#endif - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL
Re: cvs commit: jakarta-tomcat-connectors/jk/native/common jk_ajp_common.c jk_connect.c
Good evening, Can confirm a clean build for 2.1 and 2.0.53 Apache. Time is short now but will test them for basic ops in the morning. I assume these still need the socket_timeout at zero? Regards, Norm - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-connectors/jk/native/common jk_ajp_common.c jk_connect.c
NormW wrote: Good evening, Can confirm a clean build for 2.1 and 2.0.53 Apache. Time is short now but will test them for basic ops in the morning. I assume these still need the socket_timeout at zero? Well, new is_socket_connected implementation should be available for netware too (that was the purpose after all). Tell me if it works when you set the socket_timeout to a positive value. Regards, Mladen. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-connectors/jk/native/common jk_ajp_common.c jk_connect.c
Hi again... Mladen Turk wrote: NormW wrote: Good evening, Can confirm a clean build for 2.1 and 2.0.53 Apache. Time is short now but will test them for basic ops in the morning. I assume these still need the socket_timeout at zero? Well, new is_socket_connected implementation should be available for netware too (that was the purpose after all). Tell me if it works when you set the socket_timeout to a positive value. Okay - there is time enough to try in the morning and there will be a message shortly thereafter... Regards, Mladen. Norm - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-connectors/jk/native/common jk_ajp_common.c jk_connect.c
Good morning, AFAICT this is working fine with a socket timeout of 15. Neither /server-info/ or /status/ show the setting in use, but 15 is what's in the properties file and /server-info/ says that's the file in use. Regards, Norm Mladen Turk wrote: NormW wrote: Good evening, Can confirm a clean build for 2.1 and 2.0.53 Apache. Time is short now but will test them for basic ops in the morning. I assume these still need the socket_timeout at zero? Well, new is_socket_connected implementation should be available for netware too (that was the purpose after all). Tell me if it works when you set the socket_timeout to a positive value. Regards, Mladen. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] . - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cvs commit: jakarta-tomcat-connectors/jk/native/common jk_ajp_common.c jk_connect.c
Glenn Nielsen wrote: Costin, Why were the log levels changed from LOG_ERROR to LOG_INFO, a connection failure to tomct is a real fatal error when handling a request. Shouldn't it be at the JK_LOG_ERROR level? It'll be logged at ERROR level - +jk_log(l, JK_LOG_ERROR, Error connecting to tomcat. Tomcat is probably not started or is listenning on the wrong port. Failed errno = %d\n, errno); + ( instead of the Can't find servlet handler :-) I just limited the number of messages that are logged at ERROR level for each failed connection, you should see a single error message. If you want more verbosity - you'll get it as info. Costin Regards, Glenn [EMAIL PROTECTED] wrote: costin 2002/10/30 14:12:20 Modified:jk/native/common jk_ajp_common.c jk_connect.c Log: More trimming for error messages. Now only one line ( and hopefully more informative ) is displayed if we can't send the request to tomcat. Revision ChangesPath 1.32 +11 -5 jakarta-tomcat-connectors/jk/native/common/jk_ajp_common.c Index: jk_ajp_common.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_ajp_common.c,v retrieving revision 1.31 retrieving revision 1.32 diff -u -r1.31 -r1.32 --- jk_ajp_common.c30 Oct 2002 21:17:34 - 1.31 +++ jk_ajp_common.c30 Oct 2002 22:12:20 - 1.32 @@ -623,7 +623,9 @@ } } -jk_log(l, JK_LOG_ERROR, ERROR connecting to tomcat. Tomcat is probably not started. Failed errno = %d\n, errno); +jk_log(l, JK_LOG_INFO, + Error connecting to tomcat. Tomcat is probably not started or is listenning on the wrong port. Failed errno = %d\n, + errno); return JK_FALSE; } @@ -869,7 +871,7 @@ return JK_FALSE; } } else { -jk_log(l, JK_LOG_ERROR, Error connecting to the Tomcat process.\n); +jk_log(l, JK_LOG_INFO, Error connecting to the Tomcat process.\n); return JK_FALSE; } } @@ -1175,15 +1177,19 @@ return JK_FALSE; } -jk_log(l, JK_LOG_ERROR, ERRORO: Receiving from tomcat failed, recoverable operation. err=%d\n, i); +jk_log(l, JK_LOG_ERROR, ERROR: Receiving from tomcat failed, recoverable operation. err=%d\n, i); } else -jk_log(l, JK_LOG_ERROR, ERROR: sending request to tomcat failed in send loop. err=%d\n, i); +jk_log(l, JK_LOG_INFO, sending request to tomcat failed in send loop. err=%d\n, i); jk_close_socket(p-sd); p-sd = -1; ajp_reuse_connection(p, l); } + +/* Log the error only once per failed request. */ +jk_log(l, JK_LOG_ERROR, Error connecting to tomcat. Tomcat is probably not started or is listenning on the wrong port. Failed errno = %d\n, errno); + } else { jk_log(l, JK_LOG_ERROR, In jk_endpoint_t::service, NULL parameters\n); } 1.6 +2 -2 jakarta-tomcat-connectors/jk/native/common/jk_connect.c Index: jk_connect.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_connect.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- jk_connect.c 4 Sep 2002 11:31:33 - 1.5 +++ jk_connect.c 30 Oct 2002 22:12:20 - 1.6 @@ -174,7 +174,7 @@ jk_log(l, JK_LOG_DEBUG, jk_open_socket, return, sd = %d\n, sock); return sock; } -jk_log(l, JK_LOG_ERROR, jk_open_socket, connect() failed errno = %d\n, errno); +jk_log(l, JK_LOG_INFO, jk_open_socket, connect() failed errno = %d\n, errno); jk_close_socket(sock); } else { #ifdef WIN32 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/jk/native/common jk_ajp_common.c jk_connect.c
costin 2002/10/30 14:12:20 Modified:jk/native/common jk_ajp_common.c jk_connect.c Log: More trimming for error messages. Now only one line ( and hopefully more informative ) is displayed if we can't send the request to tomcat. Revision ChangesPath 1.32 +11 -5 jakarta-tomcat-connectors/jk/native/common/jk_ajp_common.c Index: jk_ajp_common.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_ajp_common.c,v retrieving revision 1.31 retrieving revision 1.32 diff -u -r1.31 -r1.32 --- jk_ajp_common.c 30 Oct 2002 21:17:34 - 1.31 +++ jk_ajp_common.c 30 Oct 2002 22:12:20 - 1.32 -623,7 +623,9 } } -jk_log(l, JK_LOG_ERROR, ERROR connecting to tomcat. Tomcat is probably not started. Failed errno = %d\n, errno); +jk_log(l, JK_LOG_INFO, + Error connecting to tomcat. Tomcat is probably not started or is listenning on the wrong port. Failed errno = %d\n, + errno); return JK_FALSE; } -869,7 +871,7 return JK_FALSE; } } else { -jk_log(l, JK_LOG_ERROR, Error connecting to the Tomcat process.\n); +jk_log(l, JK_LOG_INFO, Error connecting to the Tomcat process.\n); return JK_FALSE; } } -1175,15 +1177,19 return JK_FALSE; } -jk_log(l, JK_LOG_ERROR, ERRORO: Receiving from tomcat failed, recoverable operation. err=%d\n, i); +jk_log(l, JK_LOG_ERROR, ERROR: Receiving from tomcat failed, recoverable operation. err=%d\n, i); } else -jk_log(l, JK_LOG_ERROR, ERROR: sending request to tomcat failed in send loop. err=%d\n, i); +jk_log(l, JK_LOG_INFO, sending request to tomcat failed in send loop. err=%d\n, i); jk_close_socket(p-sd); p-sd = -1; ajp_reuse_connection(p, l); } + +/* Log the error only once per failed request. */ +jk_log(l, JK_LOG_ERROR, Error connecting to tomcat. Tomcat is probably not started or is listenning on the wrong port. Failed errno = %d\n, errno); + } else { jk_log(l, JK_LOG_ERROR, In jk_endpoint_t::service, NULL parameters\n); } 1.6 +2 -2 jakarta-tomcat-connectors/jk/native/common/jk_connect.c Index: jk_connect.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_connect.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- jk_connect.c 4 Sep 2002 11:31:33 - 1.5 +++ jk_connect.c 30 Oct 2002 22:12:20 - 1.6 -174,7 +174,7 jk_log(l, JK_LOG_DEBUG, jk_open_socket, return, sd = %d\n, sock); return sock; } -jk_log(l, JK_LOG_ERROR, jk_open_socket, connect() failed errno = %d\n, errno); +jk_log(l, JK_LOG_INFO, jk_open_socket, connect() failed errno = %d\n, errno); jk_close_socket(sock); } else { #ifdef WIN32 -- To unsubscribe, e-mail: mailto:tomcat-dev-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:tomcat-dev-help;jakarta.apache.org