Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to reslove this problem- java.io.IOException: shutdown failed: ENOTCONN (Transport endpoint is not connected) #217

Open
issacluo opened this issue Sep 7, 2018 · 9 comments

Comments

@issacluo
Copy link

issacluo commented Sep 7, 2018

java.io.IOException: shutdown failed: ENOTCONN (Transport endpoint is not connected)
E/HttpProxyCacheServer: HttpProxyCacheServer error
com.danikula.videocache.ProxyCacheException: Error closing socket input stream
at com.danikula.videocache.HttpProxyCacheServer.closeSocketInput(HttpProxyCacheServer.java:284)
at com.danikula.videocache.HttpProxyCacheServer.releaseSocket(HttpProxyCacheServer.java:269)
at com.danikula.videocache.HttpProxyCacheServer.processSocket(HttpProxyCacheServer.java:242)
at com.danikula.videocache.HttpProxyCacheServer.access$200(HttpProxyCacheServer.java:52)
at com.danikula.videocache.HttpProxyCacheServer$SocketProcessorRunnable.run(HttpProxyCacheServer.java:337)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
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:782)
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:583)
at java.net.Socket.shutdownInput(Socket.java:1566)
at com.danikula.videocache.HttpProxyCacheServer.closeSocketInput(HttpProxyCacheServer.java:277)
at com.danikula.videocache.HttpProxyCacheServer.releaseSocket(HttpProxyCacheServer.java:269) 
at com.danikula.videocache.HttpProxyCacheServer.processSocket(HttpProxyCacheServer.java:242) 
at com.danikula.videocache.HttpProxyCacheServer.access$200(HttpProxyCacheServer.java:52) 
at com.danikula.videocache.HttpProxyCacheServer$SocketProcessorRunnable.run(HttpProxyCacheServer.java:337) 
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457) 
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:782) 
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)
at java.net.PlainSocketImpl.socketShutdown(PlainSocketImpl.java:265)
at java.net.AbstractPlainSocketImpl.shutdownInput(AbstractPlainSocketImpl.java:583) 
at java.net.Socket.shutdownInput(Socket.java:1566) 
at com.danikula.videocache.HttpProxyCacheServer.closeSocketInput(HttpProxyCacheServer.java:277) 
at com.danikula.videocache.HttpProxyCacheServer.releaseSocket(HttpProxyCacheServer.java:269) 
at com.danikula.videocache.HttpProxyCacheServer.processSocket(HttpProxyCacheServer.java:242) 
at com.danikula.videocache.HttpProxyCacheServer.access$200(HttpProxyCacheServer.java:52) 
at com.danikula.videocache.HttpProxyCacheServer$SocketProcessorRunnable.run(HttpProxyCacheServer.java:337) 
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457) 
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:782) 
09-07 15:45:26.669 125-125/? E/HWComposer: Invalid layer type change: SolidColor --> Device
09-07 15:45:26.686 125-125/? E/HWComposer: Invalid layer type change: SolidColor --> Device
09-07 15:45:26.701 669-788/? E/WindowManager: win=Window{89850a3 u0 com.gzcf.policeaffairop/com.gzcf.policeaffairop.activity.CzgcActivity EXITING} destroySurfaces: appStopped=false win.mWindowRemovalAllowed=true win.mRemoveOnExit=true
09-07 15:45:26.703 125-125/? E/HWComposer: Invalid layer type change: SolidColor --> Device
09-07 15:45:26.807 199-13933/? E/FFMPEGExtractor: FFMPEGExtractor Failed open file (err = -13): http://127.0.0.1:36096/http%3A%2F%2F192.168.10.124%3A9290%2Ffileserver%2Ffile%2FdownloadFile.do%3Fid%3D9105b2a1-dcca-4d8d-8ba8-96618302bf9e

@JanesenGit
Copy link

me too

@Faiyyaz
Copy link

Faiyyaz commented Sep 25, 2018

I am facing this issue too in oreo devices

@sivasonai
Copy link

sivasonai commented Apr 24, 2019

