gpicavet created JCLOUDS-1403:
---------------------------------

             Summary: swift token not renewed with bulk api
                 Key: JCLOUDS-1403
                 URL: https://issues.apache.org/jira/browse/JCLOUDS-1403
             Project: jclouds
          Issue Type: Bug
    Affects Versions: 2.1.0
         Environment: debian 8 / openjdk 8
            Reporter: gpicavet


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). 

 
{code:java}
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);

        }

  }
 }
}{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to