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

fix tracer and meter ref-counting #370

Merged
merged 2 commits into from Feb 16, 2023
Merged

fix tracer and meter ref-counting #370

merged 2 commits into from Feb 16, 2023

Conversation

avsej
Copy link
Member

@avsej avsej commented Feb 15, 2023

After this change, the library got issues with stopping cluster properly: https://github.com/couchbaselabs/couchbase-cxx-client/pull/359/files#diff-d57958cc60b900a216af3a607194ccac57e75457e69eddfa953cca5b33f2cc78R59.

So I dig it a bit and found several issues:

  • meter uses raw pointer to capture itself in the periodic timer (which causes leak and potential use-after-free)
  • we should really try to signal timers in tracer and meter before relying on destructors, because some references might be still hold by IO threads
  • when error occurs during core::cluster::open(), we should ensure that the cluster in closed state, in particular meter/tracer should be also stopped.

@avsej avsej requested review from davidkelly and a team February 15, 2023 20:08
@avsej avsej marked this pull request as draft February 15, 2023 21:31
@avsej avsej marked this pull request as ready for review February 16, 2023 09:51
@avsej avsej merged commit 4a46b7c into main Feb 16, 2023
@avsej avsej deleted the tracer-meter-ref-counting branch February 16, 2023 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants