| Bug #119422 | Proposal: Reduce default lock_wait_timeout from 31536000 (1 year) to a safer value (1 day or 1 week) | ||
|---|---|---|---|
| Submitted: | 18 Nov 16:28 | Modified: | 19 Nov 1:27 |
| Reporter: | Hongju Yang | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server: Options | Severity: | S4 (Feature request) |
| Version: | 8.0.x / 8.4.x (latest) | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | default-value, feature-request, lock_wait_timeout, metadata-lock | ||
[18 Nov 16:28]
Hongju Yang
[18 Nov 16:30]
Hongju Yang
For example, the QueryPie tool used in my company behaves this way: when a user closes the browser tab, the frontend disappears, but the backend connection and its open transaction remain active on the server.
[18 Nov 16:31]
Hongju Yang
If it is helpful for evaluation, I can provide a prototype patch or additional technical details. I understand that the MySQL engineering team has their own internal processes, so please let me know what form of contribution is appropriate.
[18 Nov 16:37]
Hongju Yang
Additionally, I found historical context in this Percona article from more than 13 years ago: https://www.percona.com/blog/mysql-5-5-lock_wait_timeout-patience-is-a-virtue-and-a-locked... According to the article, the default value of 31536000 seconds (1 year) was introduced primarily to maintain backward compatibility with older MySQL versions, rather than because it was considered a safe or reasonable operational default. In the comments of the same article, experienced DBAs clearly state that a 1-year timeout is not a good default and that it is strongly recommended that DBAs adjust this value to something more practical for real-life environments. At that time, many users did not even know the `lock_wait_timeout` variable existed, and it made sense to avoid surprising users by changing defaults. However, the situation today is very different: - DBAs and developers now widely understand metadata locks and the behavior of `lock_wait_timeout`. - Modern database systems and tooling expose metadata lock wait issues much more clearly. - Production environments often involve web-based tools where abandoned connections are common, making a 1-year timeout increasingly problematic. Given this evolution, there is no longer a strong justification to keep such an extremely large and unsafe default value. MariaDB already changed this default to 1 day in version 10.2, and the community has not reported major operational issues resulting from that change. This indicates that modern systems can safely operate with a much shorter and more sensible default timeout. For these reasons, MySQL would benefit greatly from adopting a safer default value—such as 1 day or 1 week—rather than the legacy 1-year value that primarily exists for backward compatibility reasons that no longer apply today.
[18 Nov 19:10]
MySQL Verification Team
Thanks for the request and motivation behind it. In production, before running a DDL, one could set lock_wait_timeout in the session to the max time that you'd want to wait to start the DDL if there are blocking transactions (e.g. 300 seconds), or give up and retry later.
[19 Nov 1:27]
Hongju Yang
Thank you for the response. I understand that users *can* manually set a shorter lock_wait_timeout before running DDL. However, this feature request is not about whether a workaround exists — it is about the safety of the *default* value. The current default of 31536000 seconds (1 year) has repeatedly caused real production issues in modern environments where abandoned connections are common (e.g., web-based SQL tools such as QueryPie). In such environments, users often do not notice that a long-running or abandoned transaction is blocking DDL, and the 1-year default makes the problem almost invisible. This is not simply a configuration issue. It is a product design issue: the default value is no longer reasonable for modern workloads. MariaDB changed this default to 1 day in version 10.2 with no major negative impact reported by the community. Percona articles also point out that the 1-year default was originally kept only for backward compatibility many years ago and is not considered a good operational value. Modern systems and operators now fully understand metadata locks and lock_wait_timeout. Therefore, the compatibility argument is no longer valid. The request is to reconsider the *default* to a safer and more realistic value (e.g., 1 day or 1 week), not to ask how users can override it manually. I kindly ask that this request be forwarded to the development team for proper evaluation rather than being closed as “can be set manually.”
[19 Nov 4:25]
MySQL Verification Team
The FR is understood, and was not closed. It is verified. Thanks!
