Page 1 of 2

Smartfox SocketAcceptor Error

Posted: 10 Sep 2014, 20:26
by moris
CPU usage in SFSAdmin was 300% and logged this message.

10 Sep 2014 | 22:00:00,000 | INFO | SocketAcceptor-1 | bitswarm.core.SocketAcceptor | | I/O Error during accept loop: Too many open files

when update extensions file, can not reload.
connect to server was too long.


after 20 minutes CPU usage would become 15%.

Re: Smartfox SocketAcceptor Error

Posted: 11 Sep 2014, 08:23
by Lapo
Hi,
This is due to the default configuration in Linux.
Please take a look here:
http://docs2x.smartfoxserver.com/Gettin ... tall-linux

Under the "Configuring the OS file descriptors"

Re: Smartfox SocketAcceptor Error

Posted: 14 Sep 2014, 14:40
by moris
Thanks

Re: Smartfox SocketAcceptor Error

Posted: 15 Aug 2017, 02:45
by steve13627
Hi Admin site, I have the same problem, but it seems different situation. When I was run the command as below, the SFS server open a huge number of "File descriptors" as below:

Code: Select all

/data/SFS2X/logs# lsof -n |awk '{print $2}'|sort|uniq -c |sort -nr|more
 
 688708 8056


Could you give me some direciton to find out the root cause? Any detail is required, please let me know.

Re: Smartfox SocketAcceptor Error

Posted: 15 Aug 2017, 06:49
by Lapo
Hi,
I have no idea what that Linux command is supposed to tell you,nor I understand what is the problem that you are reporting.

Can you please clarify?

Re: Smartfox SocketAcceptor Error

Posted: 16 Aug 2017, 01:42
by steve13627
ok, than leave it . Could you tell me how to check "How many file descriptors is opening by SFS server" since I am afraid of there are some other reasons for exception "Too Many Open files". :)

Re: Smartfox SocketAcceptor Error

Posted: 16 Aug 2017, 06:39
by Lapo
In UNIX/Linux every open socket is considered an open file descriptor. So the total amount depends on the number of concurrent connections active at a certain time.

cheers

Re: Smartfox SocketAcceptor Error

Posted: 16 Aug 2017, 13:27
by Rob
steve13627 wrote:Could you tell me how to check "How many file descriptors is opening by SFS server"

Use the ps command to find the PID of the smartfox process:

Code: Select all

ps -aef | grep {process-name}

Then use the lsof command to list the files in use

Code: Select all

lsof -p {process-id}

If you only want the number of open files, combine it with the wc command:

Code: Select all

 lsof -p {process-id} | wc -l

Re: Smartfox SocketAcceptor Error

Posted: 16 Aug 2017, 15:39
by Lapo
But that will count actual open files in the filesystem, not just connections.
What's the point of counting local files?

Re: Smartfox SocketAcceptor Error

Posted: 16 Aug 2017, 16:55
by Rob
Lapo wrote:But that will count actual open files in the filesystem, not just connections.
What's the point of counting local files?

I just replied to what steve13627 asked for. Maybe he suspects his problem with too many open files is linked to his extension code and wants to see what files are actually open to help debug the issue?

Re: Smartfox SocketAcceptor Error

Posted: 18 Aug 2017, 03:55
by steve13627
Thank you all. It seems the problem has been fixed after increasing the file descriptor amount. :)

Re: Smartfox SocketAcceptor Error

Posted: 21 Sep 2017, 10:42
by steve13627
Hi Lapo,

I just encounter this error again, could you please help me ?
It seems the scanner always working with the "www" folder?

Code: Select all

21 Sep 2017 | 10:14:32,094 | WARN  | Scanner-0 | jetty.util.Scanner |     | Error listing files in directory /home/ubuntu/SmartFoxServer_2.13/SmartFoxServer_2X/SFS2X/www
21 Sep 2017 | 10:14:33,099 | WARN  | Scanner-0 | jetty.util.Scanner |     | Error listing files in directory /home/ubuntu/SmartFoxServer_2.13/SmartFoxServer_2X/SFS2X/www
21 Sep 2017 | 10:14:34,110 | WARN  | Scanner-0 | jetty.util.Scanner |     | Error listing files in directory /home/ubuntu/SmartFoxServer_2.13/SmartFoxServer_2X/SFS2X/www
21 Sep 2017 | 10:14:36,308 | WARN  | Scanner-0 | jetty.webapp.WebAppContext |     | Failed startup of context o.e.j.w.WebAppContext@2a0e7418{/HelloServlet,file:///home/ubuntu/SmartFoxServer_2.13/SmartFoxServer_2X/SFS2X/www/HelloServlet/,UNAVAILABLE}{/home/ubuntu/SmartFoxServer_2.13/SmartFoxServer_2X/SFS2X/www/HelloServlet}
MultiException[java.nio.file.FileSystemException: /home/ubuntu/SmartFoxServer_2.13/SmartFoxServer_2X/SFS2X/lib/jetty/lib/servlet-api-3.1.jar: Too many open files, java.nio.file.FileSystemException: /home/ubuntu/SmartFoxServer_2.13/SmartFoxServer_2X/SFS2X/lib/jetty/lib/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar: Too many open files, java.nio.file.FileSystemException: /home/ubuntu/SmartFoxServer_2.13/SmartFoxServer_2X/SFS2X/lib/jetty/lib/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar: Too many open files, java.nio.file.FileSystemException: /home/ubuntu/SmartFoxServer_2.13/SmartFoxServer_2X/SFS2X/lib/jetty/lib/servlet-api-3.1.jar: Too many open files]
        at org.eclipse.jetty.annotations.AnnotationConfiguration.scanForAnnotations(AnnotationConfiguration.java:534)
        at org.eclipse.jetty.annotations.AnnotationConfiguration.configure(AnnotationConfiguration.java:447)
        at org.eclipse.jetty.webapp.WebAppContext.configure(WebAppContext.java:494)
        at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1361)
        at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:778)
        at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:262)
        at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:520)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.eclipse.jetty.deploy.bindings.StandardStarter.processBinding(StandardStarter.java:41)
        at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:188)
        at org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:499)
        at org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:147)
        at org.eclipse.jetty.deploy.providers.ScanningAppProvider.fileAdded(ScanningAppProvider.java:180)
        at org.eclipse.jetty.deploy.providers.WebAppProvider.fileAdded(WebAppProvider.java:437)
        at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileAdded(ScanningAppProvider.java:64)
        at org.eclipse.jetty.util.Scanner.reportAddition(Scanner.java:610)
        at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:529)
        at org.eclipse.jetty.util.Scanner.scan(Scanner.java:392)
        at org.eclipse.jetty.util.Scanner$1.run(Scanner.java:329)
        at java.util.TimerThread.mainLoop(Timer.java:555)
        at java.util.TimerThread.run(Timer.java:505)
        Suppressed: java.nio.file.FileSystemException: /home/ubuntu/SmartFoxServer_2.13/SmartFoxServer_2X/SFS2X/lib/jetty/lib/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar: Too many open files
                at sun.nio.fs.UnixException.translateToIOException(UnixException.java:91)
                at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
                at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
                at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
                at java.nio.file.Files.newByteChannel(Files.java:361)
                at java.nio.file.Files.newByteChannel(Files.java:407)
                at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:384)
                at java.nio.file.Files.newInputStream(Files.java:152)
                at org.eclipse.jetty.util.resource.PathResource.getInputStream(PathResource.java:388)
                at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:919)
                at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:851)
                at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:163)
                at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:546)
                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)
        Suppressed: java.nio.file.FileSystemException: /home/ubuntu/SmartFoxServer_2.13/SmartFoxServer_2X/SFS2X/lib/jetty/lib/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar: Too many open files
                at sun.nio.fs.UnixException.translateToIOException(UnixException.java:91)
                at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
                at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
                at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
                at java.nio.file.Files.newByteChannel(Files.java:361)
                at java.nio.file.Files.newByteChannel(Files.java:407)
                at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:384)
                at java.nio.file.Files.newInputStream(Files.java:152)
                at org.eclipse.jetty.util.resource.PathResource.getInputStream(PathResource.java:388)
                at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:919)
                at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:851)
                at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:163)
                at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:546)
                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)
        Suppressed: java.nio.file.FileSystemException: /home/ubuntu/SmartFoxServer_2.13/SmartFoxServer_2X/SFS2X/lib/jetty/lib/servlet-api-3.1.jar: Too many open files
                at sun.nio.fs.UnixException.translateToIOException(UnixException.java:91)
                at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
                at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
                at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
                at java.nio.file.Files.newByteChannel(Files.java:361)
                at java.nio.file.Files.newByteChannel(Files.java:407)
                at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:384)
                at java.nio.file.Files.newInputStream(Files.java:152)
                at org.eclipse.jetty.util.resource.PathResource.getInputStream(PathResource.java:388)
                at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:919)
                at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:851)
                at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:163)
                at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:546)
                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)
Caused by: java.nio.file.FileSystemException: /home/ubuntu/S

Re: Smartfox SocketAcceptor Error

Posted: 21 Sep 2017, 14:22
by Lapo
Hello,
the "Too many open files" error is related to the configuration of your Linux OS. You will need to increase the number of available file descriptors.
Please take a look at the installation documentation:
http://docs2x.smartfoxserver.com/Gettin ... tall-linux

See under the "Configuring the OS file descriptors limit" section.

Hope it helps

Re: Smartfox SocketAcceptor Error

Posted: 22 Sep 2017, 01:33
by steve13627
Hi Lapo,
After increaseing the file descriptors, the server is working . Let's see if it will happen again. :)

Lapo wrote:Hello,
the "Too many open files" error is related to the configuration of your Linux OS. You will need to increase the number of available file descriptors.
Please take a look at the installation documentation:
http://docs2x.smartfoxserver.com/Gettin ... tall-linux

See under the "Configuring the OS file descriptors limit" section.

Hope it helps

Re: Smartfox SocketAcceptor Error

Posted: 18 Oct 2017, 05:57
by steve13627
Hi, Lapo,

The error comes again even I increase the file descriptor as unlimited, could you help me on this?