Project

General

Profile

Actions

Bug #46400

closed

Space usage accounting overestimated

Added by Liam Monahan almost 4 years ago. Updated over 3 years ago.

Status:
Resolved
Priority:
High
Assignee:
Target version:
-
% Done:

0%

Source:
Community (user)
Tags:
Backport:
octopus
Regression:
No
Severity:
2 - major
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

Since upgrading from Nautilus 14.2.9 -> Octopus 15.2.3 we are seeing
large upticks in the reported size (both space and object count) for a number of our RGW
users. It does not seem to be isolated to just one user, so I don't think it's
something wrong in the users' usage patterns. Users are hitting their quotas very
quickly even though they are not writing anywhere near the reported space usage.

For example, here is a bucket that all of a sudden reports that it has
18446744073709551615 objects. The actual count I know to be around 20,000 objects.

[root@objproxy01 ~]# radosgw-admin bucket stats --bucket=droot-2020
{
    "bucket": "droot-2020",
    "num_shards": 32,
    "tenant": "",
    "zonegroup": "29946069-33ce-49b7-b93d-de8c95a0c344",
    "placement_rule": "default-placement",
    "explicit_placement": {
        "data_pool": "",
        "data_extra_pool": "",
        "index_pool": "" 
    },
    "id": "8b980d5b-23de-41f9-8b14-84a5bbc3f1c9.93433056.64",
    "marker": "8b980d5b-23de-41f9-8b14-84a5bbc3f1c9.93433056.64",
    "index_type": "Normal",
    "owner": "-droot",
    "ver":
"0#12052,1#15700,2#11033,3#11079,4#11521,5#13708,6#12427,7#10442,8#12769,9#11965,10#12820,11#11015,12#12073,13#11741,14#11851,15#124
97,16#10611,17#11652,18#10162,19#13699,20#9519,21#14224,22#13575,23#12635,24#9413,25#11450,26#12700,27#13122,28#10762,29#14674,30#10809,31#1223
2",
    "master_ver":
"0#0,1#0,2#0,3#0,4#0,5#0,6#0,7#0,8#0,9#0,10#0,11#0,12#0,13#0,14#0,15#0,16#0,17#0,18#0,19#0,20#0,21#0,22#0,23#0,24#0,25#0,26#0
,27#0,28#0,29#0,30#0,31#0",
    "mtime": "2020-06-29T15:14:49.363664Z",
    "creation_time": "2020-02-04T20:36:40.752748Z",
    "max_marker":
"0#,1#,2#,3#,4#,5#,6#,7#,8#,9#,10#,11#,12#,13#,14#,15#,16#,17#,18#,19#,20#,21#,22#,23#,24#,25#,26#,27#,28#,29#,30#,31#",
    "usage": {
        "rgw.none": {
            "size": 0,
            "size_actual": 0,
            "size_utilized": 0,
            "size_kb": 0,
            "size_kb_actual": 0,
            "size_kb_utilized": 0,
            "num_objects": 18446744073709551615
        },
        "rgw.main": {
            "size": 11612169555286,
            "size_actual": 11612211085312,
            "size_utilized": 11612169555286,
            "size_kb": 11340009332,
            "size_kb_actual": 11340049888,
            "size_kb_utilized": 11340009332,
            "num_objects": 20034
        },
        "rgw.multimeta": {
            "size": 0,
            "size_actual": 0,
            "size_utilized": 0,
            "size_kb": 0,
            "size_kb_actual": 0,
            "size_kb_utilized": 0,
            "num_objects": 0
        }
    },
    "bucket_quota": {
        "enabled": false,
        "check_on_raw": false,
        "max_size": -1,
        "max_size_kb": 0,
        "max_objects": -1
    }
}

A second (but possibly related) issue is that the user who owns that bucket above is reportedly using 1.3PB of space, but the known
usage is 96.3TB from before we did the upgrade.

[root@objproxy01 ~]# radosgw-admin user stats --uid=-droot
{
    "stats": {
        "size": 1428764900976977,
        "size_actual": 1428770491326464,
        "size_utilized": 0,
        "size_kb": 1395278223611,
        "size_kb_actual": 1395283682936,
        "size_kb_utilized": 0,
        "num_objects": 2604800
    },
    "last_stats_sync": "2020-06-29T13:42:26.474035Z",
    "last_stats_update": "2020-06-29T13:42:26.471413Z" 
}

Downgrading back to Nautilus 14.2.10 and running "radosgw-admin user stats --uid=<uid> --sync-stats" on every user in our cluster corrected the space accounting.

This seems to be happening with all users who write data to the cluster since stats are only updated when writing data I believe. This is more than a minor annoyance because the reported space is being used to calculate if users are over their quota.


Files

ceph.conf (735 Bytes) ceph.conf Liam Monahan, 07/16/2020 02:56 PM
ceph-config-dump.txt (118 KB) ceph-config-dump.txt Output from running "ceph config dump" Liam Monahan, 07/16/2020 02:56 PM

Related issues 2 (0 open2 closed)

Related to rgw - Bug #45970: rgw: bucket index entries marked rgw.none not accounted for correctly during reshardResolved

Actions
Copied to rgw - Backport #47037: octopus: rgw: Space usage accounting overestimatedResolvedNathan CutlerActions
Actions #1

Updated by Casey Bodley almost 4 years ago

  • Priority changed from Normal to High
Actions #2

Updated by Casey Bodley almost 4 years ago

  • Related to Bug #45970: rgw: bucket index entries marked rgw.none not accounted for correctly during reshard added
Actions #3

Updated by Mark Kogan almost 4 years ago

@Liam,
Will attempt to reproduce - is it possible to provide the ceph.conf please?

Actions #4

Updated by Mark Kogan almost 4 years ago

  • Assignee set to Mark Kogan

Updated by Liam Monahan almost 4 years ago

Hi Mark. We have a minimal ceph.conf (attached). Also attaching the ceph config dump. Let me know if I can help in any other way.

Actions #6

Updated by Brian Koebbe over 3 years ago

Similar issue here. Users are hitting their quotas very quickly even though they are not writing anywhere near the reported space usage.

It seems the "size_*" and "num_objects" counts increase every time a 'user stats' command is issued that includes either "--reset-stats" or "--sync-stats":

$ sudo radosgw-admin --rgw-realm=obs1 user stats --reset-stats  --uid <uid>
{
    "stats": {
        "size": 881499743033166,
        "size_actual": 881500029788160,
        "size_utilized": 0,
        "size_kb": 860839592806,
        "size_kb_actual": 860839872840,
        "size_kb_utilized": 0,
        "num_objects": 251406
    },
    "last_stats_sync": "0.000000",
    "last_stats_update": "2020-08-03T15:06:06.461464Z" 
}
$ sudo radosgw-admin --rgw-realm=obs1 user stats --reset-stats  --uid <uid>
{
    "stats": {
        "size": 930471950979453,
        "size_actual": 930472253665280,
        "size_utilized": 0,
        "size_kb": 908664014629,
        "size_kb_actual": 908664310220,
        "size_kb_utilized": 0,
        "num_objects": 265373
    },
    "last_stats_sync": "0.000000",
    "last_stats_update": "2020-08-03T15:06:09.689322Z" 
}
Actions #7

Updated by Mark Kogan over 3 years ago

Thank you for the additional detailes, was not able to reproduce prior.

Reproduces on master, running the command below increases the stats continiously:

watch -d "./bin/radosgw-admin user stats --sync-stats --uid=cosbench 2>/dev/null" 
#                                              ^^^^^^^^^^^^

- Does not occur with "--reset-stats" - only with "--sync-stats".
- Does not occur in v14.2.9 - Proceedingh to bisect and debug.

Actions #8

Updated by Mark Kogan over 3 years ago

  • Pull request ID set to 36542
Actions #9

Updated by Mark Kogan over 3 years ago

Following the above PR, the issue no longer reproduces.
(tested on a user with multiple buckets and multiple shards)

Actions #10

Updated by Casey Bodley over 3 years ago

  • Backport set to nautilus octopus
Actions #11

Updated by Mark Kogan over 3 years ago

  • Backport changed from nautilus octopus to pacific,octopus
Actions #12

Updated by Mark Kogan over 3 years ago

does not reproduce on nautilus
dos reproduce on master,pacific,octopus

Actions #13

Updated by Mark Kogan over 3 years ago

copying comment from github - https://github.com/ceph/ceph/pull/36542#issuecomment-672213315 :
...
we built 15.2.4/master with this PR cherry-picked. We upgraded from 15.2.4 to 15.2.4 with this patch. Initially we rolled it out to a single RGW and things looked fine; we then rolled it out to the rest of the RGWs and again things seemed fine; the RGWs were serving requests as normal. An hour or so later we noticed radosgw-admin segfaulted whenever we called radosgw-admin user stats. After about two hours or so, all of the RGWs segfaulted with the following: https://gist.github.com/monschein/027f3e45e2adb3f93f8efd493ea77663#file-cash1-txt

0> 2020-08-11T11:25:26.308-0400 7f1bd29a3700 -1 *** Caught signal (Segmentation fault) **
 in thread 7f1bd29a3700 thread_name:rgw_user_st_syn

 ceph version 15.2.4-537-gde523422e7 (de523422e7396e1237aa21a7a92ecc04651d9bf9) octopus (stable)
 1: (()+0x12dd0) [0x7f1c02e64dd0]
 2: (rgw_user::to_str(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) const+0x18) [0x7f1c0d8de1e8]
 3: (RGWSI_User_RADOS::get_buckets_obj(rgw_user const&) const+0x4b) [0x7f1c0dd7d3eb]
 4: (RGWSI_User_RADOS::flush_bucket_stats(RGWSI_MetaBackend::Context*, rgw_user const&, RGWBucketEnt const&)+0x36) [0x7f1c0dd81ee6]
 5: (()+0x8fb92e) [0x7f1c0dd6492e]
 6: (RGWSI_MetaBackend_SObj::call(std::optional<std::variant<RGWSI_MetaBackend_CtxParams_SObj> >, std::function<int (RGWSI_MetaBackend::Context*)>)+0x9e) [0x7f1c0dd6789e]
 7: (RGWSI_MetaBackend_Handler::call(std::optional<std::variant<RGWSI_MetaBackend_CtxParams_SObj> >, std::function<int (RGWSI_MetaBackend_Handler::Op*)>)+0x5f) [0x7f1c0dd6475f]
 8: (RGWSI_MetaBackend_Handler::call(std::function<int (RGWSI_MetaBackend_Handler::Op*)>)+0x78) [0x7f1c0dcc7fa8]
 9: (RGWUserCtl::flush_bucket_stats(rgw_user const&, RGWBucketEnt const&)+0x73) [0x7f1c0dcbb453]
 10: (RGWBucketCtl::sync_user_stats(rgw_user const&, RGWBucketInfo const&, RGWBucketEnt*)+0x367) [0x7f1c0d9a0b47]
 11: (rgw_user_sync_all_stats(rgw::sal::RGWRadosStore*, rgw_user const&)+0x1b1) [0x7f1c0dcc59f1]
 12: (RGWUserStatsCache::sync_user(rgw_user const&)+0x289) [0x7f1c0dbdce59]
 13: (RGWUserStatsCache::sync_all_users()+0x63a) [0x7f1c0dbdd77a]
 14: (RGWUserStatsCache::UserSyncThread::entry()+0x10b) [0x7f1c0dbe404b]
 15: (()+0x82de) [0x7f1c02e5a2de]
 16: (clone()+0x43) [0x7f1c0156de83]
 NOTE: a copy of the executable, or `objdump -rdS <executable>` is needed to interpret this.

I've posted extended logs with some more context here:
https://gist.github.com/monschein/027f3e45e2adb3f93f8efd493ea77663#file-crash2-txt
...

Actions #14

Updated by Mark Kogan over 3 years ago

@Liam,
For reproduction purposes, may I ask -
what is the largest number of buckets that a single user has?

Actions #15

Updated by Liam Monahan over 3 years ago

We have one user with 172 buckets, and most users have far fewer than that.

total users: 1484

Buckets per user:
  • mean: 1.1617250673854447
  • median: 0.0
  • mode: 0
  • max: 172
Actions #16

Updated by Mark Kogan over 3 years ago

The segfault reproduces on 15.2.4
but not on master , bisecting to find the commit that fixes it.

git branch -vv
* (HEAD detached at v15.2.4) 7447c15c6f 15.2.4
  master                     f93105e895 [origin/master] Merge pull request #36532 from simon-rock/crash_on_restart
