Uploaded image for project: 'EJBCA'
  1. EJBCA
  2. ECA-6126

CAA Validator fails for a SocketTimeoutException

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: EJBCA 6.9.0.6
    • Fix Version/s: EJBCA 6.9.0.6
    • Component/s: None
    • Labels:

      Description

      CAA Validator fails for a SocketTimeoutException. Since this can happen during standard operating procedure (due to rate limiting), EJBCA should be made far less fragile and instead retry. A customer has sent in the following patch:

      while(connectionAttempts < maxConnectionAttempts) {
      
         connectionAttempts++;
      
         try {
      
             response = resolver.send(Message.newQuery(queryRecord));
      
             if(response.getRcode() == Rcode.REFUSED || response.getRcode() == Rcode.SERVFAIL ) {
      
                 //For these two options, give a few more attempts, with a slight delay.
      
                 try {
      
                     log.debug("Failed to lookup '"+recordName+"' with rcode: "+response.getRcode()+", trying 3 times. connectionAttempts="+connectionAttempts);
      
                     Thread.sleep(500);
      
                 } catch (InterruptedException e) {
      
                     throw new IllegalStateException(e);
      
                 }
      
                         
      
             } else {
      
                 break;
      
             }
      
         } catch (IOException e) {
      
             /* Patch to retry on SocketTimeoutException */
      
            // *** patch removed //In spite of what the method spec states, it doesn't actually throw this
      
             // *** patch removed throw new IllegalStateException(e);
      
             log.info("IOException encountered in lookup '"+recordName+"', trying 3 times. connectionAttempts="+connectionAttempts);
      
             try {
      
                Thread.sleep(1000*connectionAttempts);
      
             } catch (InterruptedException int_e) {
      
                throw new IllegalStateException(int_e);
      
             }
      
         }
      
      }
      

      It doesn't need to be solved exactly like this, but it's a good hint (and works for that customer).

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                hsunmark Henrik Sunmark
                Reporter:
                mikek Mike Agrenius Kushner
                Verified by:
                Tomas Gustavsson
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 2 days
                  2d
                  Remaining:
                  Time Spent - 1 day, 1 hour Remaining Estimate - 7 hours
                  7h
                  Logged:
                  Time Spent - 1 day, 1 hour Remaining Estimate - 7 hours
                  1d 1h