On SQL Server a wait for another process's migrations fails at the command timeout without naming the lock

未关闭
#3,192 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
58/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
csharp
领域
databases

调研方向

Start by reading the SQL Server migrations lock handling and the SQLite lock behavior added for #3177, then inspect the related changes in #3186. Add SQL Server coverage that holds the application lock in another session and checks that waiting exceeds the command timeout, logs one warning, and ends with the lock named; confirm migration command timeouts remain unchanged. Update the operations documentation to describe what operators see.

由索引模型根据 Issue 内容生成。

描述

area:storage type:bug

Problem

On SQL Server, EF Core takes the migrations lock with sp_getapplock on __EFMigrationsLock, with a session owner and no lock timeout, outside the execution strategy. A fluentcms migrate or a host start that waits for another process's migration for longer than the command timeout, 30 seconds by default, fails with SqlException: Execution Timeout Expired, which names neither the lock nor the other process. It does not hang, a killed holder's session releases the lock, and a second run works; but parallel init containers hit it on any migration that takes longer than 30 seconds.

Found while fixing #3177 (#3190), which bounds the same wait on SQLite and names the row. Reproduced there on SQL Server 2025 by holding the application lock from another session.

Proposal

The runner waits for the lock itself on SQL Server, with the warning and the bound it has on SQLite, and fails with an error that names the lock and says that another process is migrating; a timeout of a migration command itself must stay what it is.

Acceptance

  • A start or migrate on SQL Server that waits for another session's migrations lock waits past the command timeout, logs the warning once, and ends with the lock or with an error that names it
  • A test holds it on SQL Server
  • The operations documentation says what an operator sees

Size: S. Goes to main, as bugs do. After #3186, which works in the same files.

主要语言
C#
星标
567
派生
107
平均合并
1 小时 19 分钟
30 天内合并 PR
353

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

fluentcms/FluentCMS 的其他 Issue

查看 fluentcms/FluentCMS 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。