2020-08-13T11:06:44.699+0000 7efc82ffd700  2 req 34 0s s3:create_bucket init permissions                                                                                        
2020-08-13T11:06:44.699+0000 7efc8ffff700 -1 *** Caught signal (Segmentation fault) **                                                                                           
 in thread 7efc8ffff700 thread_name:rgw_user_st_syn                                                                                                                                  

 ceph version 15.2.4 (7447c15c6ff58d7fce91843b705a268a1917325c) octopus (stable)                                                                                                 
 1: (()+0x37ec0) [0x7efd82e82ec0]                                                                                                                                                
 2: (RGWSI_User_RADOS::get_buckets_obj(rgw_user const&) const+0x2f) [0x7efd83a3eaff]                                                                                             
 3: (RGWSI_User_RADOS::flush_bucket_stats(RGWSI_MetaBackend::Context*, rgw_user const&, RGWBucketEnt const&)+0x38) [0x7efd83a44ed8]                                             
 4: (()+0xa050f2) [0x7efd83a250f2]                                                                                                                                              
 5: (RGWSI_MetaBackend_SObj::call(std::optional<std::variant<RGWSI_MetaBackend_CtxParams_SObj> >, std::function<int (RGWSI_MetaBackend::Context*)>)+0x9f) [0x7efd83a2805f]           
 6: (RGWSI_MetaBackend_Handler::call(std::optional<std::variant<RGWSI_MetaBackend_CtxParams_SObj> >, std::function<int (RGWSI_MetaBackend_Handler::Op*)>)+0x5f) [0x7efd83a24f2f]     
 7: (RGWUserCtl::flush_bucket_stats(rgw_user const&, RGWBucketEnt const&)+0xbf) [0x7efd8396b66f]                                                                                
 8: (RGWBucketCtl::sync_user_stats(rgw_user const&, RGWBucketInfo const&, RGWBucketEnt*)+0x273) [0x7efd83593e73]                                                                
 9: (rgw_user_sync_all_stats(rgw::sal::RGWRadosStore*, rgw_user const&)+0x480) [0x7efd8397e5e0]                                                                                 
 10: (RGWUserStatsCache::sync_user(rgw_user const&)+0x334) [0x7efd8385a884]                                                                                                     
 11: (RGWUserStatsCache::sync_all_users()+0x2f3) [0x7efd8385b6d3]                                                                                                               
 12: (RGWUserStatsCache::UserSyncThread::entry()+0x102) [0x7efd83864262]                                                                                                        
 13: (()+0x84c0) [0x7efd79ede4c0]                                                                                                                                               
 14: (clone()+0x43) [0x7efd82f47133]                                                                                                                                            
 NOTE: a copy of the executable, or `objdump -rdS <executable>` is needed to interpret this.                                                                                         
  -30> 2020-08-13T11:06:44.699+0000 7efc8dffb700  2 req 36 0s s3:create_bucket verifying op mask                                              
  -29> 2020-08-13T11:06:44.699+0000 7efc8dffb700  2 req 36 0s s3:create_bucket verifying op permissions               
Actions #17

Updated by Mark Kogan over 3 years ago

copying from github comment: https://github.com/ceph/ceph/pull/36542#issuecomment-674856572

In version 15.2.4 the cherry-pick needs to be modified slightly:

please modify the cherry-pick to:

return store->ctl()->bucket->sync_user_stats(user.info.user_id, info, &ent);

(noting that `user.info.user_id` in 15.2.4 changed to `owner->get_id()` in master)

Actions #18

Updated by Nathan Cutler over 3 years ago

  • Status changed from New to Fix Under Review
  • Backport changed from pacific,octopus to octopus
Actions #19

Updated by Nathan Cutler over 3 years ago

@Mark:

(noting that `user.info.user_id` in 15.2.4 changed to `owner->get_id()` in master)

Can you tell us which master PR made this change?

Actions #20

Updated by Mark Kogan over 3 years ago

@Nathan Weinberg, It was changed by this -

commit: 99f7c4aa1286edfea6961b92bb44bb8fe22bd599

pr: https://github.com/ceph/ceph/pull/35851

Actions #21

Updated by Mark Kogan over 3 years ago

just adding for clarification, the backported line should look similar to:

return store->ctl()->bucket->sync_user_stats(user.info.user_id, info);

versus master:
return store->ctl()->bucket->sync_user_stats(owner->get_id(), info, &ent);

And it is not applicable to 14.x and below.

Actions #22

Updated by Nathan Cutler over 3 years ago

Mark Kogan wrote:

@Nathan Weinberg, It was changed by this -
[...]
pr: https://github.com/ceph/ceph/pull/35851

Thanks, Mark. Presumably it's a feature that is not going to be backported to Octopus.

Actions #23

Updated by Nathan Cutler over 3 years ago

And it is not applicable to 14.x and below.

So the "Backport" field of this issue is set correctly. Good.

Actions #24

Updated by Nathan Cutler over 3 years ago

  • Copied to Backport #47037: octopus: rgw: Space usage accounting overestimated added
Actions #25

Updated by Casey Bodley over 3 years ago

  • Status changed from Fix Under Review to Pending Backport
Actions #26

Updated by Nathan Cutler over 3 years ago

  • Status changed from Pending Backport to Resolved

While running with --resolve-parent, the script "backport-create-issue" noticed that all backports of this issue are in status "Resolved" or "Rejected".

Actions

Also available in: Atom PDF