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: (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