Skip to content

Memory loitering in driver for reused connections and protocol path that doesn't reset affectedRows and insertIDs accumulators #1304

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

Closed
aforrest-google opened this issue Jan 25, 2022 · 3 comments

Comments

@aforrest-google
Copy link

aforrest-google commented Jan 25, 2022

Issue description

After the introduction of #1263 which adds support for multiple rows affected and insert IDs being returned for multi-statement requests, there are some conditions that lead to a memory loitering issue (both must be true):

  1. If the connection is reused
  2. If the protocol path involved results in an OK Packet (e.g. a resultSetHeaderPacket)

Notably, the Query path in the driver implementation is affected by this second condition. Any extremely long running process that continually reuses a connection and uses the Query path (as opposed to the Exec path) will experience this issue.

Example code

  for {
    if err := conn.Ping(); err != nil {
      return err
    }
    time.Sleep(time.Second)
  }

Error log

Not applicable.

Configuration

Driver version (or git SHA): 1.6

Go version: 1.17

Server version: MySQL 5.7

Server OS: N/A

@aforrest-google
Copy link
Author

I have a PR for this. Will mail shortly.

@aforrest-google
Copy link
Author

Going to collaborate with author of unmerged PR # 1263 to submit the PR that would address this issue. Closing.

@mherr-google
Copy link
Contributor

This is fixed in 2e231fa.

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

No branches or pull requests

2 participants