Transaction related DB errors attempt to rollback outside of a transaction and cause a fatal error
评估
调研方向
从 Mysql.php 约第 411 行开始,跟踪 Queued Tracking 用于处理事务相关数据库错误的 onException 处理逻辑。检查错误状态和 rollback 是如何触发的,然后验证在不再存在事务时,诸如 1020 之类的可重试错误不会导致致命的 rollback。
由索引模型根据 Issue 内容生成。
描述
If an innodb_snapshot_isolation or similar transaction-related DB exception occurs during processing, Queued Tracking attempts to roll back but there's no transaction any more - the DB has already aborted the transaction, so this throws a fatal error and causes unwanted side effects such as site-wide cache destruction (https://github.com/matomo-org/matomo/issues/25000).
Starting to process request sets, this can take a while
Error query: Error query: SQLSTATE[HY000]: General error: 1020 Record has changed since last read in table 'matomo_log_visit'; try restarting transaction In query: UPDATE matomo_log_visit SET profilable = ?, visitor_seconds_since_order = ?, visit_exit_idaction_name = ?, visit_exit_idaction_url = ?, visit_total_actions = visit_total_actions + 1 , visit_total_interactions = visit_total_interactions + 1 , visit_total_time = ? WHERE idsite = ? AND idvisit = ? Parameters: array (
0 => 1,
1 => NULL,
2 => 200127,
3 => 200128,
4 => 952,
5 => 1,
6 => 1234653346,
) In query: UPDATE matomo_log_visit SET profilable = ?, visitor_seconds_since_order = ?, visit_exit_idaction_name = ?, visit_exit_idaction_url = ?, visit_total_actions = visit_total_actions + 1 , visit_total_interactions = visit_total_interactions + 1 , visit_total_time = ? WHERE idsite = ? AND idvisit = ? Parameters: array (
0 => 1,
1 => NULL,
2 => 200127,
3 => 200128,
4 => 952,
5 => 1,
6 => 1234653346,
)
In Mysql.php line 411:
There is no active transaction
It would be good to add 1020 to onException so it at least gets retried (MariaDB LTS has innodb_snapshot_isolation on by default), but attempting to rollback outside of the transaction is still fatal - this is already the case with InnoDB deadlocks and other transaction related errors. I would suggest catching a rollback with no active transaction error and make it a no-op as the current logic always sets $this->hasError = true even if it's a retriable transaction error, so rollbacks are triggered regardless.
- 主要语言
- PHP
- 星标
- 87
- 派生
- 42
- 平均合并
- 2 天 8 小时
- 30 天内合并 PR
- 4
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
matomo-org/plugin-QueuedTracking 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 58/100
matomo-org/plugin-QueuedTracking#324 · 1 个 reaction ·
-
难度 4/5 3-5 天 新手友好度 48/100
matomo-org/plugin-QueuedTracking#320 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 50/100
-
enhancement
难度 3/5 1-2 天 新手友好度 42/100
-
enhancement triaged
难度 4/5 3-5 天 新手友好度 43/100
matomo-org/plugin-QueuedTracking#296 · 2 条评论 ·
查看 matomo-org/plugin-QueuedTracking 的全部 Issue
相似的 Issue
-
PHP workflow streaming requests buffer the full SSE response可能已有人在做 @Winoren 今天认领。 未关闭review: medium
难度 2/5 1-3 小时 新手友好度 84/100
langgenius/dify#44270 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
bug customer-reported
难度 1/5 1 小时以内 新手友好度 90/100
MagnaCapax/PMSS#1085 ·
维护者通常 5 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 83/100
nunomaduro/collision#375 ·
-
enhancement good first issue hacktoberfest help wanted
难度 2/5 1-3 小时 新手友好度 68/100
thetheago/laravel-seeder-versioning#19 ·
维护者通常 1 天内回复