You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have limited the number of sockets in the socket middleware but I find that when I cancel a request the socket is not released. Here is an example with output.
What I would expect here is for the first 3 requests to be canceled and the 4th request to print the html for google.com
What is happening, I get a callback for the 3 cancel calls. However there is still no socket available for the final request and it eventually times out. ION then later prints a timeout exception for each socket that had been cancelled. Now any future requests to google.com will timeout on this ion instance. However requests to other domains work.
32697 test D (0 ms) http://google.com: preparing request
32697 test I (0 ms) http://google.com: Using loader: com.koushikdutta.ion.loader.HttpLoader@4343d608
32697 test D (0 ms) http://google.com: Executing request.
32697 starshoptest E null
32697 starshoptest E java.util.concurrent.CancellationException
32697 starshoptest E at com.koushikdutta.async.future.SimpleFuture.cancelInternal(SimpleFuture.java:39)
32697 starshoptest E at com.koushikdutta.async.future.SimpleFuture.cancel(SimpleFuture.java:54)
32697 starshoptest E at com.koushikdutta.ion.Ion.cancelAll(Ion.java:348)
32697 starshoptest E at com.koushikdutta.ion.Ion.cancelAll(Ion.java:387)
32697 starshoptest E at com.pinsightmedia.starshop.ui.AboutActivity.onCreate(AboutActivity.java:27)
32697 starshoptest E at android.app.Activity.performCreate(Activity.java:5451)
32697 starshoptest E at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
32697 starshoptest E at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2359)
32697 starshoptest E at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2453)
32697 starshoptest E at android.app.ActivityThread.access$900(ActivityThread.java:173)
32697 starshoptest E at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
32697 starshoptest E at android.os.Handler.dispatchMessage(Handler.java:102)
32697 starshoptest E at android.os.Looper.loop(Looper.java:136)
32697 starshoptest E at android.app.ActivityThread.main(ActivityThread.java:5579)
32697 starshoptest E at java.lang.reflect.Method.invokeNative(Native Method)
32697 starshoptest E at java.lang.reflect.Method.invoke(Method.java:515)
32697 starshoptest E at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
32697 starshoptest E at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
32697 starshoptest E at dalvik.system.NativeStart.main(Native Method)
32697 test D (0 ms) http://google.com: preparing request
32697 test I (0 ms) http://google.com: Using loader: com.koushikdutta.ion.loader.HttpLoader@4343d608
32697 starshoptest E null
32697 starshoptest E java.util.concurrent.CancellationException
32697 starshoptest E at com.koushikdutta.async.future.SimpleFuture.cancelInternal(SimpleFuture.java:39)
32697 starshoptest E at com.koushikdutta.async.future.SimpleFuture.cancel(SimpleFuture.java:54)
32697 starshoptest E at com.koushikdutta.ion.Ion.cancelAll(Ion.java:348)
32697 starshoptest E at com.koushikdutta.ion.Ion.cancelAll(Ion.java:387)
32697 starshoptest E at com.pinsightmedia.starshop.ui.AboutActivity.onCreate(AboutActivity.java:34)
32697 starshoptest E at android.app.Activity.performCreate(Activity.java:5451)
32697 starshoptest E at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
32697 starshoptest E at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2359)
32697 starshoptest E at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2453)
32697 starshoptest E at android.app.ActivityThread.access$900(ActivityThread.java:173)
32697 starshoptest E at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
32697 starshoptest E at android.os.Handler.dispatchMessage(Handler.java:102)
32697 starshoptest E at android.os.Looper.loop(Looper.java:136)
32697 starshoptest E at android.app.ActivityThread.main(ActivityThread.java:5579)
32697 starshoptest E at java.lang.reflect.Method.invokeNative(Native Method)
32697 starshoptest E at java.lang.reflect.Method.invoke(Method.java:515)
32697 starshoptest E at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
32697 starshoptest E at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
32697 starshoptest E at dalvik.system.NativeStart.main(Native Method)
32697 test D (0 ms) http://google.com: preparing request
32697 test I (0 ms) http://google.com: Using loader: com.koushikdutta.ion.loader.HttpLoader@4343d608
32697 starshoptest E null
32697 starshoptest E java.util.concurrent.CancellationException
32697 starshoptest E at com.koushikdutta.async.future.SimpleFuture.cancelInternal(SimpleFuture.java:39)
32697 starshoptest E at com.koushikdutta.async.future.SimpleFuture.cancel(SimpleFuture.java:54)
32697 starshoptest E at com.koushikdutta.ion.Ion.cancelAll(Ion.java:348)
32697 starshoptest E at com.koushikdutta.ion.Ion.cancelAll(Ion.java:387)
32697 starshoptest E at com.pinsightmedia.starshop.ui.AboutActivity.onCreate(AboutActivity.java:41)
32697 starshoptest E at android.app.Activity.performCreate(Activity.java:5451)
32697 starshoptest E at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
32697 starshoptest E at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2359)
32697 starshoptest E at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2453)
32697 starshoptest E at android.app.ActivityThread.access$900(ActivityThread.java:173)
32697 starshoptest E at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
32697 starshoptest E at android.os.Handler.dispatchMessage(Handler.java:102)
32697 starshoptest E at android.os.Looper.loop(Looper.java:136)
32697 starshoptest E at android.app.ActivityThread.main(ActivityThread.java:5579)
32697 starshoptest E at java.lang.reflect.Method.invokeNative(Native Method)
32697 starshoptest E at java.lang.reflect.Method.invoke(Method.java:515)
32697 starshoptest E at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
32697 starshoptest E at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
32697 starshoptest E at dalvik.system.NativeStart.main(Native Method)
32697 test D (0 ms) http://google.com: preparing request
32697 test I (0 ms) http://google.com: Using loader: com.koushikdutta.ion.loader.HttpLoader@4343d608
32697 test D (40 ms) http://google.com: Connecting socket
32697 test D (0 ms) http://google.com: Executing request.
32697 test D (3 ms) http://google.com: Connecting socket
32697 test D (0 ms) http://google.com: Executing request.
32697 test D (0 ms) http://google.com: Executing request.
32697 test V (61 ms) http://google.com: socket connected
32697 test V (26 ms) http://google.com: socket connected
32697 test E (30029 ms) http://google.com: Connection error
32697 test E null
32697 test E java.util.concurrent.TimeoutException
32697 test E at com.koushikdutta.async.http.AsyncHttpClient$2.run(AsyncHttpClient.java:240)
32697 test E at com.koushikdutta.async.AsyncServer.lockAndRunQueue(AsyncServer.java:683)
32697 test E at com.koushikdutta.async.AsyncServer.runLoop(AsyncServer.java:700)
32697 test E at com.koushikdutta.async.AsyncServer.run(AsyncServer.java:608)
32697 test E at com.koushikdutta.async.AsyncServer.access$700(AsyncServer.java:37)
32697 test E at com.koushikdutta.async.AsyncServer$13.run(AsyncServer.java:557)
32697 test E (30003 ms) http://google.com: Connection error
32697 test E null
32697 test E java.util.concurrent.TimeoutException
32697 test E at com.koushikdutta.async.http.AsyncHttpClient$2.run(AsyncHttpClient.java:240)
32697 test E at com.koushikdutta.async.AsyncServer.lockAndRunQueue(AsyncServer.java:683)
32697 test E at com.koushikdutta.async.AsyncServer.runLoop(AsyncServer.java:700)
32697 test E at com.koushikdutta.async.AsyncServer.run(AsyncServer.java:608)
32697 test E at com.koushikdutta.async.AsyncServer.access$700(AsyncServer.java:37)
32697 test E at com.koushikdutta.async.AsyncServer$13.run(AsyncServer.java:557)
32697 test E (30005 ms) http://google.com: Connection error
32697 test E null
32697 test E java.util.concurrent.TimeoutException
32697 test E at com.koushikdutta.async.http.AsyncHttpClient$2.run(AsyncHttpClient.java:240)
32697 test E at com.koushikdutta.async.AsyncServer.lockAndRunQueue(AsyncServer.java:683)
32697 test E at com.koushikdutta.async.AsyncServer.runLoop(AsyncServer.java:700)
32697 test E at com.koushikdutta.async.AsyncServer.run(AsyncServer.java:608)
32697 test E at com.koushikdutta.async.AsyncServer.access$700(AsyncServer.java:37)
32697 test E at com.koushikdutta.async.AsyncServer$13.run(AsyncServer.java:557)
32697 test E (30009 ms) http://google.com: Connection error
32697 test E null
32697 test E java.util.concurrent.TimeoutException
32697 test E at com.koushikdutta.async.http.AsyncHttpClient$2.run(AsyncHttpClient.java:240)
32697 test E at com.koushikdutta.async.AsyncServer.lockAndRunQueue(AsyncServer.java:683)
32697 test E at com.koushikdutta.async.AsyncServer.runLoop(AsyncServer.java:700)
32697 test E at com.koushikdutta.async.AsyncServer.run(AsyncServer.java:608)
32697 test E at com.koushikdutta.async.AsyncServer.access$700(AsyncServer.java:37)
32697 test E at com.koushikdutta.async.AsyncServer$13.run(AsyncServer.java:557)
32697 test D (30013 ms) http://google.com: context has died: Activity finished
The text was updated successfully, but these errors were encountered:
I have limited the number of sockets in the socket middleware but I find that when I cancel a request the socket is not released. Here is an example with output.
What I would expect here is for the first 3 requests to be canceled and the 4th request to print the html for google.com
What is happening, I get a callback for the 3 cancel calls. However there is still no socket available for the final request and it eventually times out. ION then later prints a timeout exception for each socket that had been cancelled. Now any future requests to google.com will timeout on this ion instance. However requests to other domains work.
The text was updated successfully, but these errors were encountered: