Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mgr/MgrClient: use unique_ptr for MgrClient::session #13685

Merged
merged 2 commits into from Mar 1, 2017

Conversation

tchaikov
Copy link
Contributor

* use unique_ptr<MgrSessionState> for MgrClient::session, so we don't leak it.
* also reset it in MgrClient::shutdown(), so the connection held by session can
  be released properly, and hence the MonClient will not be asked for
  an AuthAuthorizer after being shut down.

Fixes: http://tracker.ceph.com/issues/19097
Signed-off-by: Kefu Chai <kchai@redhat.com>
return auth->build_authorizer(service_id);
else
return active_con->get_auth()->build_authorizer(service_id);
Copy link
Contributor

Choose a reason for hiding this comment

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

You don't explain in the commit comment why you no longer try active_con->get_auth(). It sounds like you were just replacing the assert with a message.

Copy link
Contributor Author

@tchaikov tchaikov Mar 1, 2017

Choose a reason for hiding this comment

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

because the active_con->get_auth() will be promoted to this->auth, once the client is authorized. and and we will std::swap() this->auth and active_con->get_auth() with the monc lock, so it's always null. i will update the commit message.

@wjwithagen
Copy link
Contributor

@tchaikov
Fixed my problem in ceph_objectstore_tool.py

Thanx.

* there is chance that some connections is still trying to authorize
  itself after the MonClient is shut down. do not assert in this case,
  but it is a sign of bug, or bad shutdown sequence, so print a message to
  dout().
* do not use active_con->get_auth() as an alternative to `this->auth` if
  it is not available. because we promote the authorized conn in
  pending_cons as the active_con, and std::swap(active_conn->auth, this->auth)
  with the monc_lock. so there is no point to return active_con->get_auth(),
  as it's always null.

Signed-off-by: Kefu Chai <kchai@redhat.com>
@tchaikov
Copy link
Contributor Author

tchaikov commented Mar 1, 2017

changelog

  • updated the commit message to explain why i no longer try active_con->get_auth()

@dzafman fixed and repushed

@liuchang0812
Copy link
Contributor

Awesome work.

@tchaikov tchaikov mentioned this pull request Mar 1, 2017
@tchaikov
Copy link
Contributor Author

tchaikov commented Mar 1, 2017

@tchaikov tchaikov merged commit fec59e8 into ceph:master Mar 1, 2017
@tchaikov tchaikov deleted the wip-19097 branch March 1, 2017 10:12
@tchaikov
Copy link
Contributor Author

tchaikov commented Mar 1, 2017

@liewegas because this PR silences lots of false alarm in our "make check" runs, so i merged it once i found the qa runs looked good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants