Too many open files

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

zynbasil
Posts: 35
Joined: 23 May 2016, 03:59

Too many open files

Postby zynbasil » 26 Nov 2018, 03:20

sfs2x 2.13.4
ubuntu 18.04
ccu 3500

http://docs2x.smartfoxserver.com/Gettin ... tall-linux
start server: sudo systemctl start smartfox

lsof -p pid | wc -l

Code: Select all

3879


ulimit -a

Code: Select all

core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 281268
max locked memory       (kbytes, -l) 16384
max memory size         (kbytes, -m) unlimited
open files                      (-n) 655340
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 281268
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
 



pid:17451 is sfs2x:

Code: Select all

root@ip-172-31-47-160:~# lsof -n | wc -l
1002106
root@ip-172-31-47-160:~# netstat -ant | wc -l
3733
root@ip-172-31-47-160:~# lsof -n -i | wc -l
3713
root@ip-172-31-47-160:~# lsof -n | awk '{print $2}' | sort -n | uniq -c | sort -nr | more
 820852 17451


cat /proc/17451/limits

Code: Select all

Limit                     Soft Limit           Hard Limit           Units
Max cpu time              unlimited            unlimited            seconds
Max file size             unlimited            unlimited            bytes
Max data size             unlimited            unlimited            bytes
Max stack size            8388608              unlimited            bytes
Max core file size        0                    unlimited            bytes
Max resident set          unlimited            unlimited            bytes
Max processes             281268               281268               processes
Max open files            4096                 4096                 files
Max locked memory         16777216             16777216             bytes
Max address space         unlimited            unlimited            bytes
Max file locks            unlimited            unlimited            locks
Max pending signals       281268               281268               signals
Max msgqueue size         819200               819200               bytes
Max nice priority         0                    0
Max realtime priority     0                    0
Max realtime timeout      unlimited            unlimited            us 

log:

Code: Select all

java.io.IOException: Too many open files
at sun.nio.ch.ServerSocketChannelImpl.accept0(Native Method)
at sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:422)
at sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:250)
at org.eclipse.jetty.server.ServerConnector.accept(ServerConnector.java:373)
at org.eclipse.jetty.server.AbstractConnector$Acceptor.run(AbstractConnector.java:593)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
at java.lang.Thread.run(Thread.java:745)
26 Nov 2018 | 02:29:39,425 | WARN  | Scanner-0 | jetty.util.Scanner |     | Error listing files in directory /home/ubuntu/SmartFoxServer_2X/SFS2X/www
java.io.IOException: Too many open files
at sun.nio.ch.ServerSocketChannelImpl.accept0(Native Method)
at sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:422)
at sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:250)
at org.eclipse.jetty.server.ServerConnector.accept(ServerConnector.java:373)
at org.eclipse.jetty.server.AbstractConnector$Acceptor.run(AbstractConnector.java:593)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
at java.lang.Thread.run(Thread.java:745)
Last edited by zynbasil on 26 Nov 2018, 05:52, edited 1 time in total.
zynbasil
Posts: 35
Joined: 23 May 2016, 03:59

Re: Too many open files websockets

Postby zynbasil » 26 Nov 2018, 05:43

Solved.

https://unix.stackexchange.com/question ... th-systemd

this need be fixed:
http://docs2x.smartfoxserver.com/Gettin ... tall-linux

Code: Select all

[Unit]
Description=SmartFoxServer 2X
After=network.target

[Service]
Type=forking
User=root
LimitNOFILE=65535 #(add this)
WorkingDirectory=/path/to/SmartFoxServer_2X/SFS2X
ExecStart=/path/to/SmartFoxServer_2X/SFS2X/sfs2x-service start
ExecStop=/path/to/SmartFoxServer_2X/SFS2X/sfs2x-service stop
Restart=on-abort

[Install]
WantedBy=multi-user.target
User avatar
Lapo
Site Admin
Posts: 21014
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Too many open files

Postby Lapo » 26 Nov 2018, 08:34

Interesting to know. We have not seen this issue with Ubuntu before. Not sure if it's related with Ubuntu 18 or with your setup.
We'll add a note in the documentation.

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 6 guests