Zend Framework

Objects are never removed from S3

Details

  • Type: Sub-task Sub-task
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Cannot Reproduce
  • Affects Version/s: 1.8.4
  • Fix Version/s: None
  • Component/s: Zend_Service_Amazon
  • Labels:
    None

Description

I am not sure if this is really a sub-task. But when I try to DELETE objects from one of my buckets (that are all located in the EU), then I get a positive response-message from S3. But the objects are still there.
I guess the problem is that the function first tries to DELETE the object from my bucket (assuming that it is located in the US). But Amazon's API even returns a positive response when you try to delete an object that does not even exist (in this location).
And that is why the DELETE does never reach the correct location (in EU).
I did not test other operations, yet. But wouldn't it be better to give the location to Zend_Service_Amazon_S3 as a parameter?

Activity

Hide
Matthew Weier O'Phinney added a comment -

Assigning to Stas.

Show
Matthew Weier O'Phinney added a comment - Assigning to Stas.
Hide
Stanislav Malyshev added a comment -

You can specify the location when creating the bucket. But Amazon API doesn't have any means to specify location on deletion.
Could you provide the exact sequence of actions (since the bucket creation) that you performed to lead to this problem?

Show
Stanislav Malyshev added a comment - You can specify the location when creating the bucket. But Amazon API doesn't have any means to specify location on deletion. Could you provide the exact sequence of actions (since the bucket creation) that you performed to lead to this problem?
Hide
Peter Ritter added a comment -

Well, first I created the bucket using the Firefox extension S3Fox.
Then I have an upload-method in my code, that looks like this:

Unable to find source-code formatter for language: php. Available languages are: javascript, sql, xhtml, actionscript, none, html, xml, java
if(is_file($media_file) && is_readable($media_file)){
$s3 = new Zend_Service_Amazon_S3(AWS_KEY, AWS_SEC_KEY);
	        $sucess = $s3->putFile($media_file, 'ictv/'.$this->getClientid().'/media/'.$this->getMediatype().'/'.$this->getPath(), 
						    array(Zend_Service_Amazon_S3::S3_ACL_HEADER =>
						          Zend_Service_Amazon_S3::S3_ACL_PUBLIC_READ));
			$logger->info(Zend_Debug::dump($sucess, 'ret', false));
			//jetzt das ursprüngliche medium im temp-ordner löschen:
			@unlink($media_file);
			
	    }
Show
Peter Ritter added a comment - Well, first I created the bucket using the Firefox extension S3Fox. Then I have an upload-method in my code, that looks like this:
Unable to find source-code formatter for language: php. Available languages are: javascript, sql, xhtml, actionscript, none, html, xml, java
if(is_file($media_file) && is_readable($media_file)){
$s3 = new Zend_Service_Amazon_S3(AWS_KEY, AWS_SEC_KEY);
	        $sucess = $s3->putFile($media_file, 'ictv/'.$this->getClientid().'/media/'.$this->getMediatype().'/'.$this->getPath(), 
						    array(Zend_Service_Amazon_S3::S3_ACL_HEADER =>
						          Zend_Service_Amazon_S3::S3_ACL_PUBLIC_READ));
			$logger->info(Zend_Debug::dump($sucess, 'ret', false));
			//jetzt das ursprüngliche medium im temp-ordner löschen:
			@unlink($media_file);
			
	    }
Hide
Peter Ritter added a comment -

(Sorry for the double-post...)

Well, first I created the bucket using the Firefox extension S3Fox.
Then I have an upload-method in my code, that looks like this:

$media_file = 'path/to/my/file';
if(is_file($media_file) && is_readable($media_file)){
$s3 = new Zend_Service_Amazon_S3(AWS_KEY, AWS_SEC_KEY);
      $sucess = $s3->putFile($media_file, $bucket_name.'/media/'.$media_file_name, 
	array(Zend_Service_Amazon_S3::S3_ACL_HEADER => Zend_Service_Amazon_S3::S3_ACL_PUBLIC_READ));
	@unlink($media_file);			
}

After that my file is at the right place in my bucket and it is public readable and I can use it.
But when I want to delete it, I do the following in my deleting-method:

$s3_media_file = $bucket_name.'/media/'.$media_file_name;
$s3 = new Zend_Service_Amazon_S3(AWS_KEY, AWS_SEC_KEY);
$response = $s3->removeObject($s3_media_file);

Then I get the right response from S3 but my object is still there...

Show
Peter Ritter added a comment - (Sorry for the double-post...) Well, first I created the bucket using the Firefox extension S3Fox. Then I have an upload-method in my code, that looks like this:
$media_file = 'path/to/my/file';
if(is_file($media_file) && is_readable($media_file)){
$s3 = new Zend_Service_Amazon_S3(AWS_KEY, AWS_SEC_KEY);
      $sucess = $s3->putFile($media_file, $bucket_name.'/media/'.$media_file_name, 
	array(Zend_Service_Amazon_S3::S3_ACL_HEADER => Zend_Service_Amazon_S3::S3_ACL_PUBLIC_READ));
	@unlink($media_file);			
}
After that my file is at the right place in my bucket and it is public readable and I can use it. But when I want to delete it, I do the following in my deleting-method:
$s3_media_file = $bucket_name.'/media/'.$media_file_name;
$s3 = new Zend_Service_Amazon_S3(AWS_KEY, AWS_SEC_KEY);
$response = $s3->removeObject($s3_media_file);
Then I get the right response from S3 but my object is still there...
Hide
Stanislav Malyshev added a comment -

Does it happen with any objects at all or just specific ones (i.e. if you just create $bucket_name."/test" is it deleted)? Does it happen for you only with EU-based buckets?

Show
Stanislav Malyshev added a comment - Does it happen with any objects at all or just specific ones (i.e. if you just create $bucket_name."/test" is it deleted)? Does it happen for you only with EU-based buckets?
Hide
Peter Ritter added a comment -

I am now a little bit confused....
My buckets were not available for about one hour or more yesterday and now it all works fine.
Can it be, that this could have been an amazon-error or something?
Does anybody else have a similar problem?

Show
Peter Ritter added a comment - I am now a little bit confused.... My buckets were not available for about one hour or more yesterday and now it all works fine. Can it be, that this could have been an amazon-error or something? Does anybody else have a similar problem?

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: