danikula / AndroidVideoCache

Cache support for any video player with help of single line
Apache License 2.0
5.42k stars 1.15k forks source link

Error closing socket input stream. Version: 2.7.1 #223

Open selimonline opened 5 years ago

selimonline commented 5 years ago

Device : Samsung s7 Version : 2.7.1 Sdk Version : 27

HttpProxyCacheServer proxy = new HttpProxyCacheServer(this); String proxyUrl = proxy.getProxyUrl("HTTPS URL");

here is details logs :

26503-27478/com.oevo E/HttpProxyCacheServer: HttpProxyCacheServer error com.danikula.videocache.ProxyCacheException: Error closing socket input stream. Version: 2.7.1 at com.danikula.videocache.HttpProxyCacheServer.closeSocketInput(HttpProxyCacheServer.java:287) at com.danikula.videocache.HttpProxyCacheServer.releaseSocket(HttpProxyCacheServer.java:272) at com.danikula.videocache.HttpProxyCacheServer.processSocket(HttpProxyCacheServer.java:245) at com.danikula.videocache.HttpProxyCacheServer.access$200(HttpProxyCacheServer.java:54) at com.danikula.videocache.HttpProxyCacheServer$SocketProcessorRunnable.run(HttpProxyCacheServer.java:340) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) at java.lang.Thread.run(Thread.java:764) Caused by: java.io.IOException: shutdown failed: ENOTCONN (Transport endpoint is not connected) at java.net.PlainSocketImpl.socketShutdown(PlainSocketImpl.java:267) at java.net.AbstractPlainSocketImpl.shutdownInput(AbstractPlainSocketImpl.java:582) at java.net.Socket.shutdownInput(Socket.java:1565) at com.danikula.videocache.HttpProxyCacheServer.closeSocketInput(HttpProxyCacheServer.java:280) at com.danikula.videocache.HttpProxyCacheServer.releaseSocket(HttpProxyCacheServer.java:272)  at com.danikula.videocache.HttpProxyCacheServer.processSocket(HttpProxyCacheServer.java:245)  at com.danikula.videocache.HttpProxyCacheServer.access$200(HttpProxyCacheServer.java:54)  at com.danikula.videocache.HttpProxyCacheServer$SocketProcessorRunnable.run(HttpProxyCacheServer.java:340)  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458)  at java.util.concurrent.FutureTask.run(FutureTask.java:266)  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)  at java.lang.Thread.run(Thread.java:764)  Caused by: android.system.ErrnoException: shutdown failed: ENOTCONN (Transport endpoint is not connected) at libcore.io.Linux.shutdown(Native Method) at libcore.io.ForwardingOs.shutdown(ForwardingOs.java:176)

Umesh-Kumar19 commented 4 years ago

same issue +1

pravynandas commented 4 years ago

Same issue +1

wcdxg commented 4 years ago

+1

gongkaiqiang commented 4 years ago

+1

pratikbutani commented 4 years ago

If you can't solve it. Please add all the issue in lable hacktoberfest so someone may help.

Hope everyone agreed.

verketh commented 4 years ago

+1

neopraveen commented 3 years ago

Same here +1

czw299 commented 3 years ago

same

KuiGoan commented 3 years ago

Same +1

kksingla commented 3 years ago

same +1

micromingle commented 3 years ago

same +1 @danikula Are you ok , we worry about you .

bhumikash-tech commented 3 years ago

same, I also got the same error. @danikula please update its kinda urgent. Or if anyone got the solution please reply to this problem.

goodnightmycat commented 2 years ago

image change the if statement to if (!socket.isInputShutdown()&&socket.isConnected()) might fix the error

fatemi2020 commented 2 years ago

same +1 Samsung A71

pravynandas commented 2 years ago

I think the bug waited long enough. I'm gonna attempt to find a fix or at least get the bottom of the issue. Inputs, suggestions, comments or concerns are all welcome.

zhouhuandev commented 2 years ago

same +1

haybl commented 2 years ago

same exception when using MediaPlayer, but not in ExoPlayer.

Jamoliddin2001 commented 2 years ago

Change cache directory

val proxyServer = HttpProxyCacheServer .Builder(context) .cacheDirectory(context.filesDir) .maxCacheSize(1024 * 1024 * 1024) .build() val proxyURL = proxyServer.getProxyUrl(sourceUrl)

arturorey91 commented 1 year ago

+1

Berkay92 commented 1 year ago

Hi everyone who is suffering from this disgusting error! I have figured out something in my source code that causes this error.

I was trying to open a connection from a URL and then read the InputStream for my use case.

try {
    URLConnection conn = new URL(proxyUrl).openConnection();
    conn.setConnectTimeout(5000);
    conn.setReadTimeout(5000);
    conn.connect();
    is = conn.getInputStream();

} catch (MalformedURLException e) {
    throw new RuntimeException(e);
} catch (IOException e) {
    throw new RuntimeException(e);
}

When I try to remove these lines, the error has gone. I hope this information will also help you identify the root cause.

Happy coding..