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

plan-cache memory leak #8330

Closed
lysu opened this issue Nov 15, 2018 · 0 comments
Closed

plan-cache memory leak #8330

lysu opened this issue Nov 15, 2018 · 0 comments
Assignees
Labels
sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@lysu
Copy link
Contributor

lysu commented Nov 15, 2018

Bug Report

  1. What did you do?
    If possible, provide a recipe for reproducing the error.
  • enable plan-cache and set a big plan-cache capacity
  • open mulitple connections to tidb and for each of them do a dead loop to "prepare -> execute -> deallocate"
  • see memory metric from granafna or htop.

can reproduce using this java code

		Connection connection = null;
		PreparedStatement ps = null;
		try {
			connection = dataSource.getConnection();
			ps = connection.prepareStatement(" INSERT INTO TEST_TBL (COL0,COL1,COL2,COL3,COL4,COL5,COL6,COL7,COL8) VALUES(?,?,?,?,?,?,?,?,NOW(3)) ON DUPLICATE KEY UPDATE COL6=values(col6), COL7=values(col7), COL8=values(col8)");
			while (true) {
				try {
					for (int i1 = 0; i1 < 100; i1++) {
						ps.setString(1, i1 + "1");
						ps.setInt(2, 1);
						ps.setString(3, "1");
						ps.setInt(4, 1);
						ps.setInt(5, 1);
						ps.setString(6, "1");
						ps.setString(7, "1");
						ps.setDate(8, new Date(System.currentTimeMillis()));
						ps.addBatch();
					}
					ps.executeBatch();
					System.out.println("write one batch");
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			closeAll(connection, ps);
		}

with jdbc url param:

spring.datasource.hikari.data-source-properties.useServerPrepStmts=true
spring.datasource.hikari.data-source-properties.rewriteBatchedStatements=true
spring.datasource.hikari.data-source-properties.allowMultiQueries=true
  1. What did you expect to see?

tidb memory increase then keep a value

  1. What did you see instead?

always increase and OOM

  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
  • 2.0.1.rc5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

1 participant