Object stores sometimes have transient failures due to network issues or node unavailability. Your used an InputStream payload in http://pastebin.com/GKr1CaSQ which is not replayable because it can only produce data, not reset to the beginning of the stream. Instead you should consider a ByteSource payload which you can create via ByteSource.wrap(byte[]) or Files.asByteSource(File). jclouds will automatically retry with ByteSource payload; otherwise your application needs to implement retry logic for InputStream payload.
On Wed, Nov 23, 2016 at 12:08:57PM +0100, Aleksandra Nowak wrote: > Hi, > > I use jclouds to communicate with Openstack Swift (authentication is > provided by Keystone). > > Every once in a while I get this exception: > > Cannot retry after server error, command is not replayable: > [method=org.jclouds.openstack.swift.SwiftKeystoneClient.public > abstract java.lang.String > org.jclouds.openstack.swift.CommonSwiftClient.putObject(java.lang.String,org.jclouds.openstack.swift.domain.SwiftObject)... > > Server rejected operation connecting to PUT http://swift... (full > exception here: http://pastebin.com/WVtc0U3f) > > Here is the code which I run to upload objects: http://pastebin.com/GKr1CaSQ > > > After the error the application can be "fixed" by a restart or by > executing a GET request to an existing object. I figured that this > happens because the key from Keystone expires before the PUT command > is executed. And while GET method is requesting a new key from > Keystone, PUT is not. And I confirmed it using ngrep on Keystone > port. During PUT there is no communication to Keystone, but during > GET I can see that it requested key renewal: > > http://pastebin.com/Wi2xzWZ9 > > I turned on jclouds logging on TRACE level. Here is the log when I > try PUT method: http://pastebin.com/RxRBTXDH and here is log for GET > first: http://pastebin.com/WhvG4Wy9 > > So, it looks like PUT method is not repeatable/replayable for > InputStream. Can somebody tell me why? Or point to a point in > documentation where it is described? > > Is there a why to upload InputStream to Swift in a repeatable way? > My could is wrapped by a REST call which uses Multipart, so I really > would like to use InputStream. Or is it any other way to renew the > key? > > Thanks in advance! > Kind regards, > Aleksandra > > > -- Andrew Gaul http://gaul.org/