Azure / Azure/data-api-builder

DataApiBuilderException: Cannot obtain Schema for entity with underlying database object source: due to: Connection Timeout Expired.

オープン
#2,162 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
bug triage
主要言語
C#
スター
1.5k
フォーク
370
平均マージ
3日 22時間
マージ済み PR(30日)
9

説明

### What happened?

Single Web Aapp - hosted Blazor WASM
DAB - hosted on Container App - one container, one single revision.

1. Everything connected and setup, scaled to 1 revision running.
2. Wait some time until scaled back to 0 - no traffic.
3. Make call from SWA - revision failed to scale to 1 - timeout error.

4. After next few calls from SWA, revision scaled to 1 and response received.

### Version

0.10.21

### What database are you using?

Azure SQL

### What hosting model are you using?

Container Apps

### Which API approach are you accessing DAB through?

REST

### Relevant log output

```Text
[41m[30mfail[39m[22m[49m: Azure.DataApiBuilder.Service.Startup[0]
12.04.2024, 12:49:51.964
Unable to complete runtime initialization. Refer to exception for error details.
12.04.2024, 12:49:51.964
Azure.DataApiBuilder.Service.Exceptions.DataApiBuilderException: Cannot obtain Schema for entity Customer with underlying database object source: SalesLT.Customer due to: Connection Timeout Expired. The timeout period elapsed during the post-login phase. The connection could have timed out while waiting for server to complete the login process and respond; Or it could have timed out while attempting to create multiple active connections. The duration spent while attempting to connect to this server was - [Pre-Login] initialization=114; handshake=575; [Login] initialization=1; authentication=6; [Post-Login] complete=14231;
12.04.2024, 12:49:51.964
at Azure.DataApiBuilder.Core.Services.SqlMetadataProvider`3.HandleOrRecordException(Exception e) in /src/src/Core/Services/MetadataProviders/SqlMetadataProvider.cs:line 90
12.04.2024, 12:49:51.964
at Azure.DataApiBuilder.Core.Services.SqlMetadataProvider`3.PopulateObjectDefinitionForEntities() in /src/src/Core/Services/MetadataProviders/SqlMetadataProvider.cs:line 919
12.04.2024, 12:49:51.964
at Azure.DataApiBuilder.Core.Services.SqlMetadataProvider`3.InitializeAsync() in /src/src/Core/Services/MetadataProviders/SqlMetadataProvider.cs:line 273
12.04.2024, 12:49:51.964
at Azure.DataApiBuilder.Core.Services.MetadataProviders.MetadataProviderFactory.InitializeAsync() in /src/src/Core/Services/MetadataProviders/MetadataProviderFactory.cs:line 64
12.04.2024, 12:49:51.964
at Azure.DataApiBuilder.Service.Startup.PerformOnConfigChangeAsync(IApplicationBuilder app) in /src/src/Service/Startup.cs:line 599
12.04.2024, 12:49:51.964
[41m[30mfail[39m[22m[49m: Azure.DataApiBuilder.Service.Startup[0]
12.04.2024, 12:49:51.964
Could not initialize the engine with the runtime config file: ./swa-db-connections/dab.config.json
12.04.2024, 12:49:51.964
[40m[32minfo[39m[22m[49m: Microsoft.Hosting.Lifetime[0]
12.04.2024, 12:49:51.964
Application is shutting down...
```

### Code of Conduct

- [X] I agree to follow this project's Code of Conduct

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

src/Core/Services/MetadataProviders/SqlMetadataProvider.cs の PopulateObjectDefinitionForEntities と InitializeAsync から始め、次に src/Service/Startup.cs の PerformOnConfigChangeAsync まで失敗を追跡します。Azure SQL に対して Azure Container Apps の scale-to-zero シナリオを再現し、post-login timeout 中にランタイムの初期化が失敗する理由を特定します。scale-up 後の最初のリクエストに対する原因と検証済みの解決策が確立されれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
azure, csharp, sql
領域
backend, cloud, database
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。