Skip to content

crimson/osd/watch: fix notify_ack() lifetime - #51936

Closed
Matan-B wants to merge 1 commit into
ceph:mainfrom
Matan-B:wip-matanb-crimson-only-notify-ack
Closed

Matan-B wants to merge 1 commit into
ceph:mainfrom
Matan-B:wip-matanb-crimson-only-notify-ack

Conversation

@Matan-B

@Matan-B Matan-B commented Jun 6, 2023 •

Copy link
Copy Markdown
Contributor

Before the change:

INFO  2023-06-06 09:44:07,607 [shard 2] osd - notify_ack watch_cookie=107271103492224, notify_id=163208757298
DEBUG 2023-06-06 09:44:07,607 [shard 2] osd - Watch::notify_ack gid=4188 cookie=107271103492224 notify(id=163208757298)
DEBUG 2023-06-06 09:44:07,607 [shard 2] osd - complete_watcher for notify(id=163208757298)
DEBUG 2023-06-06 09:44:07,607 [shard 2] osd - remove_watcher for notify(id=163208757298)
// deleting notify(id=163208757298)
DEBUG 2023-06-06 09:44:07,607 [shard 2] osd - ~Notify for notify(id=163208757298)
// acking notify(id=163208757298)
INFO  2023-06-06 09:44:07,608 [shard 2] osd - notify_ack watch_cookie=107271103791744, notify_id=163208757298
DEBUG 2023-06-06 09:44:07,608 [shard 2] osd - notify_ack gid=4188 cookie=107271103791744
DEBUG 2023-06-06 09:44:07,608 [shard 2] osd - Watch::notify_ack complete gid=4188 cookie=107271103791744

Fixes: https://tracker.ceph.com/issues/61504

Signed-off-by: Matan Breizman [email protected]

Contribution Guidelines

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows

@Matan-B Matan-B added the bug-fix label Jun 6, 2023
@Matan-B
Matan-B requested review from athanatos and rzarzynski June 6, 2023 11:52
@Matan-B
Matan-B requested a review from a team as a code owner June 6, 2023 11:52
@rzarzynski

Copy link
Copy Markdown
Contributor

Hmm, I'm not sure this really fixes the problem. It seems we freed a wrong Notify instance. Please note we have two Watch instances here (and thus in_progress_notifies that should pin the Notify):

INFO  2023-06-06 09:44:07,607 [shard 2] osd - notify_ack watch_cookie=107271103492224, notify_id=163208757298
...
DEBUG 2023-06-06 09:44:07,607 [shard 2] osd - ~Notify for notify(id=163208757298)
...
INFO  2023-06-06 09:44:07,608 [shard 2] osd - notify_ack watch_cookie=107271103791744, notify_id=163208757298

The cookies are different.

@Matan-B

Matan-B commented Jun 6, 2023

Copy link
Copy Markdown
Contributor Author

Hmm, I'm not sure this really fixes the problem. It seems we freed a wrong Notify instance. Please note we have two Watch instances here (and thus in_progress_notifies that should pin the Notify)
The cookies are different.

@rzarzynski, I have noticed that the cookies are different and these are two Watch instances.
The attached log is from before the changes introduced here, I added it to show the original issue.
Can you please further clarify why this does not fix the issue?

In continuation to our offline discussion. #51945, on the contrary, drops the iteration over in_progress_notifies which is preserved here and uses the notify_id which was previously unused at all.
Do you suggest that the iteration is redundant and we should only handle the notify_id passed?

Comment thread src/crimson/osd/watch.cc
notify->ninfo.notify_id);
return notify->complete_watcher(shared_from_this(), reply_bl
).then([this, notify_iter] {
in_progress_notifies.erase(notify_iter);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ultimately does in_progress_notifies.clear() but in the one-by-one manner. I'm worried we're prematurely freeing notifies here while the logic should be resembling Watch::cancel_notify().

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ultimately does in_progress_notifies.clear() but in the one-by-one manner. I'm worried we're prematurely freeing notifies here while the logic should be resembling Watch::cancel_notify().

IIUC, the issue here is that we switch to handle a concurrent different notify_ack before actually progressing to in_progress_notifies.clear() (according to the new logs). To avoid this, I erased the iterator right after calling complete_watcher.

@Matan-B

Matan-B commented Jun 13, 2023

Copy link
Copy Markdown
Contributor Author

#51945

@Matan-B Matan-B closed this Jun 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants