Smartfox SocketAcceptor Error

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

Moderators: Lapo, Bax

moris
Posts: 41
Joined: 17 Aug 2012, 11:11

Smartfox SocketAcceptor Error

Postby moris » 10 Sep 2014, 20:26

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%.
User avatar
Lapo
Site Admin
Posts: 20040
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Smartfox SocketAcceptor Error

Postby Lapo » 11 Sep 2014, 08:23

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"
Lapo
--
gotoAndPlay()
...addicted to flash games
moris
Posts: 41
Joined: 17 Aug 2012, 11:11

Re: Smartfox SocketAcceptor Error

Postby moris » 14 Sep 2014, 14:40

Thanks
steve13627
Posts: 50
Joined: 06 Dec 2016, 06:27

Re: Smartfox SocketAcceptor Error

Postby steve13627 » 15 Aug 2017, 02:45

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.
Attachments
QQ图片20170815105433.png
(104.65 KiB) Not downloaded yet
User avatar
Lapo
Site Admin
Posts: 20040
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Smartfox SocketAcceptor Error

Postby Lapo » 15 Aug 2017, 06:49

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?
Lapo

--

gotoAndPlay()

...addicted to flash games
steve13627
Posts: 50
Joined: 06 Dec 2016, 06:27

Re: Smartfox SocketAcceptor Error

Postby steve13627 » 16 Aug 2017, 01:42

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". :)
User avatar
Lapo
Site Admin
Posts: 20040
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Smartfox SocketAcceptor Error

Postby Lapo » 16 Aug 2017, 06:39

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
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Rob
Posts: 5
Joined: 01 Jul 2017, 07:33

Re: Smartfox SocketAcceptor Error

Postby Rob » 16 Aug 2017, 13:27

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
User avatar
Lapo
Site Admin
Posts: 20040
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Smartfox SocketAcceptor Error

Postby Lapo » 16 Aug 2017, 15:39

But that will count actual open files in the filesystem, not just connections.
What's the point of counting local files?
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Rob
Posts: 5
Joined: 01 Jul 2017, 07:33

Re: Smartfox SocketAcceptor Error

Postby Rob » 16 Aug 2017, 16:55

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?
steve13627
Posts: 50
Joined: 06 Dec 2016, 06:27

Re: Smartfox SocketAcceptor Error

Postby steve13627 » 18 Aug 2017, 03:55

Thank you all. It seems the problem has been fixed after increasing the file descriptor amount. :)
steve13627
Posts: 50
Joined: 06 Dec 2016, 06:27

Re: Smartfox SocketAcceptor Error

Postby steve13627 » 21 Sep 2017, 10:42

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
User avatar
Lapo
Site Admin
Posts: 20040
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Smartfox SocketAcceptor Error

Postby Lapo » 21 Sep 2017, 14:22

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
Lapo

--

gotoAndPlay()

...addicted to flash games
steve13627
Posts: 50
Joined: 06 Dec 2016, 06:27

Re: Smartfox SocketAcceptor Error

Postby steve13627 » 22 Sep 2017, 01:33

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
steve13627
Posts: 50
Joined: 06 Dec 2016, 06:27

Re: Smartfox SocketAcceptor Error

Postby steve13627 » 18 Oct 2017, 05:57

Hi, Lapo,

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

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 2 guests