Hello Isabella,
Thank you for posting your question on Microsoft Windows Forum!
The error:
Lock wait timeout exceeded; try restarting transaction
usually indicates that one transaction is holding locks for an extended period, causing other transactions to wait until they eventually time out.
Since you've already identified that threads are accumulating and standard process monitoring isn't clearly showing the blocker, I would focus on identifying the blocking transaction before making any configuration changes.
Recommended Troubleshooting Steps
Step 1: Check active InnoDB transactions
Run:
SELECT *
FROM information_schema.innodb_trx;
This will show currently running transactions, including those that have been active for a long time.
Step 2: Identify blocking and waiting sessions
If Performance Schema is enabled, run:
SELECT *
FROM performance_schema.data_lock_waits;
and
SELECT *
FROM performance_schema.data_locks;
These tables can help identify which session is blocking another transaction.
Step 3: Review InnoDB engine status
Run:
SHOW ENGINE INNODB STATUS\G
This is often the fastest way to identify:
- Blocking transactions
- Lock contention
- Deadlocks
- Long-running transactions
Pay special attention to the LATEST DETECTED DEADLOCK and TRANSACTIONS sections.
Step 4: Check for long-running transactions
Run:
SELECT
trx_id,
trx_state,
trx_started,
trx_mysql_thread_id
FROM information_schema.innodb_trx
ORDER BY trx_started;
A transaction that remains open for a long time can block checkout-related updates and inserts even when queries appear normal.
Step 5: Review application behavior
Since this affects checkout operations during peak hours, I would also verify:
- Transactions are committed promptly.
- Transactions are not left open while waiting for external services.
- Application code is not holding locks longer than necessary.
- Missing indexes are not causing excessive row scans.
My Observation
Because the issue previously worked normally and is now occurring during peak periods, the most likely causes are:
- A recently introduced long-running transaction.
- Increased lock contention caused by application changes.
- Missing or inefficient indexes resulting in more rows being locked than expected.
The quickest way forward is usually:
SHOW ENGINE INNODB STATUS\G
combined with:
SELECT * FROM information_schema.innodb_trx;
These two outputs often reveal the exact transaction that other sessions are waiting on.
I hope this answer has brought you useful information. If so, please click on Accept Answer and consider upvoting it. Doing so helps other community members identify useful solutions to similar issues.