Delete object through boto3 protocol returned error Object not found #57

Closed
opened 2023-03-14 11:50:06 +00:00 by anikeev-yadro · 14 comments
Member

Steps to reproduce:

  1. Put ob object into bucket using boto3:
COMMAND: 'S3 Put object result'
OUTPUT:
 {
    "ETag": "e9a6a6f0d35879b291858ab2ef576ec4c9fedb2943083913d550223a7c654474",
    "ResponseMetadata": {
        "HTTPHeaders": {
            "accept-ranges": "bytes",
            "content-length": "0",
            "date": "Tue, 14 Mar 2023 10:49:47 GMT",
            "etag": "e9a6a6f0d35879b291858ab2ef576ec4c9fedb2943083913d550223a7c654474",
            "server": "FrostFS-S3-GW/v0.0.1-78-g0af06c3b",
            "x-amz-request-id": "868be2a5-6a92-4d23-a0fd-6c41a1c7e141"
        },
        "HTTPStatusCode": 200,
        "HostId": "",
        "RequestId": "868be2a5-6a92-4d23-a0fd-6c41a1c7e141",
        "RetryAttempts": 0
    }
}
  1. Check that object exist in bucket
COMMAND: 'S3 List objects result'
OUTPUT:
 {'ResponseMetadata': {'RequestId': 'acc1cac0-2a44-4b56-a60c-e71e81b2faaf', 'HostId': '', 'HTTPStatusCode': 200, 'HTTPHeaders': {'x-amz-request-id': 'acc1cac0-2a44-4b56-a60c-e71e81b2faaf', 'date': 'Tue, 14 Mar 2023 10:49:47 GMT', 'content-length': '624', 'content-type': 'text/xml; charset=utf-8'}, 'RetryAttempts': 0}, 'IsTruncated': False, 'Marker': '', 'Contents': [{'Key': '2cd4cf47-6e02-41cd-8194-a92d2ed00428', 'LastModified': datetime.datetime(2023, 3, 14, 10, 48, 58, tzinfo=tzlocal()), 'ETag': 'e9a6a6f0d35879b291858ab2ef576ec4c9fedb2943083913d550223a7c654474', 'Size': 1000, 'Owner': {'DisplayName': 'NcrzbL1UnY52YxQhPvZaDuh8V14UrGYAe3', 'ID': 'NcrzbL1UnY52YxQhPvZaDuh8V14UrGYAe3'}}], 'Name': '2f7a6bad-44d7-4e32-9e8c-beedde077ede', 'Prefix': '', 'MaxKeys': 1000, 'EncodingType': 'url'}
  1. Stop frostfs-storage service on all nodes
  2. Remove all nodes from map using following frostfs-adm --config /home/service/config.yaml morph remove-nodes command
  3. Start frostfs-storage service on all nodes
  4. Tick epoch and make sure that all nodes returned to map
  5. Make sure that object presented in bucket (only one object in bucket)
COMMAND: 'S3 List objects result'
OUTPUT:
 {'ResponseMetadata': {'RequestId': '6449ac4d-899f-4bb8-8721-3de7b719a811', 'HostId': '', 'HTTPStatusCode': 200, 'HTTPHeaders': {'x-amz-request-id': '6449ac4d-899f-4bb8-8721-3de7b719a811', 'date': 'Tue, 14 Mar 2023 10:52:25 GMT', 'content-length': '556', 'content-type': 'text/xml; charset=utf-8'}, 'RetryAttempts': 0}, 'IsTruncated': False, 'Marker': '', 'Contents': [{'Key': '2cd4cf47-6e02-41cd-8194-a92d2ed00428', 'LastModified': datetime.datetime(1, 1, 1, 0, 0, tzinfo=tzlocal()), 'ETag': 'e9a6a6f0d35879b291858ab2ef576ec4c9fedb2943083913d550223a7c654474', 'Size': 1000, 'Owner': {'DisplayName': '', 'ID': ''}}], 'Name': '2f7a6bad-44d7-4e32-9e8c-beedde077ede', 'Prefix': '', 'MaxKeys': 1000, 'EncodingType': 'url'}
  1. Delete object returned error Object not found:
COMMAND: 'S3 Delete objects result'
OUTPUT:
 {
    "Errors": [
        {
            "Code": "BadRequest",
            "Key": "2cd4cf47-6e02-41cd-8194-a92d2ed00428",
            "Message": "mark object removal via connection pool: failed to collect relatives: failed to get raw object header: read object header via client: status: code = 2049 message = object not found"
        }
    ],
    "ResponseMetadata": {
        "HTTPHeaders": {
            "content-length": "400",
            "content-type": "text/xml; charset=utf-8",
            "date": "Tue, 14 Mar 2023 10:52:25 GMT",
            "x-amz-request-id": "bed61d19-c71f-4a46-8e54-b4fdc23e507a"
        },
        "HTTPStatusCode": 200,
        "HostId": "",
        "RequestId": "bed61d19-c71f-4a46-8e54-b4fdc23e507a",
        "RetryAttempts": 0
    }
}
  1. Then 'delete bucket' returned that bucket is not empty
COMMAND: 'S3 Delete bucket error'
OUTPUT:
 "An error occurred (BucketNotEmpty) when calling the DeleteBucket operation: The bucket you tried to delete is not empty"

We need to understand why delete object returned error Object not found if bucket is not empty and contains only this object.

Versions

AWS
2.2.0

node
0.0.1-205-g9929dcf5

s3-gate
0.0.1-78-g0af06c3b

Your Environment

Server setup and configuration:
Virtual, 4 servers, 4 SN, 4 http qw, 4 s3 gw

Operating System and version (uname -a):
linux vedi 5.10.0-16-amd64 #1 SMP Debian 5.10.127-1 (2022-06-30) x86_64 GNU/Linux

## Steps to reproduce: 1. Put ob object into bucket using boto3: ``` COMMAND: 'S3 Put object result' OUTPUT: { "ETag": "e9a6a6f0d35879b291858ab2ef576ec4c9fedb2943083913d550223a7c654474", "ResponseMetadata": { "HTTPHeaders": { "accept-ranges": "bytes", "content-length": "0", "date": "Tue, 14 Mar 2023 10:49:47 GMT", "etag": "e9a6a6f0d35879b291858ab2ef576ec4c9fedb2943083913d550223a7c654474", "server": "FrostFS-S3-GW/v0.0.1-78-g0af06c3b", "x-amz-request-id": "868be2a5-6a92-4d23-a0fd-6c41a1c7e141" }, "HTTPStatusCode": 200, "HostId": "", "RequestId": "868be2a5-6a92-4d23-a0fd-6c41a1c7e141", "RetryAttempts": 0 } } ``` 2. Check that object exist in bucket ``` COMMAND: 'S3 List objects result' OUTPUT: {'ResponseMetadata': {'RequestId': 'acc1cac0-2a44-4b56-a60c-e71e81b2faaf', 'HostId': '', 'HTTPStatusCode': 200, 'HTTPHeaders': {'x-amz-request-id': 'acc1cac0-2a44-4b56-a60c-e71e81b2faaf', 'date': 'Tue, 14 Mar 2023 10:49:47 GMT', 'content-length': '624', 'content-type': 'text/xml; charset=utf-8'}, 'RetryAttempts': 0}, 'IsTruncated': False, 'Marker': '', 'Contents': [{'Key': '2cd4cf47-6e02-41cd-8194-a92d2ed00428', 'LastModified': datetime.datetime(2023, 3, 14, 10, 48, 58, tzinfo=tzlocal()), 'ETag': 'e9a6a6f0d35879b291858ab2ef576ec4c9fedb2943083913d550223a7c654474', 'Size': 1000, 'Owner': {'DisplayName': 'NcrzbL1UnY52YxQhPvZaDuh8V14UrGYAe3', 'ID': 'NcrzbL1UnY52YxQhPvZaDuh8V14UrGYAe3'}}], 'Name': '2f7a6bad-44d7-4e32-9e8c-beedde077ede', 'Prefix': '', 'MaxKeys': 1000, 'EncodingType': 'url'} ``` 3. Stop frostfs-storage service on all nodes 4. Remove all nodes from map using following `frostfs-adm --config /home/service/config.yaml morph remove-nodes` command 5. Start frostfs-storage service on all nodes 6. Tick epoch and make sure that all nodes returned to map 7. Make sure that object presented in bucket (only one object in bucket) ``` COMMAND: 'S3 List objects result' OUTPUT: {'ResponseMetadata': {'RequestId': '6449ac4d-899f-4bb8-8721-3de7b719a811', 'HostId': '', 'HTTPStatusCode': 200, 'HTTPHeaders': {'x-amz-request-id': '6449ac4d-899f-4bb8-8721-3de7b719a811', 'date': 'Tue, 14 Mar 2023 10:52:25 GMT', 'content-length': '556', 'content-type': 'text/xml; charset=utf-8'}, 'RetryAttempts': 0}, 'IsTruncated': False, 'Marker': '', 'Contents': [{'Key': '2cd4cf47-6e02-41cd-8194-a92d2ed00428', 'LastModified': datetime.datetime(1, 1, 1, 0, 0, tzinfo=tzlocal()), 'ETag': 'e9a6a6f0d35879b291858ab2ef576ec4c9fedb2943083913d550223a7c654474', 'Size': 1000, 'Owner': {'DisplayName': '', 'ID': ''}}], 'Name': '2f7a6bad-44d7-4e32-9e8c-beedde077ede', 'Prefix': '', 'MaxKeys': 1000, 'EncodingType': 'url'} ``` 8. Delete object returned error `Object not found`: ``` COMMAND: 'S3 Delete objects result' OUTPUT: { "Errors": [ { "Code": "BadRequest", "Key": "2cd4cf47-6e02-41cd-8194-a92d2ed00428", "Message": "mark object removal via connection pool: failed to collect relatives: failed to get raw object header: read object header via client: status: code = 2049 message = object not found" } ], "ResponseMetadata": { "HTTPHeaders": { "content-length": "400", "content-type": "text/xml; charset=utf-8", "date": "Tue, 14 Mar 2023 10:52:25 GMT", "x-amz-request-id": "bed61d19-c71f-4a46-8e54-b4fdc23e507a" }, "HTTPStatusCode": 200, "HostId": "", "RequestId": "bed61d19-c71f-4a46-8e54-b4fdc23e507a", "RetryAttempts": 0 } } ``` 9. Then 'delete bucket' returned that bucket is not empty ``` COMMAND: 'S3 Delete bucket error' OUTPUT: "An error occurred (BucketNotEmpty) when calling the DeleteBucket operation: The bucket you tried to delete is not empty" ``` We need to understand why delete object returned error `Object not found` if bucket is not empty and contains only this object. ## Versions ``` AWS 2.2.0 node 0.0.1-205-g9929dcf5 s3-gate 0.0.1-78-g0af06c3b ``` ## Your Environment Server setup and configuration: Virtual, 4 servers, 4 SN, 4 http qw, 4 s3 gw Operating System and version (uname -a): linux vedi 5.10.0-16-amd64 #1 SMP Debian 5.10.127-1 (2022-06-30) x86_64 GNU/Linux
realloc added the
P1
label 2023-03-14 11:55:00 +00:00
dkirillov was assigned by alexvanin 2023-03-14 16:30:07 +00:00
Member

After such steps something goes wrong with tree service. It starts return not found: rpc error: code = Unknown desc = tree not found error.

So bucket is considered as empty. What you can see after list-objects command is cached values.

It seems this problem in node rather than in gate

/cc @alexvanin @fyrchik

After such steps something goes wrong with tree service. It starts return `not found: rpc error: code = Unknown desc = tree not found` error. So bucket is considered as empty. What you can see after `list-objects` command is cached values. It seems this problem in node rather than in gate /cc @alexvanin @fyrchik
Member

It seems this has been already fixed in TrueCloudLab/frostfs-node#129

@anikeev-yadro

It seems this has been already fixed in https://git.frostfs.info/TrueCloudLab/frostfs-node/pulls/129 @anikeev-yadro
Author
Member

@dkirillov OK, If bucket is considered as empty, we should return empty list-objects and allow to delete empty bucket.
Maybe this is bug to cache?

@dkirillov OK, If bucket is considered as empty, we should return empty `list-objects` and allow to delete empty bucket. Maybe this is bug to cache?
Member

@dkirillov OK, If bucket is considered as empty, we should return empty list-objects and allow to delete empty bucket.
Maybe this is bug to cache?

Sorry, I meant container (not bucket)

> @dkirillov OK, If bucket is considered as empty, we should return empty `list-objects` and allow to delete empty bucket. > Maybe this is bug to cache? Sorry, I meant container (not bucket)
alexvanin added this to the v0.27.0 milestone 2023-03-16 06:56:47 +00:00
Member

I've just noticed that error in description from the node object service rather than tree service. So it seems that we loss object in container but in the tree service they exist.

I've just noticed that error in description from the node object service rather than tree service. So it seems that we loss object in container but in the tree service they exist.
dkirillov was unassigned by alexvanin 2023-03-17 15:20:23 +00:00
ironbee was assigned by alexvanin 2023-03-17 15:20:24 +00:00
Member

It seems we need help @fyrchik @carpawell to know what happened with node after restart.

We also lose the access box object (probably all objects). But we can make request to s3-gw because of cache

It seems we need help @fyrchik @carpawell to know what happened with node after restart. We also lose the access box object (probably all objects). But we can make request to s3-gw because of cache
Owner

In this issue we close the case with tree service miss + blobovnicza and fstree unavailability. However there are more things to process in #78 when metabase returns object not found and object already deleted. We need to discuss it there additionally.
/cc @anikeev-yadro

In this issue we close the case with tree service miss + blobovnicza and fstree unavailability. However there are more things to process in #78 when metabase returns `object not found` and `object already deleted`. We need to discuss it there additionally. /cc @anikeev-yadro
Author
Member

Reproduced on the following case:
1.Create bucket
2.Put object into bucket
3.Check that bucket contains the object (list object)
4.Stop frostfs-storage service on all nodes

root@aanikeev-node4:~# systemctl stop frostfs-storage

5.Delete all data on all nodes

root@aanikeev-node4:~# rm -rf /srv/frostfs/data*

6.Start frostfs-storage service on all nodes

root@aanikeev-node4:~# systemctl start frostfs-storage

7.Delete object

anikeev@NB-1670:~/neofs$ aws s3api delete-object --key new-object --bucket b-test-lock-6 --endpoint-url http://172.26.160.28:8084
{
    "DeleteMarker": true,
    "VersionId": "2miMkbvybPxGyxJuZo6CM7CocWof26HptTbvi2L6Mc4S"
}

8.Delete bucket

anikeev@NB-1670:~/neofs$ aws s3api delete-bucket --bucket b-test-lock-6 --endpoint-url http://172.26.160.28:8084
An error occurred (BucketNotEmpty) when calling the DeleteBucket operation (reached max retries: 0): The bucket you tried to delete is not empty

Version

FrostFS S3 Gateway
Version: v0.0.1-94-gfb99b262
GoVersion: go1.18.4
Reproduced on the following case: 1.Create bucket 2.Put object into bucket 3.Check that bucket contains the object (list object) 4.Stop `frostfs-storage` service on all nodes ``` root@aanikeev-node4:~# systemctl stop frostfs-storage ``` 5.Delete all data on all nodes ``` root@aanikeev-node4:~# rm -rf /srv/frostfs/data* ``` 6.Start `frostfs-storage` service on all nodes ``` root@aanikeev-node4:~# systemctl start frostfs-storage ``` 7.Delete object ``` anikeev@NB-1670:~/neofs$ aws s3api delete-object --key new-object --bucket b-test-lock-6 --endpoint-url http://172.26.160.28:8084 { "DeleteMarker": true, "VersionId": "2miMkbvybPxGyxJuZo6CM7CocWof26HptTbvi2L6Mc4S" } ``` 8.Delete bucket ``` anikeev@NB-1670:~/neofs$ aws s3api delete-bucket --bucket b-test-lock-6 --endpoint-url http://172.26.160.28:8084 An error occurred (BucketNotEmpty) when calling the DeleteBucket operation (reached max retries: 0): The bucket you tried to delete is not empty ``` ## Version ``` FrostFS S3 Gateway Version: v0.0.1-94-gfb99b262 GoVersion: go1.18.4 ```
Member

7.Delete object
anikeev@NB-1670:~/neofs$ aws s3api delete-object --key new-object --bucket b-test-lock-6 --endpoint-url http://172.26.160.28:8084
{
"DeleteMarker": true,
"VersionId": "2miMkbvybPxGyxJuZo6CM7CocWof26HptTbvi2L6Mc4S"
}

It seems you are trying to delete object in versioned bucket. That's why you cannot delete bucket until you delete all versions/deletem markers https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucket.html

> 7.Delete object anikeev@NB-1670:~/neofs$ aws s3api delete-object --key new-object --bucket b-test-lock-6 --endpoint-url http://172.26.160.28:8084 { "DeleteMarker": true, "VersionId": "2miMkbvybPxGyxJuZo6CM7CocWof26HptTbvi2L6Mc4S" } It seems you are trying to delete object in versioned bucket. That's why you cannot delete bucket until you delete all versions/deletem markers https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucket.html
Author
Member

I agree, but main point is: Why the system allow to delete object and create delete marker even object deleted physically from disk?

I agree, but main point is: Why the system allow to delete object and create delete marker even object deleted physically from disk?
Member

In current scenario we still have some object info in the tree service as I understand, so we don't actually know that object is deleted physically.

But we definitely should revise working with delete markers. #83

In current scenario we still have some object info in the tree service as I understand, so we don't actually know that object is deleted physically. But we definitely should revise working with delete markers. https://git.frostfs.info/TrueCloudLab/frostfs-s3-gw/issues/83
Contributor

Scenario 1: Bucket with versioning enabled, the object storage is lost but the tree remains.
If we try deleting an object in the bucket without specifying the version then a delete market gets created. We need to delete it along with the other versions of target object in order to delete the bucket. The process can be seen in S3 gateway log.

Scenario 1: Bucket with versioning enabled, the object storage is lost but the tree remains. If we try deleting an object in the bucket without specifying the version then a delete market gets created. We need to delete it along with the other versions of target object in order to delete the bucket. The process can be seen in S3 gateway log.
Contributor

Scenario 2: Bucket with versioning enabled, the tree is lost but the object storage remains.
Since the information on target object is not available we consider it as non-existing, thus the bucket can be deleted is needed.

Scenario 2: Bucket with versioning enabled, the tree is lost but the object storage remains. Since the information on target object is not available we consider it as non-existing, thus the bucket can be deleted is needed.
Owner

Seems like it works as expected with versioned bucket as well.

Seems like it works as expected with versioned bucket as well.
Sign in to join this conversation.
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-s3-gw#57
No description provided.