glassfish 打开文件过多
今天网站出现了下面的错误:
java.net.SocketException:Toomanyopenfiles
atjava.net.PlainSocketImpl.socketAccept(NativeMethod)
atjava.net.PlainSocketImpl.accept(PlainSocketImpl.java:384)
atjava.net.ServerSocket.implAccept(ServerSocket.java:450)
atjava.net.ServerSocket.accept(ServerSocket.java:421)
atorg.apache.jk.common.ChannelSocket.accept(ChannelSocket.java:293)
atorg.apache.jk.common.ChannelSocket.acceptConnections(ChannelSocket.java:647)
atorg.apache.jk.common.ChannelSocket$SocketAcceptor.runIt(ChannelSocket.java:857)
atorg.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:682)
atjava.lang.Thread.run(Thread.java:595)
cat/proc/[PID]/limits发现这个glassfish最大允许打开的文件才有1024个
LimitSoftLimitHardLimitUnits
Maxcputimeunlimitedunlimitedms
Maxfilesizeunlimitedunlimitedbytes
Maxdatasizeunlimitedunlimitedbytes
Maxstacksize8388608unlimitedbytes
Maxcorefilesize0unlimitedbytes
Maxresidentsetunlimitedunlimitedbytes
Maxprocessesunlimitedunlimitedprocesses
Maxopenfiles10241024files
Maxlockedmemory6553665536bytes
Maxaddressspaceunlimitedunlimitedbytes
Maxfilelocksunlimitedunlimitedlocks
Maxpendingsignals1638216382signals
Maxmsgqueuesize819200819200bytes
Maxnicepriority2020
Maxrealtimepriority00
Maxrealtimetimeoutunlimitedunlimitedus
使用lsof-p[PID]命令看这个进程打开的文件列表。
可惜当时没有看都打开了哪些文件。
明天让网管将openfiles增大4倍。应该就不会有问题了