AndroidVideoCache: Error pinging server

In some cases local server cache proxy is not pinged. One known problem is system proxy in connection’s settings (wi-fi or apn). May be some another reasons exist. Typical stacktrace is


E/Pinger: Error reading ping response
          com.danikula.videocache.ProxyCacheException: Error opening connection for http://127.0.0.1:52645/ping with offset 0
              at com.danikula.videocache.HttpUrlSource.open(HttpUrlSource.java:75)
              at com.danikula.videocache.Pinger.pingServer(Pinger.java:86)
              at com.danikula.videocache.Pinger.access$100(Pinger.java:28)
              at com.danikula.videocache.Pinger$PingCallable.call(Pinger.java:108)
              at com.danikula.videocache.Pinger$PingCallable.call(Pinger.java:104)
              at java.util.concurrent.FutureTask.run(FutureTask.java:237)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
              at java.lang.Thread.run(Thread.java:818)
           Caused by: java.io.FileNotFoundException: http://127.0.0.1:52645/ping
              at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:238)
              at com.danikula.videocache.HttpUrlSource.open(HttpUrlSource.java:70)
              at com.danikula.videocache.Pinger.pingServer(Pinger.java:86) 
              at com.danikula.videocache.Pinger.access$100(Pinger.java:28) 
              at com.danikula.videocache.Pinger$PingCallable.call(Pinger.java:108) 
              at com.danikula.videocache.Pinger$PingCallable.call(Pinger.java:104) 
              at java.util.concurrent.FutureTask.run(FutureTask.java:237) 
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
              at java.lang.Thread.run(Thread.java:818) 
E/Pinger: Error reading ping response
          com.danikula.videocache.ProxyCacheException: Error opening connection for http://127.0.0.1:52645/ping with offset 0
              at com.danikula.videocache.HttpUrlSource.open(HttpUrlSource.java:75)
              at com.danikula.videocache.Pinger.pingServer(Pinger.java:86)
              at com.danikula.videocache.Pinger.access$100(Pinger.java:28)
              at com.danikula.videocache.Pinger$PingCallable.call(Pinger.java:108)
              at com.danikula.videocache.Pinger$PingCallable.call(Pinger.java:104)
              at java.util.concurrent.FutureTask.run(FutureTask.java:237)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
              at java.lang.Thread.run(Thread.java:818)
           Caused by: java.io.FileNotFoundException: http://127.0.0.1:52645/ping
              at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:238)
              at com.danikula.videocache.HttpUrlSource.open(HttpUrlSource.java:70)
              at com.danikula.videocache.Pinger.pingServer(Pinger.java:86) 
              at com.danikula.videocache.Pinger.access$100(Pinger.java:28) 
              at com.danikula.videocache.Pinger$PingCallable.call(Pinger.java:108) 
              at com.danikula.videocache.Pinger$PingCallable.call(Pinger.java:104) 
              at java.util.concurrent.FutureTask.run(FutureTask.java:237) 
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
              at java.lang.Thread.run(Thread.java:818) 
E/Pinger: Error reading ping response
          com.danikula.videocache.ProxyCacheException: Error opening connection for http://127.0.0.1:52645/ping with offset 0
              at com.danikula.videocache.HttpUrlSource.open(HttpUrlSource.java:75)
              at com.danikula.videocache.Pinger.pingServer(Pinger.java:86)
              at com.danikula.videocache.Pinger.access$100(Pinger.java:28)
              at com.danikula.videocache.Pinger$PingCallable.call(Pinger.java:108)
              at com.danikula.videocache.Pinger$PingCallable.call(Pinger.java:104)
              at java.util.concurrent.FutureTask.run(FutureTask.java:237)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
              at java.lang.Thread.run(Thread.java:818)
           Caused by: java.io.FileNotFoundException: http://127.0.0.1:52645/ping
              at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:238)
              at com.danikula.videocache.HttpUrlSource.open(HttpUrlSource.java:70)
              at com.danikula.videocache.Pinger.pingServer(Pinger.java:86) 
              at com.danikula.videocache.Pinger.access$100(Pinger.java:28) 
              at com.danikula.videocache.Pinger$PingCallable.call(Pinger.java:108) 
              at com.danikula.videocache.Pinger$PingCallable.call(Pinger.java:104) 
              at java.util.concurrent.FutureTask.run(FutureTask.java:237) 
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
              at java.lang.Thread.run(Thread.java:818) 
