Closed guymguym closed 3 days ago
Reproduced the issue with the current master version. After reading a small object present in the S3 remote resource, but not in the NooBaa cache, the issue happens. The resulting DB state is:
> db.objectmds.find({key:"pkg/version/version.go"}).pretty()
{
"_id" : ObjectId("61079e81d14c8e00095d3306"),
"system" : ObjectId("61079bba2bd1e4003063bdad"),
"bucket" : ObjectId("61079d312bd1e4003063bdd0"),
"key" : "pkg/version/version.go",
"content_type" : "application/octet-stream",
"cache_last_valid_time" : ISODate("2021-08-02T07:28:03.802Z"),
"size" : 667,
"xattr" : {
"noobaa-namespace-s3-bucket" : "baum"
},
"create_time" : ISODate("2021-08-02T07:28:03.802Z"),
"etag" : "d2785f4d86d2dd2312eb6d5b7b9ebed5",
"last_modified_time" : ISODate("2021-08-01T09:25:48Z"),
"md5_b64" : "0nhfTYbS3SMS621be56+1Q==",
"num_parts" : 1,
"version_seq" : 1,
"deleted" : ISODate("2021-08-02T07:28:04.304Z"),
"version_past" : true,
"reclaimed" : ISODate("2021-08-02T07:28:26.362Z")
}
{
"_id" : ObjectId("61079e83d14c8e00095d330b"),
"system" : ObjectId("61079bba2bd1e4003063bdad"),
"bucket" : ObjectId("61079d312bd1e4003063bdd0"),
"key" : "pkg/version/version.go",
"content_type" : "application/octet-stream",
"cache_last_valid_time" : ISODate("2021-08-02T07:28:04.299Z"),
"size" : 667,
"xattr" : {
"noobaa-namespace-s3-bucket" : "baum"
},
"create_time" : ISODate("2021-08-02T07:28:04.299Z"),
"etag" : "d2785f4d86d2dd2312eb6d5b7b9ebed5",
"last_modified_time" : ISODate("2021-08-01T09:25:48Z"),
"md5_b64" : "0nhfTYbS3SMS621be56+1Q==",
"num_parts" : 1,
"version_seq" : 2
}
According to stack trace logs, while reading an object AWS client issues first S3 Object HEAD and then S3 Object GET. Both operations call NS CACHE read_object_md()
:
Since the object is not in the db.objectmds
, and small (<4K) read_object_md()
performs md update by running object_io.upload_object_range()
in the background, resulting a race between S3 HEAD and GET ops:
if in the NS CACHE read_object_md() flow upload_object() is awaited in the foreground to avoid the race, the result for the same s3 cp s3://hub-local-cache/pkg/version/version.go -
is
> db.objectmds.find({key:"pkg/version/version.go"}).pretty()
{
"_id" : ObjectId("61081a447dc003000842b01e"),
"system" : ObjectId("6108183630a4bc0029bc6959"),
"bucket" : ObjectId("610819c530a4bc0029bc697d"),
"key" : "pkg/version/version.go",
"content_type" : "application/octet-stream",
"upload_size" : 0,
"upload_started" : ObjectId("61081a447dc003000842b01e"),
"cache_last_valid_time" : ISODate("2021-08-02T16:16:04.697Z"),
"size" : 667,
"xattr" : {
"noobaa-namespace-s3-bucket" : "baum"
},
"deleted" : ISODate("2021-08-02T16:16:14.790Z"),
"reclaimed" : ISODate("2021-08-02T16:16:35.067Z")
}
{
"_id" : ObjectId("61081a757dc003000842b020"),
"system" : ObjectId("6108183630a4bc0029bc6959"),
"bucket" : ObjectId("610819c530a4bc0029bc697d"),
"key" : "pkg/version/version.go",
"content_type" : "application/octet-stream",
"upload_size" : 0,
"upload_started" : ObjectId("61081a757dc003000842b020"),
"cache_last_valid_time" : ISODate("2021-08-02T16:16:53.156Z"),
"size" : 667,
"xattr" : {
"noobaa-namespace-s3-bucket" : "baum"
},
"deleted" : ISODate("2021-08-02T16:16:57.743Z"),
"reclaimed" : ISODate("2021-08-02T16:17:05.142Z")
}
{
"_id" : ObjectId("610821f77dc003000842b022"),
"system" : ObjectId("6108183630a4bc0029bc6959"),
"bucket" : ObjectId("610819c530a4bc0029bc697d"),
"key" : "pkg/version/version.go",
"content_type" : "application/octet-stream",
"cache_last_valid_time" : ISODate("2021-08-02T16:48:58.356Z"),
"size" : 667,
"xattr" : {
"noobaa-namespace-s3-bucket" : "baum"
},
"create_time" : ISODate("2021-08-02T16:48:58.356Z"),
"etag" : "d2785f4d86d2dd2312eb6d5b7b9ebed5",
"last_modified_time" : ISODate("2021-08-01T09:25:48Z"),
"md5_b64" : "0nhfTYbS3SMS621be56+1Q==",
"num_parts" : 1,
"version_seq" : 1,
"stats" : {
"last_read" : ISODate("2021-08-02T16:49:00.257Z"),
"reads" : 1
}
}
This change would resolve the UnhandledPromiseRejectionWarning
Error
This issue had no activity for too long - it will now be labeled stale. Update it to prevent it from getting closed.
This issue is stale and had no activity for too long - it will now be closed.
Environment info
Actual behavior
Expected behavior
Steps to reproduce
Check the DB items - the first is the hub-local one:
More information - Screenshots / Logs / Other output
Endpoint logs: