java.io.IOException: Too many open files

297 views
Skip to first unread message

Jarl

unread,
Jan 16, 2013, 1:03:03 AM1/16/13
to quick...@googlegroups.com
Hi

I have made a service that is handling an immense amount of concurrent events.

I get "Too many open files" from the accpet logic in QuickServer:

java.io.IOException: Too many open files
at sun.nio.ch.ServerSocketChannelImpl.accept0(Native Method)
at sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:226)
at org.quickserver.net.server.QuickServer.runNonBlocking(QuickServer.java:2722)
at org.quickserver.net.server.QuickServer.run(QuickServer.java:795)
at java.lang.Thread.run(Thread.java:722)

I cannot actually believe that is because connections are not closed, it seems so unlogical since I have not made a lot of magic with QS.

On the other hand it could be the OS limit for open files/connections/pipes. But this is not a low limit today, so I need some help here.

  • How can I verify in the logs that connections are closed properly?
  • When could the above stacktrace occur?

My QS configuration is among other settings:

        <server-mode>
<blocking>false</blocking>
</server-mode>

<default-data-mode>
<data-type-in>Byte</data-type-in>
<data-type-out>Byte</data-type-out>
</default-data-mode>

I am not really doing anything about the connections, just letting QS do its work.

What I see in the logs are:

2013-01-14 09:50:24.018 - [FINEST] - [org.quickserver.net.server.QuickServer.runNonBlocking] - Key is Readable, removing OP_READ from interestOps for <ClientHandler-Pool#1-ID:513>
2013-01-14 09:50:24.018 - [FINEST] - [org.quickserver.net.server.impl.NonBlockingClientHandler.run] - Running <ClientHandler-Pool#1-ID:513> using <ClientThread-Pool#1-ID:21> for (ClientEvent-Read)
2013-01-14 09:50:24.018 - [FINEST] - [org.quickserver.net.server.impl.NonBlockingClientHandler.processRead] - SocketChannel read was -1!
2013-01-14 09:50:24.018 - [FINEST] - [org.quickserver.net.server.impl.NonBlockingClientHandler.processRead] - We don't have connection, lets return all resources.
2013-01-14 09:50:24.018 - [FINEST] - [org.quickserver.net.server.impl.NonBlockingClientHandler.run] - <ClientThread-Pool#1-ID:21> calling closeConnection()
2013-01-14 09:50:24.018 - [FINEST] - [org.quickserver.net.server.impl.NonBlockingClientHandler.closeConnection] - Closing SocketChannel
2013-01-14 09:50:24.018 - [FINEST] - [org.quickserver.net.server.impl.NonBlockingClientHandler.returnClientHandler] - <ClientHandler-Pool#1-ID:513>
2013-01-14 09:50:24.018 - [FINEST] - [org.quickserver.net.server.impl.BasicClientHandler.returnClientHandler] - <ClientThread-Pool#1-ID:21> returning <ClientHandler-Pool#1-ID:513>
2013-01-14 09:50:24.018 - [FINEST] - [org.quickserver.net.server.impl.NonBlockingClientHandler.clean] - Starting clean - <ClientHandler-Pool#1-ID:513>
2013-01-14 09:50:24.018 - [FINEST] - [org.quickserver.net.server.impl.NonBlockingClientHandler.clean] - Finished clean - <ClientHandler-Pool#1-ID:513>
2013-01-14 09:50:24.018 - [FINEST] - [org.quickserver.util.pool.thread.ClientThread.run] - Client returned the thread: <ClientThread-Pool#1-ID:21>
2013-01-14 09:50:24.018 - [FINEST] - [org.quickserver.util.pool.thread.ClientThread.run] - Returning client thread to pool: <ClientThread-Pool#1-ID:21>

This happens a lot in the logs.

Any comments are appreciated.

Thanks in advance :)

Akshath

unread,
Jan 17, 2013, 11:35:32 AM1/17/13
to quick...@googlegroups.com
How many clients do u have connected to your server ? Also do you open any connection in your app say to DB or some thing ?

Also can you try running the server with  blocking mode set to true and check if the problem happens ..

         <server-mode>
<blocking>true</blocking>
</server-mode>


Also what is your OS and java version? Also do you have any other process that is using up the sockets on the server ? 

Jarl André Hübenthal

unread,
Jan 18, 2013, 11:46:05 AM1/18/13
to quick...@googlegroups.com

The amount og clients is low but we suspect that idle connections is not closed because of a stupid configuration "error" which means that i had set idle timeout to many days. We will start there and see how it goes.

--
You received this message because you are subscribed to the Google Groups "quickserver" group.
To unsubscribe from this group, send email to quickserver...@googlegroups.com.
Visit this group at http://groups.google.com/group/quickserver?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply all
Reply to author
Forward
0 new messages