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

swift token not renewed with bulk api

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.1.0
    • None
    • None
    • None
    • debian 8 / openjdk 8

    Description

      Hello,

      After some time using bulkApi with SwiftApi, no more objects will be created in swift . Moreover, Response of extractArchive reports no error.

      This problem seems to be correlated with token expiration.

      There's no error using ObjectApi (token appears to be correctly renewed)

       

      Here is the test case i used. (Swift Token expiration is set to 5 minutes, no object will be created after this delai). 

       

      import java.io.*;
      
      import org.apache.commons.compress.archivers.tar.*;
      import org.jclouds.*;
      import org.jclouds.io.payloads.*;
      import org.jclouds.openstack.swift.v1.*;
      import org.jclouds.openstack.swift.v1.domain.*;
      import org.jclouds.openstack.swift.v1.features.*;
      
      public class TokenTestCaseBulk {
       public static void main(String[] args) throws Exception {
        try(SwiftApi swiftApi=ContextBuilder.newBuilder("openstack-swift")
               .endpoint("http://swift:35357/v2.0")
              .credentials("tenant:user","password")
              .buildApi(SwiftApi.class)) {
      
              String region = swiftApi.getConfiguredRegions().stream().findFirst().orElseThrow(()->new RuntimeException("no region found"));
      
              for(int i=0;i<6*60000/5000;i++) {
      
                      BulkApi bulkApi = swiftApi.getBulkApi(region);
      
                      try(ByteArrayOutputStream os = new ByteArrayOutputStream();
                              TarArchiveOutputStream out = new TarArchiveOutputStream(os)) {
      
                      byte[] data = new byte[]{0,0,0,0,0};
      
                      out.setLongFileMode(TarArchiveOutputStream.LONGFILE_POSIX);
                      TarArchiveEntry entry = new TarArchiveEntry("testbulk");
                      entry.setSize(data.length);
                      out.putArchiveEntry(entry);
                      out.write(data);
                      out.closeArchiveEntry();
      
                      Object res = bulkApi.extractArchive("test", new ByteArrayPayload(os.toByteArray()), "tar");
      
                      System.out.format("%s - %s%n", new java.util.Date(), res);
                      }
      
                      Thread.sleep(5000);
      
              }
      
        }
       }
      }

      Attachments

        Activity

          People

            Unassigned Unassigned
            gpicavet gpicavet
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: