Re: [jclouds] JCLOUDS-137: Retry on HTTP 500 AtmosError 1040 (#285)

2014-02-11 Thread Shri Javadekar
 +   private int retryCountLimit = 5;
 +   @Resource
 +   protected Logger logger = Logger.NULL;
 +
 +   public boolean shouldRetryRequest(HttpCommand command, HttpResponse 
 response) {
 +  if (command.getFailureCount()  retryCountLimit) {
 + return false;
 +  }
 +  if (response.getStatusCode() == 500) {
 + byte[] content = 
 HttpUtils.closeClientButKeepContentStream(response);
 + // Content can be null in the case of HEAD requests
 + if (content != null) {
 +try {
 +   AtmosError error = utils.parseAtmosErrorFromContent(command, 
 response,
 +new String(content));
 +   if (error.getCode() == 1040) {  // The server is busy. Please 
 try again.

I haven't seen these failures myself.  I'm fine with the current change if 
you're not comfortable with retrying on all returned error codes except 1020.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/285/files#r9637835

Re: [jclouds] JCLOUDS-137: Retry on HTTP 500 AtmosError 1040 (#285)

2014-02-11 Thread Andrew Gaul
Closed #285.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/285

Re: [jclouds] JCLOUDS-137: Retry on HTTP 500 AtmosError 1040 (#285)

2014-02-11 Thread Andrew Gaul
Committed to master and 1.7.x.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/285#issuecomment-34800494

Re: [jclouds] JCLOUDS-137: Retry on HTTP 500 AtmosError 1040 (#285)

2014-02-11 Thread Andrew Phillips
 +   }
 +
 +   @Inject(optional = true)
 +   @Named(Constants.PROPERTY_MAX_RETRIES)
 +   private int retryCountLimit = 5;
 +   @Resource
 +   protected Logger logger = Logger.NULL;
 +
 +   public boolean shouldRetryRequest(HttpCommand command, HttpResponse 
 response) {
 +  if (command.getFailureCount()  retryCountLimit) {
 + return false;
 +  }
 +  if (response.getStatusCode() == 500) {
 + byte[] content = 
 HttpUtils.closeClientButKeepContentStream(response);
 + // Content can be null in the case of HEAD requests
 + if (content != null) {

Invert this to a `if (content == null) { return false; }` block to lose another 
level of indenting?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/285/files#r9651204

Re: [jclouds] JCLOUDS-137: Retry on HTTP 500 AtmosError 1040 (#285)

2014-02-11 Thread Andrew Phillips
 Committed to master and 1.7.x.

Ah, I see my review is already a little late :-( @andrewgaul: most of the 
questions are minor, the only one that we may really need to look at, I think, 
is about making sure we increment the failure count correctly.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/285#issuecomment-34826715

Re: [jclouds] JCLOUDS-137: Retry on HTTP 500 AtmosError 1040 (#285)

2014-02-10 Thread Andrew Gaul
@shrinandj relevant to your interests.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/285#issuecomment-34682671

Re: [jclouds] JCLOUDS-137: Retry on HTTP 500 AtmosError 1040 (#285)

2014-02-10 Thread Shri Javadekar
The turnaround time on this is INCREDIBLE!! :+1: 

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/285#issuecomment-34685027

Re: [jclouds] JCLOUDS-137: Retry on HTTP 500 AtmosError 1040 (#285)

2014-02-10 Thread BuildHive
[jclouds ยป jclouds 
#827](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/827/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/285#issuecomment-34687590

Re: [jclouds] JCLOUDS-137: Retry on HTTP 500 AtmosError 1040 (#285)

2014-02-10 Thread CloudBees pull request builder plugin
[jclouds-java-7-pull-requests 
#1056](https://jclouds.ci.cloudbees.com/job/jclouds-java-7-pull-requests/1056/) 
UNSTABLE
Looks like there's a problem with this pull request

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/285#issuecomment-34687928

Re: [jclouds] JCLOUDS-137: Retry on HTTP 500 AtmosError 1040 (#285)

2014-02-10 Thread CloudBees pull request builder plugin
[jclouds-pull-requests 
#584](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/584/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/285#issuecomment-34687898

Re: [jclouds] JCLOUDS-137: Retry on HTTP 500 AtmosError 1040 (#285)

2014-02-10 Thread Andrew Gaul
Spurious test failure, tracked by 
[JCLOUDS-429](https://issues.apache.org/jira/browse/JCLOUDS-429).

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/285#issuecomment-34688336

Re: [jclouds] JCLOUDS-137: Retry on HTTP 500 AtmosError 1040 (#285)

2014-02-10 Thread Andrew Gaul
 +   private int retryCountLimit = 5;
 +   @Resource
 +   protected Logger logger = Logger.NULL;
 +
 +   public boolean shouldRetryRequest(HttpCommand command, HttpResponse 
 response) {
 +  if (command.getFailureCount()  retryCountLimit) {
 + return false;
 +  }
 +  if (response.getStatusCode() == 500) {
 + byte[] content = 
 HttpUtils.closeClientButKeepContentStream(response);
 + // Content can be null in the case of HEAD requests
 + if (content != null) {
 +try {
 +   AtmosError error = utils.parseAtmosErrorFromContent(command, 
 response,
 +new String(content));
 +   if (error.getCode() == 1040) {  // The server is busy. Please 
 try again.

I retabulated the 500 error codes and we could retry on most of these, although 
I have some concern since I have never experienced these errors:

Error Code | Error Message| 
HTTP Status Code and Description
-- |  | 

1001   | The server encountered an internal error.  Please try again. | 500 
Internal Server Error 
1007   | The server encountered an internal error.  Please try again. | 500 
Internal Server Error
1013   | The server encountered an internal error.  Please try again. | 500 
Internal Server Error 
1019   | The server encountered an I/O error.  Please try again.  | 500 
Internal Server Error 
1020   | The requested resource is missing or could not be found. | 500 
Internal Server Error 
1024   | The server encountered an internal error.  Please try again. | 500 
Internal Server Error 
1025   | The server encountered an internal error.  Please try again. | 500 
Internal Server Error 
1026   | The server encountered an internal error.  Please try again. | 500 
Internal Server Error
1027   | The server encountered an internal error.  Please try again. | 500 
Internal Server Error 
1028   | The server encountered an internal error.  Please try again. | 500 
Internal Server Error 
1029   | The server encountered an internal error.  Please try again. | 500 
Internal Server Error 
1040   | The server is busy. Please try again | 500 
Internal Server Error 

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/285/files#r9613290