查看TongWeb的端口状态close_wait过多,且日志中有如下异常。
Exception in thread "InnocuousThread-25" java.lang.SecurityException: setContextClassLoader]
at sun.misc.InnocuousThread.setContextClassLoader(InnocuousThread.java:96)]
at com.tongweb.web.util.security.PrivilegedSetTccl.run(PrivilegedSetTccl.java:31)]
at com.tongweb.web.util.security.PrivilegedSetTccl.run(PrivilegedSetTccl.java:21)]
at java.security.AccessController.doPrivileged(Native Method)]
at com.tongweb.web.util.threads.TaskThreadFactory.newThread(TaskThreadFactory.java:66)]
at com.tongweb.web.util.threads.TWThreadPoolExecutor$Worker.<init>(TWThreadPoolExecutor.java:622)]
at com.tongweb.web.util.threads.TWThreadPoolExecutor.addWorker(TWThreadPoolExecutor.java:950)]
at com.tongweb.web.util.threads.TWThreadPoolExecutor.execute(TWThreadPoolExecutor.java:1406)]
at com.tongweb.web.util.threads.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:163)]
at com.tongweb.web.util.threads.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:141)]
at sun.nio.ch.AsynchronousChannelGroupImpl.executeOnPooledThread(AsynchronousChannelGroupImpl.java:188)]
at sun.nio.ch.Invoker.invokeIndirectly(Invoker.java:212)]
at sun.nio.ch.UnixAsynchronousSocketChannelImpl.finishRead(UnixAsynchronousSocketChannelImpl.java:434)]
at sun.nio.ch.UnixAsynchronousSocketChannelImpl.finish(UnixAsynchronousSocketChannelImpl.java:191)]
at sun.nio.ch.UnixAsynchronousSocketChannelImpl.onEvent(UnixAsynchronousSocketChannelImpl.java:213)]
at sun.nio.ch.EPollPort$EventHandlerTask.run(EPollPort.java:293)]
at java.lang.Thread.run(Thread.java:748)]
当TongWeb7.0.4.3及之前版本 http通道为NIO2方式,且TongWeb增加了 -Djava.security.manager=com.tongweb.checkcode.CheckSystemExitSecurityManager参数,就会引发此问题。解决办法选其一:
方式一. 将NIO2改为BIO模式。
方式二:若确保没有System,exit代码,则去掉 -Djava.security.manager=com.tongweb.checkcode.CheckSystemExitSecurityManager参数
方式三:升级到TongWeb7.0.4.3之后的版本。