dragonwell-project / dragonwell8

Alibaba Dragonwell8 JDK
http://dragonwell-jdk.io
GNU General Public License v2.0
4.21k stars 497 forks source link

[Bug] 端口号8780被JMX占用时,将导致dump失败 #613

Closed Sugartx closed 10 months ago

Sugartx commented 10 months ago

Description 在执行jcmd QuickStart.dump命令时,会抛出如下异常

Error: JMX connector server communication error: service:jmx:rmi://r100042063-71038443-fsmd7:8780
sun.management.AgentConfigurationError: java.rmi.server.ExportException: Port already in use: 8780; nested exception is: 
        java.net.BindException: Address already in use (Bind failed)
        at sun.management.jmxremote.ConnectorBootstrap.exportMBeanServer(ConnectorBootstrap.java:824)
        at sun.management.jmxremote.ConnectorBootstrap.startRemoteConnectorServer(ConnectorBootstrap.java:470)
        at sun.management.Agent.startAgent(Agent.java:262)
        at sun.management.Agent.startAgent(Agent.java:452)
Caused by: java.rmi.server.ExportException: Port already in use: 8780; nested exception is: 
        java.net.BindException: Address already in use (Bind failed)
        at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:346)
        at sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:254)
        at sun.rmi.transport.tcp.TCPEndpoint.exportObject(TCPEndpoint.java:412)
        at sun.rmi.transport.LiveRef.exportObject(LiveRef.java:147)
        at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:237)
        at sun.management.jmxremote.ConnectorBootstrap$PermanentExporter.exportObject(ConnectorBootstrap.java:201)
        at javax.management.remote.rmi.RMIJRMPServerImpl.export(RMIJRMPServerImpl.java:146)
        at javax.management.remote.rmi.RMIJRMPServerImpl.export(RMIJRMPServerImpl.java:122)
        at javax.management.remote.rmi.RMIConnectorServer.start(RMIConnectorServer.java:404)
        at sun.management.jmxremote.ConnectorBootstrap.exportMBeanServer(ConnectorBootstrap.java:820)
        ... 3 more
Caused by: java.net.BindException: Address already in use (Bind failed)
        at java.net.PlainSocketImpl.socketBind(Native Method)
        at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387)
        at java.net.ServerSocket.bind(ServerSocket.java:427)
        at java.net.ServerSocket.<init>(ServerSocket.java:269)
        at java.net.ServerSocket.<init>(ServerSocket.java:155)
        at sun.rmi.transport.proxy.RMIDirectSocketFactory.createServerSocket(RMIDirectSocketFactory.java:45)
        at sun.rmi.transport.proxy.RMIMasterSocketFactory.createServerSocket(RMIMasterSocketFactory.java:345)
        at sun.rmi.transport.tcp.TCPEndpoint.newServerSocket(TCPEndpoint.java:670)
        at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:335)
        ... 12 more

Steps to Reproduce Steps to reproduce the behavior:

  1. 带有如下参数启动Springboot项目,注意这里指定了JMX端口为8780,这个端口号我们无法修改
    -Dcom.sun.management.jmxremote.authenticate=false
    -Dcom.sun.management.jmxremote.ssl=false
    -Djava.rmi.server.hostname=10.139.176.120
    -Dcom.sun.management.jmxremote
    -Dcom.sun.management.jmxremote.port=8780
    -Dcom.sun.management.jmxremote.rmi.port=8780
    -Dcom.sun.management.jmxremote.local.only=false
  2. 启动完成后,执行jcmd QuickStart.dump命令时,会抛出Error: java.lang.Error: java.lang.Exception: Process failed 3.输出alibaba.quickstart.sharedcache/logs/jsa.log后,发现上述异常。

JDK version Alibaba Dragonwell Extended Edition 8.16.17

Execution environment

jia-wei-tang commented 10 months ago

修复后的jdk会在下一次发布中包含最新代码,如果现在需要使用可以自行编译项目https://github.com/dragonwell-project/serverless-adapter-jdk8/ ,编译命令为 mvn clean package 。 编译时确保使用的jdk是JDK8。 编译成功后将 target/serverless-adapter-0.1.jar (重命名为serverless-adapter.jar)和 output/libloadclassagent.so 替换进已有的JDK中的jre/lib/amd64/serverless目录下,覆盖原文件。