ioexception: too many open files error

124 views
Skip to first unread message

Edward Bridges

unread,
Mar 2, 2015, 7:01:07 PM3/2/15
to littl...@googlegroups.com
Hi,

After running the following commands on a Mac (Yosemite) using master:

$ mvn  package -Dmaven.test.skip=true
$ java -jar  target/littleproxy-1.1.0-beta1-SNAPSHOT-littleproxy-shade.jar --mitm --port=9000

I tried to access the resulting service using a POST request:

$ curl --data 'email=f...@example.com&password=12qw12qw&isClient=true' http://localhost:9000/api/1/auth/Login
curl: (52) Empty reply from server

The server log generates this output:

$ java -jar  target/littleproxy-1.1.0-beta1-SNAPSHOT-littleproxy-shade.jar --mitm --port=9000
0      2015-03-02 14:11:26,302 INFO  [main] proxy.Launcher (?:?).?() - Running LittleProxy with args: [--mitm, --port=9000]
About to start server on port: 9000
45     2015-03-02 14:11:26,347 INFO  [main] proxy.Launcher (?:?).?() - Running as Man in the Middle
47     2015-03-02 14:11:26,349 INFO  [main] extras.SelfSignedSslEngineSource (?:?).?() - Not deleting keystore
About to start...
207    2015-03-02 14:11:26,509 INFO  [main] impl.DefaultHttpProxyServer (?:?).?() - Starting proxy at address: 0.0.0.0/0.0.0.0:9000
228    2015-03-02 14:11:26,530 INFO  [main] impl.DefaultHttpProxyServer (?:?).?() - Proxy listening with TCP transport
292    2015-03-02 14:11:26,594 INFO  [main] impl.DefaultHttpProxyServer (?:?).?() - Proxy started at address: /0:0:0:0:0:0:0:0:9000
219678 2015-03-02 14:15:05,980 WARN  [LittleProxy-ClientToProxyAcceptor-0] channel.DefaultChannelPipeline (?:?).?() - An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
java.io.IOException: Too many open files
at sun.nio.ch.ServerSocketChannelImpl.accept0(Native Method)
at sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:241)
at io.netty.channel.socket.nio.NioServerSocketChannel.doReadMessages(NioServerSocketChannel.java:135)
at io.netty.channel.nio.AbstractNioMessageChannel$NioMessageUnsafe.read(AbstractNioMessageChannel.java:68)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116)
at java.lang.Thread.run(Thread.java:745)

The system limits are set as follows (10240 is the limit on Yosemite):

$ sudo launchctl limit maxfiles 2048 unlimited
$ launchctl limit maxfiles
maxfiles    2048           10240

As a test I inserted a call to ulimit -a in the code itself (using java.lang.Runtime#exec() in org.littleshoot.proxy.impl.ProxyToServerConnection) that confirms it's bumping up against a max:

core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
file size               (blocks, -f) unlimited
max locked memory       (kbytes, -l) unlimited
max memory size         (kbytes, -m) unlimited
open files                      (-n) 10240
pipe size            (512 bytes, -p) 1
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 709
virtual memory          (kbytes, -v) unlimited

Please advise how I may work around this? Or, is there some configuration setting I'm missing somewhere?

Thanks,
Ed

Edward Bridges

unread,
Mar 3, 2015, 10:08:44 AM3/3/15
to littl...@googlegroups.com
Note there's a similar issue arising from a different source here: https://github.com/adamfisk/LittleProxy/issues/180
Reply all
Reply to author
Forward
0 new messages