Me too facing this issue while playing some of the videos. If anybody can be fixed this issue. Please help to solve this issue.

@hxiaoyu1218
Copy link

me too when i seek the audio gei this exception

@onexuan
Copy link

onexuan commented Apr 25, 2020

me too @danikula

@MadTracki
Copy link

Reproducing

For me this error occurs while using ExoPlayer and seeking in the video to a part which hasn't been downloaded by the Proxy yet. This results in a situation where the ExoPlayer closes the current socket (which still receives data) and instead opens a new HTTP GET request with a Range: bytes=XXXXX- Header.

I investigated a bit and found out, that danikula implemented a fix in 2.5.0 for seeking in videos, see #21 and #17.
And not surprisingly 2.5.0 fixes this problem and the above mentioned error does not happen (there are still some other errors, because ExoPlayer did close the socket).
However in newer versions of AndroidVideoCache (>= 2.6.0) the above mentioned error occures. But in reality those are two different errors.

  1. Socket closing error
E/HttpProxyCacheServer: HttpProxyCacheServer error
    com.danikula.videocache.ProxyCacheException: Error closing socket input stream. Version: 2.7.0
        at com.danikula.videocache.HttpProxyCacheServer.closeSocketInput(HttpProxyCacheServer.java:285)
        at com.danikula.videocache.HttpProxyCacheServer.releaseSocket(HttpProxyCacheServer.java:270)
        at com.danikula.videocache.HttpProxyCacheServer.processSocket(HttpProxyCacheServer.java:243)
        at com.danikula.videocache.HttpProxyCacheServer.access$200(HttpProxyCacheServer.java:52)
        at com.danikula.videocache.HttpProxyCacheServer$SocketProcessorRunnable.run(HttpProxyCacheServer.java:338)
    Caused by: java.io.IOException: shutdown failed: ENOTCONN (Transport endpoint is not connected)
        at java.net.PlainSocketImpl.socketShutdown(PlainSocketImpl.java:283)
W/HttpProxyCacheServer: Failed to close socket on proxy side: shutdown failed: ENOTCONN (Transport endpoint is not connected). It seems client have already closed connection.
  1. Followed by the GET Range Request for the seeked video which produces the following exception
E/LoadTask: Unexpected exception loading stream
      java.lang.IllegalArgumentException: byteCount < 0: -157090173
        at com.android.okhttp.okio.RealBufferedSource.read(RealBufferedSource.java:47)
        at com.android.okhttp.internal.http.Http1xStream$FixedLengthSource.read(Http1xStream.java:395)
        at com.android.okhttp.internal.Util.skipAll(Util.java:165)
E/HttpProxyCacheServer: HttpProxyCacheServer error
    com.danikula.videocache.ProxyCacheException: Error closing socket input stream. Version: 2.7.0
        at com.danikula.videocache.HttpProxyCacheServer.closeSocketInput(HttpProxyCacheServer.java:285)
        at com.danikula.videocache.HttpProxyCacheServer.releaseSocket(HttpProxyCacheServer.java:270)
        at com.danikula.videocache.HttpProxyCacheServer.processSocket(HttpProxyCacheServer.java:243)
    Caused by: java.io.IOException: shutdown failed: ENOTCONN (Transport endpoint is not connected)
        at java.net.PlainSocketImpl.socketShutdown(PlainSocketImpl.java:283)

Solution

Use version 2.5.0 (and add android.useNewApkCreator=false to gradle.properties if you get a build error) until @danikula finds out what is causing this problem.

@danikula could you please recheck if some of your changes from 2.5.0 were lost in the upgrade to 2.6.0?

@KryptKode
Copy link

Any solutions to this error?

@MadTracki
Copy link

@KryptKode I already used ExoPlayer and found that it already has an existing Caching implementation. Therefore it was an easy choice to switch to CachedDataSource in ExoPlayer.

See this StackOverflow thread for more information on this topic. (Unfortunately the ExoPlayer Documentation does not provide documentation about the wonderful Caching feature in this library)

@fengmingye
Copy link

I fix this issue by down to version: 2.6.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants