CurOpFailpointHelpers::waitWhileFailPointEnabled comment filter does not exclude operations without a comment

    • Query Integration
    • ALL
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The comment-based filtering in CurOpFailpointHelpers::waitWhileFailPointEnabled (src/mongo/db/curop_failpoint_helpers.cpp) arguably has a logic bug. If the failpoint data has a comment filter but the operation has no comment (opCtx->getComment() is null), the predicate short-circuits and falls through to the nss check, which is typically always true — incorrectly pausing the operation.

      Current code:

      if (data.hasField("comment") && opCtx->getComment()) {
          return opCtx->getComment()->String() == data.getStringField("comment");
      }
      return nss.isEmpty() || fpNss.isEmpty() || fpNss == nss;
      

      Suggested change:

      if (data.hasField("comment")) {
          return opCtx->getComment() && opCtx->getComment()->String() == data.getStringField("comment");
      }
      return nss.isEmpty() || fpNss.isEmpty() || fpNss == nss;
      

      Operations without a comment should never match a comment-filtered failpoint.

            Assignee:
            Erin Liang
            Reporter:
            Daniele Alessandrelli
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: