java.net.SocketException: Too many open files

100 views
Skip to first unread message

Eduardo Rodrigues

unread,
Sep 9, 2011, 2:16:08 PM9/9/11
to cometd...@googlegroups.com
I've got the error below,
Any idea?
 
 
 
2011-09-09 18:13:39.324:DBUG:org.cometd.oort.Oort-http://remotecometd2:8080/cometd:Failure, messages: [{"id":"3122","supportedConnectionTypes":["long-polling"],"channel":"/meta/handshake","ext":{"org.cometd.oort":{"oortURL":"http://remotecometd2:8080/cometd","cometURL":"http://remotecometd1:8080/cometd","oortSecret":"QgRxExDAsS4cG2Rl+XZaSNNQfYQ="}},"version":"1.0"}]
java.net.SocketException: Too many open files
        at sun.nio.ch.Net.socket0(Native Method)
        at sun.nio.ch.Net.socket(Net.java:115)
        at sun.nio.ch.SocketChannelImpl.<init>(SocketChannelImpl.java:102)
        at sun.nio.ch.SelectorProviderImpl.openSocketChannel(SelectorProviderImpl.java:55)
        at java.nio.channels.SocketChannel.open(SocketChannel.java:122)
        at org.eclipse.jetty.client.SelectConnector.startConnection(SelectConnector.java:92)
        at org.eclipse.jetty.client.HttpDestination.startNewConnection(HttpDestination.java:265)
        at org.eclipse.jetty.client.HttpDestination.doSend(HttpDestination.java:552)
        at org.eclipse.jetty.client.HttpDestination.send(HttpDestination.java:490)
        at org.eclipse.jetty.client.HttpClient.send(HttpClient.java:178)
        at org.cometd.client.transport.LongPollingTransport.send(LongPollingTransport.java:165)
        at org.cometd.client.BayeuxClient$BayeuxClientState.send(BayeuxClient.java:1298)
        at org.cometd.client.BayeuxClient.sendHandshake(BayeuxClient.java:365)
        at org.cometd.client.BayeuxClient$10.run(BayeuxClient.java:753)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:165)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:636)
2011-09-09 18:13:39.324:WARN:org.cometd.oort.Oort-http://remotecometd2:8080/cometd:Failed to connect to comet http://remotecometd1:8080/cometd, message {"message":[{"id":"3122","supportedConnectionTypes":["long-polling"],"channel":"/meta/handshake","ext":{"org.cometd.oort":{"oortURL":"http://remotecometd2:8080/cometd","cometURL":"http://remotecometd1:8080/cometd","oortSecret":"QgRxExDAsS4cG2Rl+XZaSNNQfYQ="}},"version":"1.0"}],"id":"3122","exception":"java.net.SocketException: Too many open files","successful":false,"channel":"/meta/handshake"}

Simone Bordet

unread,
Sep 9, 2011, 4:40:14 PM9/9/11
to cometd...@googlegroups.com
Hi,

On Fri, Sep 9, 2011 at 20:16, Eduardo Rodrigues
<r.eduard...@gmail.com> wrote:
> I've got the error below,
> Any idea?

Too small value configured in the OS for file descriptors.

ulimit -n if you are in Linux.

Simon
--
http://bordet.blogspot.com
---
Finally, no matter how good the architecture and design are,
to deliver bug-free software with optimal performance and reliability,
the implementation technique must be flawless.   Victoria Livschitz

Eduardo Rodrigues

unread,
Sep 11, 2011, 7:41:12 AM9/11/11
to cometd...@googlegroups.com
Simon,
 
which process in the cometd creates these many files?
which files are these?


--
You received this message because you are subscribed to the Google Groups "cometd-users" group.
To post to this group, send email to cometd...@googlegroups.com
To unsubscribe from this group, send email to cometd-users...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cometd-users

Visit the CometD website at http://www.cometd.org

Martin Hewitt

unread,
Sep 11, 2011, 7:51:00 AM9/11/11
to cometd...@googlegroups.com
Eduardo,

On Linux, every open socket, thread etc counts towards the file descriptor limit. 

Look through your code and find (and name) your thread pools, then you can see which are necessary and which are too large. Dialling down the size of fixed thread pools can help you avoid these exceptions. 

Martin

Sent from my iPhone

Eduardo Rodrigues

unread,
Sep 11, 2011, 11:28:26 AM9/11/11
to cometd...@googlegroups.com
Hi Martin,
 
tks.
 
I'm not realy a Linux user.
 
The only thing runnig on this machine is the cometd instance.
Is this something I can fix with cometd configuration?
 
regards,
Edu

Simone Bordet

unread,
Sep 11, 2011, 1:13:21 PM9/11/11
to cometd...@googlegroups.com
Hi,

On Sun, Sep 11, 2011 at 17:28, Eduardo Rodrigues
<r.eduard...@gmail.com> wrote:
> Hi Martin,
>
> tks.
>
> I'm not realy a Linux user.
>
> The only thing runnig on this machine is the cometd instance.
> Is this something I can fix with cometd configuration?

It's not the CometD configuration, it's the OS configuration.
See http://cometd.org/documentation/2.x/howtos/loadtesting, in particular:

ulimit -n

as I have already said in a previous email.
Some googling will help you out, depending on the OS you are on (which
you have not tell precisely).

Reply all
Reply to author
Forward
0 new messages