Azure / Azure/data-api-builder

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

Đang mở
#2,162 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug triage
Ngôn ngữ chính
C#
Star
1.5k
Fork
370
Merge trung bình
3 ngày 22 giờ
Pull request đã merge (30 ngày)
9

Mô tả

### 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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu với src/Core/Services/MetadataProviders/SqlMetadataProvider.cs tại PopulateObjectDefinitionForEntities và InitializeAsync, sau đó lần theo lỗi đến src/Service/Startup.cs tại PerformOnConfigChangeAsync. Tái hiện kịch bản scale-to-zero của Azure Container Apps với Azure SQL và xác định lý do việc khởi tạo runtime thất bại trong post-login timeout. Công việc được hoàn tất khi nguyên nhân và một giải pháp đã được xác minh cho request đầu tiên sau scale-up được xác lập.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
azure, csharp, sql
Lĩnh vực
backend, cloud, database
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.