E/Pinger: Error pinging server (attempts: 3, max timeout: 280). If you see this message, please, email me danikula@gmail.com or create issue here https://github.com/danikula/AndroidVideoCache/issues
          com.danikula.videocache.ProxyCacheException: Error pinging server (attempts: 3, max timeout: 280). If you see this message, please, email me danikula@gmail.com or create issue here https://github.com/danikula/AndroidVideoCache/issues
              at com.danikula.videocache.Pinger.ping(Pinger.java:67)
              at com.danikula.videocache.HttpProxyCacheServer.isAlive(HttpProxyCacheServer.java:182)
              at com.danikula.videocache.HttpProxyCacheServer.getProxyUrl(HttpProxyCacheServer.java:119)
              at com.danikula.videocache.HttpProxyCacheServer.getProxyUrl(HttpProxyCacheServer.java:100)
              at com.danikula.videocache.sample.VideoFragment.startVideo(VideoFragment.java:59)
              at com.danikula.videocache.sample.VideoFragment.afterViewInjected(VideoFragment.java:44)
              at com.danikula.videocache.sample.VideoFragment_.onViewChanged(VideoFragment_.java:107)
              at org.androidannotations.api.view.OnViewChangedNotifier.notifyViewChanged(OnViewChangedNotifier.java:41)
              at com.danikula.videocache.sample.VideoFragment_.onViewCreated(VideoFragment_.java:72)
              at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1097)
              at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1259)
              at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738)
              at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1624)
              at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:330)
              at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:547)
              at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1237)
              at android.app.Activity.performStart(Activity.java:6268)
              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2379)
              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
              at android.app.ActivityThread.-wrap11(ActivityThread.java)
              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
              at android.os.Handler.dispatchMessage(Handler.java:102)
              at android.os.Looper.loop(Looper.java:148)
              at android.app.ActivityThread.main(ActivityThread.java:5417)
              at java.lang.reflect.Method.invoke(Native Method)
              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 71 (1 by maintainers)

Most upvoted comments

hey! i had this issue in Api 29 lib version 2.7.1. The problemis the http protocol in proxy settings, this will be https for new versions of android. I fix it add new xml file for networkconfig: <network-security-config> <domain-config cleartextTrafficPermitted="true"> <domain includeSubdomains="true">127.0.0.1</domain> </domain-config> <base-config cleartextTrafficPermitted="true"> <trust-anchors> <certificates src="system" /> </trust-anchors> </base-config> </network-security-config >

and add this configuration to application node <application android:networkSecurityConfig="@xml/network_config" ...

sorry by my poor english, enjoy! and thanks so much for library 😉

Hi. Using AndroidVideoCache version 2.7.0 I saw the log below, so here I am, reporting as asked 😃 Hope it helps somehow.

I was testing using AndroidVideoCache inside recyclerview rows to pre-load audio and video. Scrolling between a lot of items very fast, around list position 650 the log stack traces appeared:

08-01 23:37:33.905 16591-16591 W/Pinger: Error pinging server (attempt: 0, timeout: 70). 
08-01 23:37:34.046 16591-16591 W/Pinger: Error pinging server (attempt: 1, timeout: 140). 
08-01 23:37:34.326 16591-16591 W/Pinger: Error pinging server (attempt: 2, timeout: 280). 
08-01 23:37:34.335 16591-16591 E/Pinger: Error pinging server (attempts: 3, max timeout: 280). If you see this message, please, report at https://github.com/danikula/AndroidVideoCache/issues/134. Default proxies are: [DIRECT]
                                                          com.danikula.videocache.ProxyCacheException: Error pinging server (attempts: 3, max timeout: 280). If you see this message, please, report at https://github.com/danikula/AndroidVideoCache/issues/134. Default proxies are: [DIRECT]. Version: 2.7.0
                                                              at com.danikula.videocache.Pinger.ping(Pinger.java:73)
                                                              at com.danikula.videocache.HttpProxyCacheServer.isAlive(HttpProxyCacheServer.java:183)
                                                              at com.danikula.videocache.HttpProxyCacheServer.getProxyUrl(HttpProxyCacheServer.java:120)
                                                              at com.danikula.videocache.HttpProxyCacheServer.getProxyUrl(HttpProxyCacheServer.java:101)
                                                              at com.myapp.app.controller.AssetController.streamAsset(AssetController.java:117)
                                                              at com.myapp.app.ui.main.feed.cell.AppVideoCell.bind(AppVideoCell.java:38)
                                                              at com.myapp.app.ui.main.feed.AppListAdapter.onBindViewHolder(AppListAdapter.java:97)
                                                              at android.support.v7.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:6356)
                                                              at android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:6389)
                                                              at android.support.v7.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:5335)
                                                              at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5598)
                                                              at android.support.v7.widget.GapWorker.prefetchPositionWithDeadline(GapWorker.java:282)
                                                              at android.support.v7.widget.GapWorker.flushTaskWithDeadline(GapWorker.java:336)
                                                              at android.support.v7.widget.GapWorker.flushTasksWithDeadline(GapWorker.java:349)
                                                              at android.support.v7.widget.GapWorker.prefetch(GapWorker.java:356)
                                                              at android.support.v7.widget.GapWorker.run(GapWorker.java:387)
                                                              at android.os.Handler.handleCallback(Handler.java:751)
                                                              at android.os.Handler.dispatchMessage(Handler.java:95)
                                                              at android.os.Looper.loop(Looper.java:154)
                                                              at android.app.ActivityThread.main(ActivityThread.java:6126)
                                                              at java.lang.reflect.Method.invoke(Native Method)
                                                              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
                                                              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

(…)

08-01 23:37:34.543 16591-16591 W/Pinger: Error pinging server (attempt: 0, timeout: 70). 
08-01 23:37:34.685 16591-16591 W/Pinger: Error pinging server (attempt: 1, timeout: 140). 
08-01 23:37:34.966 16591-16591 W/Pinger: Error pinging server (attempt: 2, timeout: 280). 
08-01 23:37:34.969 16591-16591 E/Pinger: Error pinging server (attempts: 3, max timeout: 280). If you see this message, please, report at https://github.com/danikula/AndroidVideoCache/issues/134. Default proxies are: [DIRECT]
                                                          com.danikula.videocache.ProxyCacheException: Error pinging server (attempts: 3, max timeout: 280). If you see this message, please, report at https://github.com/danikula/AndroidVideoCache/issues/134. Default proxies are: [DIRECT]. Version: 2.7.0
                                                              at com.danikula.videocache.Pinger.ping(Pinger.java:73)
                                                              at com.danikula.videocache.HttpProxyCacheServer.isAlive(HttpProxyCacheServer.java:183)
                                                              at com.danikula.videocache.HttpProxyCacheServer.getProxyUrl(HttpProxyCacheServer.java:120)
                                                              at com.danikula.videocache.HttpProxyCacheServer.getProxyUrl(HttpProxyCacheServer.java:101)
                                                              at com.myapp.app.controller.AssetController.streamAsset(AssetController.java:117)
                                                              at com.myapp.app.ui.main.feed.cell.AppVideoCell.bind(AppVideoCell.java:38)
                                                              at com.myapp.app.ui.main.feed.AppListAdapter.onBindViewHolder(AppListAdapter.java:97)
                                                              at android.support.v7.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:6356)
                                                              at android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:6389)
                                                              at android.support.v7.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:5335)
                                                              at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5598)
                                                              at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5440)
                                                              at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5436)
                                                              at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2224)
                                                              at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1551)
                                                              at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1511)
                                                              at android.support.v7.widget.LinearLayoutManager.scrollBy(LinearLayoutManager.java:1325)
                                                              at android.support.v7.widget.LinearLayoutManager.scrollVerticallyBy(LinearLayoutManager.java:1061)
                                                              at android.support.v7.widget.RecyclerView$ViewFlinger.run(RecyclerView.java:4726)
                                                              at android.view.Choreographer$CallbackRecord.run(Choreographer.java:874)
                                                              at android.view.Choreographer.doCallbacks(Choreographer.java:686)
                                                              at android.view.Choreographer.doFrame(Choreographer.java:618)
                                                              at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:860)
                                                              at android.os.Handler.handleCallback(Handler.java:751)
                                                              at android.os.Handler.dispatchMessage(Handler.java:95)
                                                              at android.os.Looper.loop(Looper.java:154)
                                                              at android.app.ActivityThread.main(ActivityThread.java:6126)
                                                              at java.lang.reflect.Method.invoke(Native Method)
                                                              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
                                                              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

