We observed the following crash occurred randomly when loading some pages (this one happened when loading a page on https://www.marca.com, but was not reproducible as it did not crash when opening the same page a second time):
2019-01-31 12:16:14.369 27534-28206/? I/NetBare: [TCP][105.53.65.253:443]Write to proxy: 38
2019-01-31 12:16:14.369 27534-28206/? I/NetBare: [TCP][214.191.162.41:443]Read from remote: 3031
2019-01-31 12:16:14.384 27534-28206/? I/NetBare: [TCP][214.191.162.41:443]Write to remote: 318
2019-01-31 12:16:14.384 27534-28206/? E/NativeCrypto: AppData::create pipe(2) failed: Too many open files
2019-01-31 12:16:14.388 27534-28206/? E/AndroidRuntime: FATAL EXCEPTION: TcpProxyServer
Process: com.github.megatronking.netbare.sample, PID: 27534
java.lang.RuntimeException: javax.net.ssl.SSLException: Unable to create application data
at com.android.org.conscrypt.ConscryptEngine.newSsl(ConscryptEngine.java:198)
at com.android.org.conscrypt.ConscryptEngine.(ConscryptEngine.java:173)
at com.android.org.conscrypt.OpenSSLContextImpl.engineCreateSSLEngine(OpenSSLContextImpl.java:138)
at javax.net.ssl.SSLContext.createSSLEngine(SSLContext.java:363)
at com.github.megatronking.netbare.ssl.SSLEngineFactory.createServerEngine(SSLEngineFactory.java:122)
at com.github.megatronking.netbare.ssl.SSLRequestCodec.createEngine(SSLRequestCodec.java:65)
at com.github.megatronking.netbare.http.SSLHttpRequestCodec.createEngine(SSLHttpRequestCodec.java:50)
at com.github.megatronking.netbare.ssl.SSLCodec.decode(SSLCodec.java:137)
at com.github.megatronking.netbare.http.SSLCodecInterceptor.decodeRequest(SSLCodecInterceptor.java:204)
at com.github.megatronking.netbare.http.SSLCodecInterceptor.access$200(SSLCodecInterceptor.java:40)
at com.github.megatronking.netbare.http.SSLCodecInterceptor$1.onResult(SSLCodecInterceptor.java:126)
at com.github.megatronking.netbare.http.SSLHttpResponseCodec.decode(SSLHttpResponseCodec.java:74)
at com.github.megatronking.netbare.http.SSLCodecInterceptor.decodeResponse(SSLCodecInterceptor.java:232)
at com.github.megatronking.netbare.http.SSLCodecInterceptor.intercept(SSLCodecInterceptor.java:152)
at com.github.megatronking.netbare.http.HttpIndexInterceptor.intercept(HttpIndexInterceptor.java:71)
at com.github.megatronking.netbare.http.HttpResponseChain.processNext(HttpResponseChain.java:55)
at com.github.megatronking.netbare.http.HttpResponseChain.processNext(HttpResponseChain.java:32)
at com.github.megatronking.netbare.gateway.InterceptorChain.process(InterceptorChain.java:95)
at com.github.megatronking.netbare.http.HttpSniffInterceptor.intercept(HttpSniffInterceptor.java:71)
at com.github.megatronking.netbare.http.HttpIndexInterceptor.intercept(HttpIndexInterceptor.java:71)
at com.github.megatronking.netbare.http.HttpResponseChain.processNext(HttpResponseChain.java:55)
at com.github.megatronking.netbare.http.HttpResponseChain.processNext(HttpResponseChain.java:32)
at com.github.megatronking.netbare.gateway.InterceptorChain.process(InterceptorChain.java:95)
at com.github.megatronking.netbare.http.HttpVirtualGateway.onSpecResponse(HttpVirtualGateway.java:118)
at com.github.megatronking.netbare.gateway.SpecVirtualGateway.sendResponse(SpecVirtualGateway.java:78)
at com.github.megatronking.netbare.NetBareVirtualGateway.sendResponse(NetBareVirtualGateway.java:102)
at com.github.megatronking.netbare.tunnel.TcpVATunnel$2.onRead(TcpVATunnel.java:134)
at com.github.megatronking.netbare.tunnel.NioTunnel.onRead(NioTunnel.java:101)
at com.github.megatronking.netbare.proxy.TcpProxyServer.process(TcpProxyServer.java:139)
at com.github.megatronking.netbare.proxy.BaseProxyServer.run(BaseProxyServer.java:62)
at com.github.megatronking.netbare.proxy.TcpProxyServer.run(TcpProxyServer.java:108)
at java.lang.Thread.run(Thread.java:764)
Caused by: javax.net.ssl.SSLException: Unable to create application data
at com.android.org.conscrypt.NativeCrypto.SSL_new(Native Method)
at com.android.org.conscrypt.SslWrapper.newInstance(SslWrapper.java:58)
at com.android.org.conscrypt.ConscryptEngine.newSsl(ConscryptEngine.java:196)
at com.android.org.conscrypt.ConscryptEngine.(ConscryptEngine.java:173)
at com.android.org.conscrypt.OpenSSLContextImpl.engineCreateSSLEngine(OpenSSLContextImpl.java:138)
at javax.net.ssl.SSLContext.createSSLEngine(SSLContext.java:363)
at com.github.megatronking.netbare.ssl.SSLEngineFactory.createServerEngine(SSLEngineFactory.java:122)
at com.github.megatronking.netbare.ssl.SSLRequestCodec.createEngine(SSLRequestCodec.java:65)
at com.github.megatronking.netbare.http.SSLHttpRequestCodec.createEngine(SSLHttpRequestCodec.java:50)
at com.github.megatronking.netbare.ssl.SSLCodec.decode(SSLCodec.java:137)
at com.github.megatronking.netbare.http.SSLCodecInterceptor.decodeRequest(SSLCodecInterceptor.java:204)
at com.github.megatronking.netbare.http.SSLCodecInterceptor.access$200(SSLCodecInterceptor.java:40)
at com.github.megatronking.netbare.http.SSLCodecInterceptor$1.onResult(SSLCodecInterceptor.java:126)
at com.github.megatronking.netbare.http.SSLHttpResponseCodec.decode(SSLHttpResponseCodec.java:74)
at com.github.megatronking.netbare.http.SSLCodecInterceptor.decodeResponse(SSLCodecInterceptor.java:232)
at com.github.megatronking.netbare.http.SSLCodecInterceptor.intercept(SSLCodecInterceptor.java:152)
at com.github.megatronking.netbare.http.HttpIndexInterceptor.intercept(HttpIndexInterceptor.java:71)
at com.github.megatronking.netbare.http.HttpResponseChain.processNext(HttpResponseChain.java:55)
at com.github.megatronking.netbare.http.HttpResponseChain.processNext(HttpResponseChain.java:32)
at com.github.megatronking.netbare.gateway.InterceptorChain.process(InterceptorChain.java:95)
at com.github.megatronking.netbare.http.HttpSniffInterceptor.intercept(HttpSniffInterceptor.java:71)
at com.github.megatronking.netbare.http.HttpIndexInterceptor.intercept(HttpIndexInterceptor.java:71)
at com.github.megatronking.netbare.http.HttpResponseChain.processNext(HttpResponseChain.java:55)
at com.github.megatronking.netbare.http.HttpResponseChain.processNext(HttpResponseChain.java:32)
at com.github.megatronking.netbare.gateway.InterceptorChain.process(InterceptorChain.java:95)
at com.github.megatronking.netbare.http.HttpVirtualGateway.onSpecResponse(HttpVirtualGateway.java:118)
at com.github.megatronking.netbare.gateway.SpecVirtualGateway.sendResponse(SpecVirtualGateway.java:78)
at com.github.megatronking.netbare.NetBareVirtualGateway.sendResponse(NetBareVirtualGateway.java:102)
at com.github.megatronking.netbare.tunnel.TcpVATunnel$2.onRead(TcpVATunnel.java:134)
at com.github.megatronking.netbare.tunnel.NioTunnel.onRead(NioTunnel.java:101)
at com.github.megatronking.netbare.proxy.TcpProxyServer.process(TcpProxyServer.java:139)
at com.github.megatronking.netbare.proxy.BaseProxyServer.run(BaseProxyServer.java:62)
at com.github.megatronking.netbare.proxy.TcpProxyServer.run(TcpProxyServer.java:108)
at java.lang.Thread.run(Thread.java:764)
2019-01-31 12:16:14.408 1724-1811/? I/ActivityManager: Showing crash dialog for package com.github.megatronking.netbare.sample u0
2019-01-31 12:16:14.420 1724-28695/? W/DropBoxManagerService: Dropping: data_app_crash (3606 > 0 bytes)
2019-01-31 12:16:14.427 1724-1810/? W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.stats.service.DropBoxEntryAddedReceiver
2019-01-31 12:16:14.427 1724-1810/? W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver
2019-01-31 12:16:14.502 30383-30383/? W/cr_Autocomplete: stopping autocomplete.
A similar crash happened on a different page. Not 100% reproducible, seems to happen randomly.
I suppose possible too many alive connections, it might exhaust the resources.
Yeah, makes sense. I just tested after your latest changes and it is still happening randomly on different pages.