java.lang.OutOfMemoryError: unable to create new native thread
程序员文章站
2022-06-13 21:30:23
...
bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory(
Executors.newCachedThreadPool(),
Executors.newCachedThreadPool()));
异常
java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start0(Native Method)
at java.lang.Thread.start(Thread.java:691)
at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:949)
at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1360)
at org.jboss.netty.handler.execution.MemoryAwareThreadPoolExecutor.doUnorderedExecute(MemoryAwareThreadPoolExecutor.java:455)
at org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor$ChildExecutor.execute(OrderedMemoryAwareThreadPoolExecutor.java:292)
at org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor.doExecute(OrderedMemoryAwareThreadPoolExecutor.java:242)
at org.jboss.netty.handler.execution.MemoryAwareThreadPoolExecutor.execute(MemoryAwareThreadPoolExecutor.java:440)
at org.jboss.netty.handler.execution.ExecutionHandler.handleUpstream(ExecutionHandler.java:172)
at org.jboss.netty.handler.codec.frame.FrameDecoder.exceptionCaught(FrameDecoder.java:378)
at org.jboss.netty.channel.Channels.fireExceptionCaught(Channels.java:533)
at org.jboss.netty.channel.AbstractChannelSink.exceptionCaught(AbstractChannelSink.java:48)
at org.jboss.netty.channel.Channels.fireChannelBound(Channels.java:199)
at org.jboss.netty.channel.socket.nio.NioWorker$RegisterTask.run(NioWorker.java:185)
at org.jboss.netty.channel.socket.nio.AbstractNioWorker.processRegisterTaskQueue(AbstractNioWorker.java:430)
at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:329)
at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:35)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
通过JvisualVm监控,发现线程数达到1000的时候出现异常,于是怀疑是linux系统做了限制。
ulimit -a
max user processes (-u) 1024
修改成65535后,继续测试,问题解决。表面上是内存溢出,实际上是linux系统限制
下一篇: 还不知道软文营销怎么写?我来帮你分析
推荐阅读
-
spark大批量读取Hbase时出现java.lang.OutOfMemoryError: unable to create new native thread
-
java.lang.OutOfMemoryError: unable to create new native thread
-
java.lang.OutOfMemoryError: unable to create new native thread
-
java.lang.OutOfMemoryError: unable to create new native thread问题排查以及当前系统最大进程数量
-
解决Unable to create new native thread
-
“java.lang.OutOfMemoryError : unable to create new native Thread”
-
java.lang.outofmemoryerror unable to create new native thread
-
java.lang.OutOfMemoryError: unable to create new native thread
-
java.lang.OutOfMemoryError: unable to create new native thread
-
java.lang.OutOfMemoryError: unable to create new native thread