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

Lock wait timeout exceeded; try restarting transaction bug #34284

Open
Y-sir opened this issue Jan 8, 2025 · 2 comments
Open

Lock wait timeout exceeded; try restarting transaction bug #34284

Y-sir opened this issue Jan 8, 2025 · 2 comments

Comments

@Y-sir
Copy link

Y-sir commented Jan 8, 2025

Bug Report

For English only, other languages will not accept.

Before report a bug, make sure you have:

Please pay attention on issues you submitted, because we maybe need more details.
If no response anymore and we cannot reproduce it on current information, we will close it.

Please answer these questions before submitting your issue. Thanks!

Which version of ShardingSphere did you use?

5.5.1

Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?

ShardingSphere-Proxy MySQL 5.7.44-log

Expected behavior

Execution Success

Actual behavior

Execution failed with error Usage question that isn't answered in docs or discussion

Reason analyze (If you can)

The situation is like this. When I connect to the proxy database and execute the update statement, an error is reported: Lock wait timeout exceeded; try restarting transaction
I did not find the wrong SQL because no errors were reported in the proxy library before the update statement was executed. However, I checked the proxied MySQL database, which is the source database, to see if there were any uncommitted transactions in the source database.

1、Use
SHOW ENGINE INNODB STATUS;
to check whether there are any uncommitted transactions, as shown below

image

It was found that two transactions of MySQL thread id 935711 and MySQL thread id 935688 were not committed.

2、Use
SELECT * FROM information_schema.innodb_trx WHERE trx_mysql_thread_id IN (SELECT trx_mysql_thread_id FROM information_schema.innodb_trx WHERE trx_id IN (SELECT trx_id FROM information_schema.innodb_trx));
to query the SQL statements of threads 935711 and 935688. The result is shown in the figure below. trx_query is null, which means that the executed SQL statement is not recorded, which confuses me.

image

Since there is no error in the program itself, I cannot provide steps to reproduce the problem. The "Lock wait timeout reached; try restarting transaction" error is reported only when executing an update statement. But since trx_query is null, I don't know which statement caused the lock. This confuses me. Has anyone encountered this situation?

Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.

Example codes for reproduce this issue (such as a github link).

@terrymanu
Copy link
Member

Is the behavior the same in MySQL 8.x versions?

Copy link

There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.

@github-actions github-actions bot added the stale label Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants