Project

General

Profile

Actions

Bug #22932

closed

[rbd-mirror] infinite loop is possible when formatting the status message

Added by Jason Dillaman about 6 years ago. Updated about 6 years ago.

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

0%

Source:
Tags:
Backport:
luminous,jewel
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

Per Mykola Golub:

When running rbd-mirror stress test against your PR (which I suppose
is unrelated to the issue) I was observing the rbd-mirror looping
forever in this loop:

template <typename I>
bool ReplayStatusFormatter<I>::calculate_behind_master_or_send_update() {
  ...

  while (master.tag_tid != mirror_tag_tid) {
    auto tag_it = m_tag_cache.find(master.tag_tid);
    if (tag_it == m_tag_cache.end()) {
      send_update_tag_cache(master.tag_tid, mirror_tag_tid);
      return false;
    }
    librbd::journal::TagData &tag_data = tag_it->second;
    m_entries_behind_master += master.entry_tid;
    master = cls::journal::ObjectPosition(0, tag_data.predecessor.tag_tid,
                                          tag_data.predecessor.entry_tid);
  }

The state was:

m_master_position = {object_number = 5, tag_tid = 5, entry_tid = 1}
m_mirror_position = {object_number = 3, tag_tid = 4, entry_tid = 1323}

m_tag_cache = std::map with 5 elements =
 {[0] = {mirror_uuid = "", predecessor = {mirror_uuid = "", commit_valid = false, tag_tid = 2, entry_tid = 0}},
  [1] = {mirror_uuid = "", predecessor = {mirror_uuid = "", commit_valid = false, tag_tid = 0, entry_tid = 0}},
  [2] = {mirror_uuid = "", predecessor = {mirror_uuid = "", commit_valid = true, tag_tid = 1, entry_tid = 3}},
  [3] = {mirror_uuid = "", predecessor = {mirror_uuid = "", commit_valid = true, tag_tid = 1, entry_tid = 3}},
  [5] = {mirror_uuid = "", predecessor = {mirror_uuid = "", commit_valid = true, tag_tid = 3, entry_tid = 1}}}}

So, `master.tag_tid` went through this endless sequence:

  5 -> 3 -> 1 -> 0 -> 2 -> 1 -> 0 -> 2 -> 1 ...

Related issues 2 (0 open2 closed)

Copied to rbd - Backport #22964: luminous: [rbd-mirror] infinite loop is possible when formatting the status messageResolvedPrashant DActions
Copied to rbd - Backport #22965: jewel: [rbd-mirror] infinite loop is possible when formatting the status messageResolvedPrashant DActions
Actions

Also available in: Atom PDF