Description of problem: When you use WebSocket, either Http11NioProtocol or Http11AprProtocol should be configured as http connector in web subsystem. But if Http11NioProtocol is used, currentThreadCount and currentThreadsBusy of MBean "jboss.web:type=ThreadPool,name=http--0.0.0.0-8080" are always zeros and a user cannot monitor those important metrics. It seems src/main/java/org/apache/tomcat/util/net/NioEndpoint.java is not incrementing those statistics. Version-Release number of selected component (if applicable): jbossweb-7.4.8.Final-redhat-4.jar How reproducible: Always. Steps to Reproduce: 1. Start a standalone server with the following configuration. ~~~ <system-properties> <property name="org.apache.tomcat.util.ENABLE_MODELER" value="true"/> </system-properties> ... <subsystem xmlns="urn:jboss:domain:web:2.1" default-virtual-server="default-host" native="false"> <connector name="http" protocol="org.apache.coyote.http11.Http11NioProtocol" scheme="http" socket-binding="http"/> ... </subsystem> ~~~ 2. Deploy a web app with a servlet that just sleeps. Attached sample.war which just sleeps for 3 mins when you access "http://hostname:8080/sample/sample". 3. Monitor MBean attributes for "jboss.web:type=ThreadPool,name=http--0.0.0.0-8080" using jconsole.sh. Actual results: jboss.web:type=ThreadPool,name=http--0.0.0.0-8080 currentThreadCount: 0 currentThreadsBusy: 0 Expected results: Non-zero values should be observed. Additional info: Http11AprProtocol doesn't have this bug and can be a workaround. Install Native Components of your platform and enable <subsystem xmlns="urn:jboss:domain:web:2.1" native="true">.
Created attachment 1003572 [details] sample.war
I cannot implement this, so dev-. NIO2 has to use an executor rather than the old internal pool, which won't provide statistics. Instead, if an executor is configured in AS and set on the connector, then its statistics should be available.
Custom executor can be configured as follows: ~~~ /subsystem=threads/blocking-bounded-queue-thread-pool=nio2-connector:add(core-threads=10,max-threads=20,queue-length=10) /subsystem=web/connector=http:write-attribute(name=executor,value=nio2-connector) ~~~ But threads subsystem has another bug, Bug 1021911, where active-count is missing. ~~~ [standalone@localhost:9999 /] ls -l /subsystem=threads/blocking-bounded-queue-thread-pool=nio2-connector ATTRIBUTE VALUE TYPE allow-core-timeout false BOOLEAN core-threads 10 INT current-thread-count 2 INT keepalive-time undefined OBJECT largest-thread-count 2 INT max-threads 20 INT name nio2-connector STRING queue-length 10 INT queue-size 0 INT rejected-count 0 INT thread-factory undefined STRING ~~~ According to JBTHR-25, it will be not fixed because WFLY-462 is going to eliminate threads subsystem. So workaround of APR connector should be adopted.
Hi @Remy I think it's possible to provide the stats with the default case. There is a workaround based on two different calls in the ThreadPoolExecutor getActiveCount and getPoolSize. By default NioEndpoint creates a ThreadPoolExecutor during init call so if the executor is an instance of ThreadPoolExecutor, at least we can provide the stats. i.e (NioEndpoint): public int getCurrentThreadCount() { return (this.executor instanceof ThreadPoolExecutor) ? ((ThreadPoolExecutor) this.executor).getPoolSize() : getCurThreads(); } public int getCurrentThreadsBusy() { return (this.executor instanceof ThreadPoolExecutor) ? ((ThreadPoolExecutor) this.executor).getActiveCount() : getCurThreadsBusy(); } Could this be ok Remy ?
I suppose it doesn't hurt.
Created attachment 1023190 [details] patch jboss 7.5.x PR sent
patch is up. This should be on POST.
Verified with EAP 6.4.11.CP.CR1;
Retroactively bulk-closing issues from released EAP 6.4 cummulative patches.