-
Notifications
You must be signed in to change notification settings - Fork 248
Closed
Labels
Description
Sample script to reproduce this issue:
<?php
require 'vendor/autoload.php';
use OpenCloud\Rackspace;
$client = new Rackspace( Rackspace::US_IDENTITY_ENDPOINT, array(
'username' => '{username}',
'apiKey' => '{apiKey}'
));
$service = $client->objectStoreService(null, 'DFW');
$container = $service->createContainer('foobar');
define ('NUM_OBJECTS', 100);
for ($i = 0; $i < NUM_OBJECTS; ++$i) {
// Prepare data for i'th object
$data = str_repeat('a', mt_rand(1, 10000));
// Upload data
$objectName = 'object_' . str_pad($i, 3, '0', STR_PAD_LEFT);
$container->uploadObject($objectName, $data);
error_log(sprintf('Uploaded object %d, size = %d bytes', $i, strlen($data)));
}
error_log("Sleeping for 60 seconds since Object Storage is eventually consistent...");
sleep(60);
$container->delete(true);Running the above script will create a container named foobar in DFW and upload 100 objects named object_NNN to it (where NNN is a padded number between 000 and 099). Each object is of a random size between 1 and 10000 bytes.
The last line of the script will emit the following error:
Fatal error: Uncaught exception 'OpenCloud\ObjectStore\Exception\ContainerException' with message 'The API returned this error: <html><h1>Conflict</h1><p>There was a conflict w
hen trying to complete your request.</p></html>. You might have to delete all existing objects before continuing.' in /private/tmp/gcllc/vendor/rackspace/php-opencloud/lib/Open
Cloud/ObjectStore/Resource/Container.php on line 169
Expected: The script will delete the container and all objects within. No exception will be thrown.
[UPDATE: Added sleep(60) between uploading all objects and deleting the container]