Skip to content

panic runtime error index out of range [1] with length 1 #14

Closed

Description

@CartCaved

Background information:
Since there are no releases, I'm am basing this issue on having tried to follow the build instructions. The result of the docker method and the result of the go method produced different sized binaries, but both seem to have the same issue.

Issue
When running pgremapper with different commands (pgremapper cancel-backfill --verbose, pgremapper export-mappings --verbose 12, pgremapper drain 12 --verbose), the binary fails with very similar output:

** executing: ceph osd dump -f json
** executing: ceph pg dump pgs_brief -f json
** executing: ceph osd dump -f json
panic: runtime error: index out of range [1] with length 1

goroutine 1 [running]:
main.computeBackfillSrcsTgts(0xc00277b10) (export mapings) - or (0xc0025dc58) (cancel-backfill), (0xc00277c28) (drain)
< trace into different modules >

I know very little about Go so I don't where to start troubleshooting the issue.

Activity

  1. baergj commented on Oct 20, 2021

    @baergj
    Contributor

    Hey, thanks for the report. Could you please provide the data requested in https://github.com/digitalocean/pgremapper#bug-reports? I suspect that there's a Ceph state that we haven't accounted for that's tripping things up. Thanks!

  2. CartCaved commented on Oct 20, 2021

    @CartCaved
    Author

    Hi! I was hoping to avoid that since the ceph cluster is on an offline, secure system.. But I have initiated the process to transfer the files with the outputs and should have them available tomorrow. I did try running export-mappings on a second ceph cluster (with no backfilling operations running) and it seemed to work, so I'm sure you're right about the messy cluster being in an unusual state.

    Thanks!

  3. CartCaved commented on Oct 21, 2021

    @CartCaved
    Author

    While waiting for the material to be released, please note that this particular cluster has just one host (with the crush rules, failure domains etc adjusted for that), in other words, all osds are in one bucket. The cluster is working perfectly otherwise, but if the tool assumes more than one host, that could perhaps explain the panic (index out of range [1] with length 1).

    The osds are also quite varying in size (this is basically a cold storage cluster) but I would be surprised if that would make a difference.

  4. baergj commented on Oct 21, 2021

    @baergj
    Contributor

    Hmm, without the backtrace from pgremapper it's a bit hard to tell. If it did die in computeBackfillSrcsTgts(), then that would mean that you have PGs with the up set of shorter length than the acting set. That would be exceedingly odd, unless you just changed a CRUSH rule that resulted in reduced redundancy?

  5. CartCaved commented on Oct 21, 2021

    @CartCaved
    Author

    Hmm, no, haven't done any recent CRUSH rule changes. I do have OSDs that are out and up (being drained) so there are PGs acting on OSDs that are out (and has weight 0).

    Got the files:
    20211020 pgremapper-bugreport.zip

  6. baergj commented on Oct 21, 2021

    @baergj
    Contributor

    Thanks! This is the PG that's causing trouble, I believe:

    {
      "pgid": "1.0",
      "state": "active+clean+remapped",
      "up": [
        64
      ],
      "acting": [
        64,
        34,
        38
      ],
      "up_primary": 64,
      "acting_primary": 64
    }

    I...don't know what that means. Did some failures leave CRUSH unable to map that PG to new OSDs?

    I'm not sure how to fix this other than to add a pre-processing phase that simply excludes (and warns about) PGs with uneven up and acting sets.

  7. CartCaved commented on Oct 21, 2021

    @CartCaved
    Author

    Huh, this is quite strange. Both OSD 64 and 38 are up and in, 34 is up and out (being drained).

    Wait, the issue is that 64 is both up_primary and acting_primary. Or, that 64 is up but not 38 and 24 (which are also up, even if 34 is out).

    Is there anything I can do to get you more information?

    And is there anything I can do about that pg?! :)

  8. baergj commented on Oct 21, 2021

    @baergj
    Contributor

    The issue is that the up set should have 3 members, but it has 1.

    Looking deeper, that's the only PG in that pool (pool 1). Should that pool even exist? Alternatively, could that pool's CRUSH rule be messed up?

  9. CartCaved commented on Oct 21, 2021

    @CartCaved
    Author

    Aah, pg "1.0" - this must be the pg for the device_health_metrics pool. I'll confirm tomorrow and see if I can resolve it or if I just delete the pool for now.

  10. CartCaved commented on Oct 22, 2021

    @CartCaved
    Author

    Confirmed - it was the pg for the device_health_metrics pool. I changed the pool size to 1 (leaving 64 as up and acting), which resolved this issue. I'm still unable to use pgremapper, but for this issue we found the culprit. I don't know if you want to keep the issue open, as either documentation, more informative error or implementing the pre-processing phase would be needed for anyone else in the same situation. Thanks for all the assistance in identifying the underlying issue.

    I'm still not able to use pgremapper on this cluster, but I haven't decided if I will do new issues. Briefly, running pgremapper cancel-backfill gives panic on multiple pgs stating conflicting mapping(s) found when trying to map. Running it again gives another one or two pgs, alternating when running multiple times. Running export-mappings show no mappings existing. I ran remap of one of the pgs from the source osd to a third osd, but cancel-backfill still panics with the same conflicting mapping. I ran undo-upmaps om my remap, it says nothing to do, so I can't remove the mapping I did with pgremapper. I tried draining an osd with 3 pgs (according to ceph osd safe-to-destroy), pgremapper tells me nothing to do.

    At this point, I'm not sure I can invest the time to troubleshoot the tool, as I need to do what I can to get the cluster into a healthy state. pgremapper would have been great for that, but it doesn't seem to work in our situation.

  11. baergj commented on Oct 22, 2021

    @baergj
    Contributor

    I think we should keep this issue open; it's easy enough to add a warning about this situation.

    Briefly, running pgremapper cancel-backfill gives panic on multiple pgs stating conflicting mapping(s) found when trying to map.

    Since I have your dumps, it would be helpful to know which PGs it's complaining about. Indeed it doesn't look like you have any upmap items currently. It appears that you're running Pacific, and we haven't tested this tool beyond Nautilus yet, so it might be a matter of teaching pgremapper to understand some Pacific nuances.

  12. CartCaved commented on Oct 22, 2021

    @CartCaved
    Author

    PG 3.ba (trying to map from 28 to 66) and pg 3.a2 (I don't see it now). And yes, this is on a pacific cluster.

    I managed, by restarting some of the OSDs that were mentioned, to get the tool running. I ran through a cancel-backfill, it remapped a lot of pgs, but it was still backfilling. I was able to run the cancel-backfill again, new remappings but still continuing to backfill. I haven't been able to run it again since, same issue (pg 3.ba conflicting mappings 28-66).

    I was never able to run drain or undo-upmaps with success - always resulting in "nothing to do". With export-mappings, I do see the remaps that were made by the tool, so I don't understand why undo-upmaps isn't doing anything.

    Since I have an unusual EC profile (16+4), I'm thinking maybe there aren't enough OSDs with empty space to move pgs (even though I have about 60), so now I've spun up another couple of OSDs, now having 70 osds running. This of course results in a lot of backfilling again. pg 3.ba is still complaining though, must probably wait until the cluster is more balanced.

    I really like the premise of this tool :) so I hope I'm able to assist with making it robust enough to even work in my esoteric scenario.

  13. baergj commented on Oct 22, 2021

    @baergj
    Contributor

    cancel-backfill can't always cancel everything; it will try, but Ceph checks upmap exception requests against CRUSH and there are cases where we can't get an exception though because it would violate CRUSH (including tricky cases where there's a swap between failure domains; there's no way to create a countering upmap exception for that).

    undo-upmaps does constrain itself via the --max-backfill-reservations and --max-source-backfills settings, which both default to 1. You could try setting each really high (9999) without --yes and see if it does anything.

    Regarding 3.ba, the issue is that the same OSD (66) shows up twice in the acting set. pgremapper definitely doesn't know how to handle this case, and I suspect that the upmap exception table itself won't be helpful here either. Another case for a warning and exclusion. Having said that, this is super-not-great from a failure domain perspective and probably indicates that the CRUSH rule needs to be fixed (unless this was intentional?).

  14. CartCaved commented on Oct 22, 2021

    @CartCaved
    Author

    All CRUSH rules in the cluster have OSD as failure domain (single host cluster), so I have no idea how 3.ba managed to be assigned twice to 66. I'm actually seeing that 3.ba also has OSD 65 twice in the acting set! Clearly this and maybe other pgs have corrupted acting sets, and I'm not sure how to resolve that safely. Unfortunately, I'm not in a position to take out OSDs 65 and 66 (to force all the pgs to be migrated elsewhere).

    Regarding undo-upmaps, I tried it with both --max-backfill-reservations and --max-source-backfills set to 9999 and got the expected result, a list of pgs mappings in red, instead of the nothing to do I got without increasing the reservations, so that mystery seems solved!

  15. baergj commented on Oct 22, 2021

    @baergj
    Contributor

    Excellent, glad we've resolved the mysteries. :) I'll leave this open to add handling for both problem states identified here.

  16. baergj commented on Oct 28, 2021

    @baergj
    Contributor

    #15 will clarify the case where undo-upmaps could do something if it wasn't constrained by ongoing backfill.

  17. baergj commented on Oct 28, 2021

    @baergj
    Contributor

    All of the issues noted here should be addressed by the two PRs noted above. Thanks again for reporting these issues and working with us on digging into them!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions