带有 121 子状态的 HTTP 500 错误表示什么?
What does an HTTP 500 error with a 121 sub-status signify?
我在 Azure 中有一个 Web 应用程序 运行,我遇到过几次服务器无响应的中断。当我查看 IIS 日志时,我看到 HTTP 500 错误,sc-substatus
为 121,sc-win32-status
为 0。
省略所有其他字段,日志如下所示,顺序如下:
sc-status sc-substatus sc-win32-status
500 121 0
我在任何地方都找不到对 500.121 错误的引用。
我刚从一位 Azure 软件工程师那里得到这个:
121 is a timeout event which basically means that the request spent
230 seconds on the worker VM without initiating any read/write IO on
the connection. It is highly likely for this to be an application
issue, but doesn’t necessarily have to be so.
IIS 日志的耗时值都在 230 秒左右徘徊。谜底揭晓。
我们看到了同样的问题。
TLDR
- 我们在 Azure Sql 数据库中使用 Always Encrypted。
- 我们使用 Azure Key Vault 来存储我们的主密钥。
- 我们发现为旧版本的 Azure Key Vault Provider 记录了以下错误 - https://support.microsoft.com/en-us/help/4016853/fix-deadlock-when-apps-try-to-acquire-or-refresh-an-authentication-tok
- 解决方案 - 我们将 Azure Key Vault Provider 从 1.x 版本升级到最新的 2.1.0 版本 - https://www.nuget.org/packages/Microsoft.SqlServer.Management.AlwaysEncrypted.AzureKeyVaultProvider/2.1.0
症状
- 我们开始生产 500/121。
- 所有响应时间都超过 230 秒。
- 问题总是相隔 2 小时...有时稍长。
日志记录
- 我们自己的记录没有显示任何内容。
- ELMAH 什么也没显示。
- 失败的请求跟踪未显示任何内容。
- 唯一的指示是在 IIS 日志中。
- 我们还从 Azure 门户应用服务的 诊断和解决问题 选项卡中收集了一些 .Net Profiler Traces 并包括在内线程栈。我们注意到有许多线程堆栈在做与 Always Encrypted 相关的事情。这只是有点奇怪,但它最终让我们将 Always Encrypted 视为罪魁祸首。
复制
- 此代码在 4 个不同的环境中。
- 它只发生在 2 个环境中。
- 我们没有任何事情会导致它发生。
MS 支持问题
Consider the following scenario:
You have Microsoft .NET Framework applications that use Always Encrypted in SQL Server 2016 or Azure SQL Database.
The column master keys for these applications are stored in the Azure Key Vault.
In this scenario, the applications experience deadlocks. Therefore,
the applications become unresponsive (hang) or time out.
The deadlocks may occur during attempts to acquire or refresh an
authentication token for the Azure Key Vault.
Azure Key Vault Provider v2.1.0 发行说明
This release addresses a bug existing in all previous releases which
can cause deadlocks in multi-threaded applications.
我在 Azure 中有一个 Web 应用程序 运行,我遇到过几次服务器无响应的中断。当我查看 IIS 日志时,我看到 HTTP 500 错误,sc-substatus
为 121,sc-win32-status
为 0。
省略所有其他字段,日志如下所示,顺序如下:
sc-status sc-substatus sc-win32-status
500 121 0
我在任何地方都找不到对 500.121 错误的引用。
我刚从一位 Azure 软件工程师那里得到这个:
121 is a timeout event which basically means that the request spent 230 seconds on the worker VM without initiating any read/write IO on the connection. It is highly likely for this to be an application issue, but doesn’t necessarily have to be so.
IIS 日志的耗时值都在 230 秒左右徘徊。谜底揭晓。
我们看到了同样的问题。
TLDR
- 我们在 Azure Sql 数据库中使用 Always Encrypted。
- 我们使用 Azure Key Vault 来存储我们的主密钥。
- 我们发现为旧版本的 Azure Key Vault Provider 记录了以下错误 - https://support.microsoft.com/en-us/help/4016853/fix-deadlock-when-apps-try-to-acquire-or-refresh-an-authentication-tok
- 解决方案 - 我们将 Azure Key Vault Provider 从 1.x 版本升级到最新的 2.1.0 版本 - https://www.nuget.org/packages/Microsoft.SqlServer.Management.AlwaysEncrypted.AzureKeyVaultProvider/2.1.0
症状
- 我们开始生产 500/121。
- 所有响应时间都超过 230 秒。
- 问题总是相隔 2 小时...有时稍长。
日志记录
- 我们自己的记录没有显示任何内容。
- ELMAH 什么也没显示。
- 失败的请求跟踪未显示任何内容。
- 唯一的指示是在 IIS 日志中。
- 我们还从 Azure 门户应用服务的 诊断和解决问题 选项卡中收集了一些 .Net Profiler Traces 并包括在内线程栈。我们注意到有许多线程堆栈在做与 Always Encrypted 相关的事情。这只是有点奇怪,但它最终让我们将 Always Encrypted 视为罪魁祸首。
复制
- 此代码在 4 个不同的环境中。
- 它只发生在 2 个环境中。
- 我们没有任何事情会导致它发生。
MS 支持问题
Consider the following scenario:
You have Microsoft .NET Framework applications that use Always Encrypted in SQL Server 2016 or Azure SQL Database. The column master keys for these applications are stored in the Azure Key Vault.
In this scenario, the applications experience deadlocks. Therefore, the applications become unresponsive (hang) or time out.
The deadlocks may occur during attempts to acquire or refresh an authentication token for the Azure Key Vault.
Azure Key Vault Provider v2.1.0 发行说明
This release addresses a bug existing in all previous releases which can cause deadlocks in multi-threaded applications.