You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2018/09/21 07:48:12 UTC

[Bug 62751] New: ajp worker's socket_connect_timeout value is handled as seconds

https://bz.apache.org/bugzilla/show_bug.cgi?id=62751

            Bug ID: 62751
           Summary: ajp worker's socket_connect_timeout value is handled
                    as seconds
           Product: Tomcat Connectors
           Version: 1.2.44
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mod_jk
          Assignee: dev@tomcat.apache.org
          Reporter: tkstone72@gmail.com
  Target Milestone: ---

Tomcat connect document explains that socket_connect_timeout is in
milliseconds. But the value is handled as seconds on Linux.

test case)
I have set ajp worker's socket_connect_timeout value as 1000 (to set 1 second)
and simulated pending Tomcat (by iptables DROP policy between mod_jk and
Tomcat), but it waited infinitely. So I changed the value into "10" (to set 10
seconds) and worked as I expected.   

<workers.properties>
worker.server-2.socket_connect_timeout=10

<mod_jk log> : connection timeout works in 10 seconds
[Fri Sep 21 16:14:34.302 2018] [14954:140022231049984] [debug]
jk_open_socket::jk_connect.c (798): trying to connect socket 14 to
150.24.200.109:8009
...
[Fri Sep 21 16:14:44.312 2018] [14954:140022231049984] [info]
jk_open_socket::jk_connect.c (816): connect to 150.24.200.109:8009 failed
(errno=115)
[Fri Sep 21 16:14:44.312 2018] [14954:140022231049984] [info]
ajp_connect_to_endpoint::jk_ajp_common.c (1065): (server-2) Failed opening
socket to (150.24.200.109:8009) (errno=115)
...
[Fri Sep 21 16:14:54.423 2018] [14954:140022231049984] [info]
jk_open_socket::jk_connect.c (816): connect to 150.24.200.109:8009 failed
(errno=115)
[Fri Sep 21 16:14:54.423 2018] [14954:140022231049984] [info]
ajp_connect_to_endpoint::jk_ajp_common.c (1065): (server-2) Failed opening
socket to (150.24.200.109:8009) (errno=115)
[Fri Sep 21 16:14:54.423 2018] [14954:140022231049984] [error]
ajp_send_request::jk_ajp_common.c (1725): (server-2) connecting to backend
failed. Tomcat is probably not started or is listening on the wrong port
(errno=115)
...

<jk_connect.c>
...
line 277 => rc = poll(&pfd, 1, timeout * 1000); // timeout is handled as
seconds

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 62751] ajp worker's socket_connect_timeout value is handled as seconds

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62751

Rainer Jung <ra...@kippdata.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #2 from Rainer Jung <ra...@kippdata.de> ---
Thanks for your report and analysis.
This was a regression in version 1.2.44 on platforms that are non-Windows and
do support poll().
The following fix was committed in r1841817 and will be part of version 1.2.46:

Index: native/common/jk_connect.c
===================================================================
--- native/common/jk_connect.c  (revision 1841810)
+++ native/common/jk_connect.c  (working copy)
@@ -274,7 +274,7 @@
         socklen_t rclen = (socklen_t)sizeof(rc);
         pfd.fd = sd;
         pfd.events = POLLOUT;
-        rc = poll(&pfd, 1, timeout * 1000);
+        rc = poll(&pfd, 1, timeout);
         if (rc <= 0) {
             /* Save errno */
             int err = errno;

Regards,

Rainer

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 62751] ajp worker's socket_connect_timeout value is handled as seconds

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62751

--- Comment #1 from TaeKyung Suk <tk...@gmail.com> ---
jk_connect.c handles socket_connect_timeout value as milliseconds on Windows.
<jk_connect.c>
line 206, 207
        tv.tv_sec = timeout / 1000;
        tv.tv_usec = (timeout % 1000) * 1000;

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org