Uploaded image for project: 'jclouds'
  1. jclouds
  2. JCLOUDS-1567

PROPERTY_MAX_RETRIES does not work with S3

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Bug
    • 2.3.0
    • None
    • jclouds-blobstore
    • None

    Description

      Hi

      I'm using the following code to upload a file to a S3 storage:

      final Properties overrides = new Properties();
      overrides.setProperty(PROPERTY_MAX_RETRIES, 2 + "");
      overrides.setProperty(PROPERTY_S3_VIRTUAL_HOST_BUCKETS, "true");
      
      final BlobStoreContext conn = ContextBuilder.newBuilder("s3")
      		.credentials(accessKey, secretKey)
      		.endpoint(endpoint)
      		.overrides(overrides)
      		.buildView(BlobStoreContext.class);
      
      store = conn.getBlobStore();
      
      Blob blob = store.blobBuilder(out.toString())
      		.payload(in)
      		.contentLength(in.length())
      		.contentType(Files.probeContentType(in.toPath()))
      		.cacheControl("max-age=" + CACHE_CONTROL_MAX_AGE)
      		.build();
      
      PutOptions putOptions = new PutOptions();
      putOptions.setBlobAccess(BlobAccess.PUBLIC_READ);
      if (in.length() > MULTIPART_UPLOAD_THRESHOLD) {
      	putOptions.multipart();
      }
      
      store.putBlob(bucket, blob, putOptions);

      But setting PROPERTY_MAX_RETRIES to a value of 2 does not work and still tries 5 times:

      SEVERE: Cannot retry after server error, command has exceeded retry limit 5: [method=org.jclouds.s3.S3Client.public abstract java.lang.String org.jclouds.s3.S3Client.putObject(java.lang.String,org.jclouds.s3.domain.S3Object,org.jclouds.s3.options.PutObjectOptions[])[devel, [metadata=[key=live/test2_1615557956853.dat, bucket=null, uri=null, eTag=null, cacheControl=null, contentMetadata=[cacheControl=max-age=14400, contentDisposition=null, contentEncoding=null, contentLanguage=null, contentLength=59093544, contentMD5=null, contentType=video/mp4, expires=null], lastModified=null, owner=null, storageClass=STANDARD, userMetadata={}]], [Lorg.jclouds.s3.options.PutObjectOptions;@3ecedf21], request=PUT http://devel.localhost/live/test2_1615557956853.dat HTTP/1.1] 

      Attachments

        Activity

          People

            Unassigned Unassigned
            pszemus Przemysław Sobala
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: