Skip to content

Consider: extend ExponentialRetryPolicy to retry failed connections #116

Description

@joostdenijs

Moved from private repository.

If there is a network hiccup, like the HTTP connection to the server fails (which I've observed then stressing the real Azure service), Jersey can throw "com.sun.jersey.api.client.ClientHandlerException: com.sun.jersey.api.client.ClientHandlerException: java.net.SocketException: Software caused connection abort: recv failed"

This is not currently retried under the RetryPolicy, and requires an additional layer of retry logic to be built, which just adds to the overall weight of the customer's solution.

Had this happen again while running my Table tests.

The Storage team recommends that all service requests be made using retry logic, in case of transient network issues. Our service layer provides an ExponentialRetryPolicy to allow for retry on specific HTTP erorrs, but we don't have anything in place for lower-level issues, like " SocketException: Unexpected end of file from server"

It would be good to add auto-retry support for non-HTTP errors, so users don't have to duplicate those same lines of code in every application they write.

com.microsoft.windowsazure.services.core.ServiceException: com.sun.jersey.api.client.ClientHandlerException: com.sun.jersey.api.client.ClientHandlerException: java.net.SocketException: Unexpected end of file from server
at com.microsoft.windowsazure.services.table.implementation.TableExceptionProcessor.insertOrReplaceEntity(TableExceptionProcessor.java:341)
at ext.microsoft.windowsazure.blobAndQueueSample.TableTest.updateInfo(TableTest.java:229)
at ext.microsoft.windowsazure.blobAndQueueSample.TableTest.IterationRun(TableTest.java:70)
at ext.microsoft.windowsazure.blobAndQueueSample.StressBase.run(StressBase.java:67)
at java.lang.Thread.run(Thread.java:662)
Caused by: com.sun.jersey.api.client.ClientHandlerException: com.sun.jersey.api.client.ClientHandlerException: java.net.SocketException: Unexpected end of file from server
at com.microsoft.windowsazure.services.core.utils.pipeline.ClientFilterAdapter.handle(ClientFilterAdapter.java:52)
at com.sun.jersey.api.client.WebResource.handle(WebResource.java:670)
at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)
at com.sun.jersey.api.client.WebResource$Builder.method(WebResource.java:613)
at com.microsoft.windowsazure.services.table.implementation.TableRestProxy.putOrMergeEntityCore(TableRestProxy.java:533)
at com.microsoft.windowsazure.services.table.implementation.TableRestProxy.insertOrReplaceEntity(TableRestProxy.java:506)
at com.microsoft.windowsazure.services.table.implementation.TableRestProxy.insertOrReplaceEntity(TableRestProxy.java:500)
at com.microsoft.windowsazure.services.table.implementation.TableExceptionProcessor.insertOrReplaceEntity(TableExceptionProcessor.java:335)
... 4 more
Caused by: com.sun.jersey.api.client.ClientHandlerException: java.net.SocketException: Unexpected end of file from server
at com.microsoft.windowsazure.services.core.utils.pipeline.HttpURLConnectionClientHandler.handle(HttpURLConnectionClientHandler.java:172)
at com.sun.jersey.api.client.filter.LoggingFilter.handle(LoggingFilter.java:183)
at com.microsoft.windowsazure.services.blob.implementation.SharedKeyFilter.handle(SharedKeyFilter.java:72)
at com.sun.jersey.api.client.Client.handle(Client.java:648)
at com.microsoft.windowsazure.services.core.utils.pipeline.ClientFilterAdapter$1.handle(ClientFilterAdapter.java:45)
at com.microsoft.windowsazure.services.core.RetryPolicyFilter.handle(RetryPolicyFilter.java:48)
at com.microsoft.windowsazure.services.core.utils.pipeline.ClientFilterAdapter.handle(ClientFilterAdapter.java:43)
... 11 more
Caused by: java.net.SocketException: Unexpected end of file from server
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:777)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:640)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:660)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1195)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:379)
at com.microsoft.windowsazure.services.core.utils.pipeline.HttpURLConnectionClientHandler.doHandle(HttpURLConnectionClientHandler.java:239)
at com.microsoft.windowsazure.services.core.utils.pipeline.HttpURLConnectionClientHandler.handle(HttpURLConnectionClientHandler.java:169)
... 17 more

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions