Skip to content

Cherry pick of VStream API: Fix vtgate memory leaks when context gets cancelled#10576

Merged
rohit-nayak-ps merged 1 commit intovitessio:release-14.0from
planetscale:rn-cp-10571
Jun 24, 2022
Merged

Cherry pick of VStream API: Fix vtgate memory leaks when context gets cancelled#10576
rohit-nayak-ps merged 1 commit intovitessio:release-14.0from
planetscale:rn-cp-10571

Conversation

@rohit-nayak-ps
Copy link
Copy Markdown
Member

@rohit-nayak-ps rohit-nayak-ps commented Jun 24, 2022

Description

This PR fixes a couple of memory leaks in the VStream API which was causing vtgates to OOM.

  • Check for cancelled context when events received from the source were being sent into a event channel for eventual streaming to the vstream api client.
  • When a context is cancelled, in the vstream API we need to return an error in the health streamer callback. Otherwise it keeps streaming and leaking (goroutines and ) grpc request buffers.

Backport of #10571

Signed-off-by: Rohit Nayak rohit@planetscale.com

…hannel might block the vstream thread if target channel goes away: context was not being checked then. Fix health stream goroutine leak.

Signed-off-by: Rohit Nayak <rohit@planetscale.com>
@github-actions
Copy link
Copy Markdown
Contributor

Review Checklist

Hello reviewers! 👋 Please follow this checklist when reviewing this Pull Request.

General

  • If this is a change that users need to know about, please apply the release notes (needs details) label so that merging is blocked unless the summary release notes document is included.
  • If a new flag is being introduced, review whether it is really needed. The flag names should be clear and intuitive (as far as possible), and the flag's help should be descriptive.
  • If a workflow is added or modified, each items in Jobs should be named in order to mark it as required. If the workflow should be required, the GitHub Admin should be notified.

Bug fixes

  • There should be at least one unit or end-to-end test.
  • The Pull Request description should either include a link to an issue that describes the bug OR an actual description of the bug and how to reproduce, along with a description of the fix.

Non-trivial changes

  • There should be some code comments as to why things are implemented the way they are.

New/Existing features

  • Should be documented, either by modifying the existing documentation or creating new documentation.
  • New features should have a link to a feature request issue or an RFC that documents the use cases, corner cases and test cases.

Backward compatibility

  • Protobuf changes should be wire-compatible.
  • Changes to _vt tables and RPCs need to be backward compatible.
  • vtctl command output order should be stable and awk-able.

@rohit-nayak-ps rohit-nayak-ps merged commit 5a8fbd3 into vitessio:release-14.0 Jun 24, 2022
@rohit-nayak-ps rohit-nayak-ps deleted the rn-cp-10571 branch June 24, 2022 16:28
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