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 2014/09/04 06:18:16 UTC

[Bug 56910] New: when maxConnections="-1" AprEndpoint init error

https://issues.apache.org/bugzilla/show_bug.cgi?id=56910

            Bug ID: 56910
           Summary: when maxConnections="-1" AprEndpoint init error
           Product: Tomcat 7
           Version: 7.0.55
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Connectors
          Assignee: dev@tomcat.apache.org
          Reporter: w.hongjiang@gmail.com

use apr connector
set maxConnections="-1" in server.xml

when start tomcat, exceptions occur:

java.lang.NegativeArraySizeException
    at
org.apache.tomcat.util.net.AprEndpoint$SocketTimeouts.<init>(AprEndpoint.java:1145)
    at
org.apache.tomcat.util.net.AprEndpoint$Poller.init(AprEndpoint.java:1382)
    at
org.apache.tomcat.util.net.AprEndpoint.startInternal(AprEndpoint.java:602)
    at
org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:650)
    at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:449)
    at
org.apache.catalina.connector.Connector.startInternal(Connector.java:1007)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at
org.apache.catalina.core.StandardService.startInternal(StandardService.java:459)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at
org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:731)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:689)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:321)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:455)

In AprEndpoint.init() method:

        protected void init() {

            pool = Pool.create(serverSockPool);

            // Single poller by default
            int defaultPollerSize = getMaxConnections();

            if ((OS.IS_WIN32 || OS.IS_WIN64) && (defaultPollerSize > 1024)) {
                // The maximum per poller to get reasonable performance is 1024
                // Adjust poller size so that it won't reach the limit. This is
                // a limitation of XP / Server 2003 that has been fixed in
                // Vista / Server 2008 onwards.
                actualPollerSize = 1024;
            } else {
                actualPollerSize = defaultPollerSize;
            }

            timeouts = new SocketTimeouts(defaultPollerSize); //here !!!

did not check getMaxConnections() maybe return -1.

-- 
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 56910] when maxConnections="-1" AprEndpoint init error

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

--- Comment #2 from Mark Thomas <ma...@apache.org> ---
The way the APR Poller works, an unlimited number of connections isn't
possible. I see two options if maxConnections is specified as -1.
a) Log an error and don't let the connector start
b) Use a high number (e.g. 64k), log a warning and start the connector.

I'm leaning towards b).

-- 
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 56910] when maxConnections="-1" AprEndpoint init error

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

Konstantin Kolinko <kn...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sunqi800@163.com

--- Comment #1 from Konstantin Kolinko <kn...@gmail.com> ---
*** Bug 56909 has been marked as a duplicate of this bug. ***

-- 
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 56910] when maxConnections="-1" AprEndpoint init error

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

Mark Thomas <ma...@apache.org> changed:

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

--- Comment #3 from Mark Thomas <ma...@apache.org> ---
In the end I decided to ignore values of -1, log a warning and continue using
the current value.

Fixed in 8.0.x for 8.0.13 onwards and in 7.0.x for 7.0.56 onwards.

-- 
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