tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 62871] New: JMX: ThreadPool.socketProperties is not Serializable
Date Wed, 31 Oct 2018 22:10:38 GMT
https://bz.apache.org/bugzilla/show_bug.cgi?id=62871

            Bug ID: 62871
           Summary: JMX: ThreadPool.socketProperties is not Serializable
           Product: Tomcat 8
           Version: 8.5.x-trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Util
          Assignee: dev@tomcat.apache.org
          Reporter: moio@suse.de
  Target Milestone: ----

Created attachment 36224
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36224&action=edit
Trivial patch that addresses this bug

Some JMX clients such as Prometheus'[1] jmx_exporter[2] will bulk-load all
attributes of an MBean for performance reasons. This means that one
non-Serializable attribute is sufficient to make all information from the MBean
inaccessible.


I could readily reproduce a problem with the ThreadPool MBean, specifically
with the socketProperties property which is not Serializable.

Reproducer:

# enable JMX's full logging
cat >logging.properties <<<"
handlers=java.util.logging.ConsoleHandler
java.util.logging.ConsoleHandler.level=ALL
io.prometheus.jmx.level=ALL
io.prometheus.jmx.shaded.io.prometheus.jmx.level=ALL
"

# configure reading from a local Tomcat instance with JMX configured on port
3333
cat >config.yml <<<"
hostPort: localhost:3333
whitelistObjectNames:
  - Catalina:type=ThreadPool,name=*
rules:
  - pattern: ".*"
"

# launch jmx_exporter
/usr/bin/java -Djava.util.logging.config.file=logging.properties -jar
jmx_prometheus_httpserver.jar 5556 jmx_exporter.yml


Visiting with a browser http://localhost:5556/metrics will trigger jmx_exporter
and the following error is produced:

FINE: scrape:
'Catalina:type=ThreadPool,name="http-apr-127.0.0.1-8080"_[currentThreadsBusy,
paused, sSLCertificateKeyFile, sSLProtocol, keyAlias, truststoreType,
sSLPassword, sendfileCount, sSLCACertificatePath, useCometTimeout,
socketProperties, p
ollTime, sSLHonorCipherOrder, currentThreadCount, trustManagerClassName,
sSLCARevocationFile, usePolling, keystorePass, trustMaxCertLength, maxThreads,
truststoreAlgorithm, tcpNoDelay, algorithm, keepAliveTimeout,
maxKeepAliveRequests, localPort, t
ruststoreProvider, acceptorThreadCount, soTimeout, daemon, minSpareThreads,
sSLDisableSessionTickets, sessionCacheSize, acceptorThreadPriority, backlog,
port, maxHeaderCount, sSLCARevocationPath, keystoreType, name, sslProtocol,
soLinger, sessionTi
meout, useComet, sSLVerifyDepth, clientAuth, modelerType, sSLCertificateFile,
connectionCount, sendfileThreadCount, threadPriority, running,
executorTerminationTimeoutMillis, allowUnsafeLegacyRenegotiation,
sslEnabledProtocolsArray, jniSslContext,
ciphers, truststorePass, sSLEnabled, sendfileSize, maxThreadsWithExecutor,
crlFile, sSLVerifyClient, maxConnections, keystoreProvider, keepAliveCount,
sSLCipherSuite, deferAccept, sSLDisableCompression, useSendfile,
sSLCertificateChainFile, sSLCACe
rtificateFile, ciphersUsed, keyPass, bindOnInit, sSLInsecureRenegotiation,
truststoreFile, keystoreFile, useServerCipherSuitesOrder]': Fail:
java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
        java.io.WriteAbortedException: writing aborted;
java.io.NotSerializableException: org.apache.tomcat.util.net.SocketProperties


I have successfully tested a trivial patch that simply makes socketProperties
protected instead of public - this does not seem to have negative consequences
at least in the environment I tested it in (Tomcat 8.0.53 as shipped in SUSE
Linux Enterprise Server 12 SP3). Patch is attached to this bug.


I do not really know Tomcat (and not even JMX, to be honest) to know if this
patch is really acceptable or if it's really oversimplified, as this is my
first contribution!


[1] https://prometheus.io/
[2] https://github.com/prometheus/jmx_exporter
[3]
https://github.com/prometheus/jmx_exporter/issues/265#issuecomment-383614412

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


Mime
View raw message