(…)

08-01 23:37:37.535 16591-20734 E/ProxyCache: ProxyCache error
                                                              com.danikula.videocache.ProxyCacheException: Error opening connection for http://api.myapp.com/asset/123 with offset 72932. Version: 2.7.0
                                                                  at com.danikula.videocache.HttpUrlSource.open(HttpUrlSource.java:75)
                                                                  at com.danikula.videocache.ProxyCache.readSource(ProxyCache.java:123)
                                                                  at com.danikula.videocache.ProxyCache.access$100(ProxyCache.java:19)
                                                                  at com.danikula.videocache.ProxyCache$SourceReaderRunnable.run(ProxyCache.java:187)
                                                                  at java.lang.Thread.run(Thread.java:761)
                                                               Caused by: java.io.FileNotFoundException: http://api.myapp.com/asset/123
                                                                  at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:250)
                                                                  at com.danikula.videocache.HttpUrlSource.open(HttpUrlSource.java:70)
                                                                  at com.danikula.videocache.ProxyCache.readSource(ProxyCache.java:123) 
                                                                  at com.danikula.videocache.ProxyCache.access$100(ProxyCache.java:19) 
                                                                  at com.danikula.videocache.ProxyCache$SourceReaderRunnable.run(ProxyCache.java:187) 
                                                                  at java.lang.Thread.run(Thread.java:761) 
08-01 23:37:37.537 16591-17446 E/HttpProxyCacheServer: HttpProxyCacheServer error
                                                                        com.danikula.videocache.ProxyCacheException: Error processing request. Version: 2.7.0
                                                                            at com.danikula.videocache.HttpProxyCacheServer.processSocket(HttpProxyCacheServer.java:241)
                                                                            at com.danikula.videocache.HttpProxyCacheServer.access$200(HttpProxyCacheServer.java:52)
                                                                            at com.danikula.videocache.HttpProxyCacheServer$SocketProcessorRunnable.run(HttpProxyCacheServer.java:338)
                                                                            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
                                                                            at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                                                            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
                                                                            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
                                                                            at java.lang.Thread.run(Thread.java:761)
                                                                         Caused by: com.danikula.videocache.ProxyCacheException: Error reading source 1 times. Version: 2.7.0
                                                                            at com.danikula.videocache.ProxyCache.checkReadSourceErrorsCount(ProxyCache.java:59)
                                                                            at com.danikula.videocache.ProxyCache.read(ProxyCache.java:45)
                                                                            at com.danikula.videocache.HttpProxyCache.responseWithCache(HttpProxyCache.java:79)
                                                                            at com.danikula.videocache.HttpProxyCache.processRequest(HttpProxyCache.java:45)
                                                                            at com.danikula.videocache.HttpProxyCacheServerClients.processRequest(HttpProxyCacheServerClients.java:42)
                                                                            at com.danikula.videocache.HttpProxyCacheServer.processSocket(HttpProxyCacheServer.java:234)
                                                                            at com.danikula.videocache.HttpProxyCacheServer.access$200(HttpProxyCacheServer.java:52) 
                                                                            at com.danikula.videocache.HttpProxyCacheServer$SocketProcessorRunnable.run(HttpProxyCacheServer.java:338) 
                                                                            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428) 
                                                                            at java.util.concurrent.FutureTask.run(FutureTask.java:237) 
                                                                            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 
                                                                            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) 
                                                                            at java.lang.Thread.run(Thread.java:761) 

i have solved by adding android:usesCleartextTraffic="true" to <application> in Manifest

This is becoming a recurring issue in our end. Anyone has leads on this issue? @danikula Do you have plans on fixing or probably investigating this issue? Or anyone knows any alternative library to use? Thanks.

In my case the issue is the target version you have chosen for your android application. if it’s android 9.0 or higher it will not work with legacy applications.

I simply resolved it by adding <uses-library android:name="org.apache.http.legacy" android:required="false" /> under my <application> in AndroidManifest.xml

Because server try to make an http request instead of an https request.

i have tried three solutions, but no one worked. 1.add android:usesCleartextTraffic="true" into AndroidManifest.xml application; 2.add android:networkSecurityConfig="@xml/network_security_config" into AndroidManifest.xml application; 3.add <uses-library android:name="org.apache.http.legacy" android:required="false" /> into AndroidManifest.xml application;

I have this error in Android 6 Lg Phone, with Android Pie works with this line android:usesCleartextTraffic=“true”

Was getting this issue using the Android emulator. Turns out it was because Android P by default blocks cleartext support for HTTP calls, so if you’re using 127.0.0.1 or something like that for your proxy, it’ll be blocked. You can add exceptions for certain domains to get around that. Not sure if this helps anybody else.

E/Pinger: Error pinging server (attempts: 3, max timeout: 280). If you see this message, please, report at https://github.com/danikula/AndroidVideoCache/issues/134. Default proxies are: [DIRECT@]
                                                             com.danikula.videocache.ProxyCacheException: Error pinging server (attempts: 3, max timeout: 280). If you see this message, please, report at https://github.com/danikula/AndroidVideoCache/issues/134. Default proxies are: [DIRECT@]. Version: 2.7.0
                                                                 at com.danikula.videocache.Pinger.ping(Pinger.java:73)
                                                                 at com.danikula.videocache.HttpProxyCacheServer.isAlive(HttpProxyCacheServer.java:183)
                                                                 at com.danikula.videocache.HttpProxyCacheServer.getProxyUrl(HttpProxyCacheServer.java:120)
                                                                 at com.danikula.videocache.HttpProxyCacheServer.getProxyUrl(HttpProxyCacheServer.java:101)
                                                                 ...

after many days of frustration I managed to find something: NanoHttpd/nanohttpd#270 (comment), as MrStanaland said, Mint is causing this, at least in my case, now it works for me 👍

Mint.disableNetworkMonitoring();
Mint.initAndStartSession(context, BuildConfig.MINT);

who is MrStanaland?

I have the same issue.

Hi, I have got the error to in Logcat. E/Pinger: Error pinging server (attempts: 3, max timeout: 280). If you see this message, please, report at https://github.com/danikula/AndroidVideoCache/issues/134. Default proxies are: [DIRECT] com.danikula.videocache.ProxyCacheException: Error pinging server (attempts: 3, max timeout: 280). If you see this message, please, report at https://github.com/danikula/AndroidVideoCache/issues/134. Default proxies are: [DIRECT]. Version: 2.7.1 at com.danikula.videocache.Pinger.ping(Pinger.java:73) at com.danikula.videocache.HttpProxyCacheServer.isAlive(HttpProxyCacheServer.java:185) at com.danikula.videocache.HttpProxyCacheServer.getProxyUrl(HttpProxyCacheServer.java:122) at com.danikula.videocache.HttpProxyCacheServer.getProxyUrl(HttpProxyCacheServer.java:103)

As requested to submit, I’m submitting… Details: Using: 2.7.1 of library Playing mp3 audio from S3 server with ExoPlayer, I’m passing proxy url to ExoPlayer. AndroidX Project

这个是不是在android 9.0后爆出的问题 I also see this issue in android 8.0

这个是不是在android 9.0后爆出的问题