[英]Azure Web App Service "container is unhealthy" error forcing container restart every 15min
我有一個在 Azure Web App 環境 (Linux) 中運行的 dot net core 3.1 應用程序。 該應用程序在本地環境/調試中運行良好。 發布到 Azure 時,應用程序運行,但在應用程序日志中,由於容器消息不正常,我看到容器每隔約 15 分鍾重新啟動一次。 內存和處理器負載遠低於 50%,應用程序沒有特殊負載。
我不知道為什么它在日志中顯示“不健康”並如此頻繁地重新啟動容器。 配置設置中是否缺少任何內容?
為什么容器會頻繁重啟,在哪里尋找更多的錯誤特定信息來調試這個問題?
歡迎任何提示。
應用程序日志:
2020-10-06T08:08:57.693Z INFO - Starting container for site
2020-10-06T08:08:57.693Z INFO - docker run -d -p 5159:8080 --name wttcycleswebapp_0_8c7e9ba1 -e WEBSITE_SITE_NAME=WTTCyclesWebApp -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=wttcycleswebapp.azurewebsites.net -e WEBSITE_INSTANCE_ID=92c475eedd41771f9c6f8d7f8c52ad11b610d1d082a92269eb132b8b216a0d8d -e HTTP_LOGGING_ENABLED=1 appsvc/dotnetcore:3.1-latest_20200717.2 dotnet Cycles.dll
2020-10-06T08:08:58.845Z INFO - Initiating warmup request to container wttcycleswebapp_0_8c7e9ba1 for site wttcycleswebapp
2020-10-06T08:09:04.094Z INFO - Container wttcycleswebapp_0_8c7e9ba1 for site wttcycleswebapp initialized successfully and is ready to serve requests.
2020-10-06T08:24:34.102Z ERROR - Container for wttcycleswebapp_0_8c7e9ba1 site wttcycleswebapp is unhealthy, Stopping site.
2020-10-06T08:24:34.102Z INFO - Stopping site wttcycleswebapp because it is not healthy.
2020-10-06T08:27:15.247Z INFO - Starting container for site
2020-10-06T08:27:15.248Z INFO - docker run -d -p 6236:8080 --name wttcycleswebapp_0_6391dc4a -e WEBSITE_SITE_NAME=WTTCyclesWebApp -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=wttcycleswebapp.azurewebsites.net -e WEBSITE_INSTANCE_ID=92c475eedd41771f9c6f8d7f8c52ad11b610d1d082a92269eb132b8b216a0d8d -e HTTP_LOGGING_ENABLED=1 appsvc/dotnetcore:3.1-latest_20200717.2 dotnet Cycles.dll
2020-10-06T08:27:16.384Z INFO - Initiating warmup request to container wttcycleswebapp_0_6391dc4a for site wttcycleswebapp
2020-10-06T08:27:20.657Z INFO - Container wttcycleswebapp_0_6391dc4a for site wttcycleswebapp initialized successfully and is ready to serve requests.
2020-10-06T08:36:35.799Z ERROR - Container for wttcycleswebapp_0_6391dc4a site wttcycleswebapp is unhealthy, Stopping site.
2020-10-06T08:36:35.799Z INFO - Stopping site wttcycleswebapp because it is not healthy.
2020-10-06T08:36:38.668Z INFO - Starting container for site
2020-10-06T08:36:38.669Z INFO - docker run -d -p 3648:8080 --name wttcycleswebapp_0_6ad6dbd7 -e WEBSITE_SITE_NAME=WTTCyclesWebApp -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=wttcycleswebapp.azurewebsites.net -e WEBSITE_INSTANCE_ID=92c475eedd41771f9c6f8d7f8c52ad11b610d1d082a92269eb132b8b216a0d8d -e HTTP_LOGGING_ENABLED=1 appsvc/dotnetcore:3.1-latest_20200717.2 dotnet Cycles.dll
2020-10-06T08:36:39.633Z INFO - Initiating warmup request to container wttcycleswebapp_0_6ad6dbd7 for site wttcycleswebapp
2020-10-06T08:36:43.884Z INFO - Container wttcycleswebapp_0_6ad6dbd7 for site wttcycleswebapp initialized successfully and is ready to serve requests.
2020-10-06T08:51:38.900Z ERROR - Container for wttcycleswebapp_0_6ad6dbd7 site wttcycleswebapp is unhealthy, Stopping site.
2020-10-06T08:51:38.901Z INFO - Stopping site wttcycleswebapp because it is not healthy.
2020-10-06T08:51:39.775Z INFO - Starting container for site
2020-10-06T08:51:39.776Z INFO - docker run -d -p 3002:8080 --name wttcycleswebapp_0_f59f6020 -e WEBSITE_SITE_NAME=WTTCyclesWebApp -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=wttcycleswebapp.azurewebsites.net -e WEBSITE_INSTANCE_ID=92c475eedd41771f9c6f8d7f8c52ad11b610d1d082a92269eb132b8b216a0d8d -e HTTP_LOGGING_ENABLED=1 appsvc/dotnetcore:3.1-latest_20200717.2 dotnet Cycles.dll
2020-10-06T08:51:40.854Z INFO - Initiating warmup request to container wttcycleswebapp_0_f59f6020 for site wttcycleswebapp
2020-10-06T08:51:45.135Z INFO - Container wttcycleswebapp_0_f59f6020 for site wttcycleswebapp initialized successfully and is ready to serve requests.
2020-10-06T09:23:50.153Z ERROR - Container for wttcycleswebapp_0_f59f6020 site wttcycleswebapp is unhealthy, Stopping site.
2020-10-06T09:23:50.154Z INFO - Stopping site wttcycleswebapp because it is not healthy.
2020-10-06T09:23:50.958Z INFO - Starting container for site
2020-10-06T09:23:50.959Z INFO - docker run -d -p 3270:8080 --name wttcycleswebapp_0_0c8ce05e -e WEBSITE_SITE_NAME=WTTCyclesWebApp -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=wttcycleswebapp.azurewebsites.net -e WEBSITE_INSTANCE_ID=92c475eedd41771f9c6f8d7f8c52ad11b610d1d082a92269eb132b8b216a0d8d -e HTTP_LOGGING_ENABLED=1 appsvc/dotnetcore:3.1-latest_20200717.2 dotnet Cycles.dll
2020-10-06T09:24:01.308Z INFO - Initiating warmup request to container wttcycleswebapp_0_0c8ce05e for site wttcycleswebapp
2020-10-06T09:24:01.600Z INFO - Container wttcycleswebapp_0_0c8ce05e for site wttcycleswebapp initialized successfully and is ready to serve requests.
2020-10-06T11:00:33.648Z INFO - Starting container for site
2020-10-06T11:00:33.649Z INFO - docker run -d -p 4757:8080 --name wttcycleswebapp_2_de12fb53 -e WEBSITE_SITE_NAME=WTTCyclesWebApp -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=wttcycleswebapp.azurewebsites.net -e WEBSITE_INSTANCE_ID=92c475eedd41771f9c6f8d7f8c52ad11b610d1d082a92269eb132b8b216a0d8d -e HTTP_LOGGING_ENABLED=1 appsvc/dotnetcore:3.1-latest_20200717.2 dotnet Cycles.dll
2020-10-06T11:00:35.792Z INFO - Initiating warmup request to container wttcycleswebapp_2_de12fb53 for site wttcycleswebapp
2020-10-06T11:00:42.307Z INFO - Container wttcycleswebapp_2_de12fb53 for site wttcycleswebapp initialized successfully and is ready to serve requests.
2020-10-06T11:16:17.316Z ERROR - Container for wttcycleswebapp_2_de12fb53 site wttcycleswebapp is unhealthy, Stopping site.
2020-10-06T11:16:17.316Z INFO - Stopping site wttcycleswebapp because it is not healthy.
2020-10-06T11:16:24.769Z INFO - Starting container for site
2020-10-06T11:16:24.769Z INFO - docker run -d -p 1185:8080 --name wttcycleswebapp_0_3904d3bf -e WEBSITE_SITE_NAME=WTTCyclesWebApp -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=wttcycleswebapp.azurewebsites.net -e WEBSITE_INSTANCE_ID=92c475eedd41771f9c6f8d7f8c52ad11b610d1d082a92269eb132b8b216a0d8d -e HTTP_LOGGING_ENABLED=1 appsvc/dotnetcore:3.1-latest_20200717.2 dotnet Cycles.dll
2020-10-06T11:16:25.662Z INFO - Initiating warmup request to container wttcycleswebapp_0_3904d3bf for site wttcycleswebapp
2020-10-06T11:16:36.943Z INFO - Container wttcycleswebapp_0_3904d3bf for site wttcycleswebapp initialized successfully and is ready to serve requests.
2020-10-06T11:31:56.959Z ERROR - Container for wttcycleswebapp_0_3904d3bf site wttcycleswebapp is unhealthy, Stopping site.
2020-10-06T11:31:56.959Z INFO - Stopping site wttcycleswebapp because it is not healthy.
2020-10-06T11:31:58.658Z INFO - Starting container for site
2020-10-06T11:31:58.659Z INFO - docker run -d -p 2576:8080 --name wttcycleswebapp_0_590a51f3 -e WEBSITE_SITE_NAME=WTTCyclesWebApp -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=wttcycleswebapp.azurewebsites.net -e WEBSITE_INSTANCE_ID=92c475eedd41771f9c6f8d7f8c52ad11b610d1d082a92269eb132b8b216a0d8d -e HTTP_LOGGING_ENABLED=1 appsvc/dotnetcore:3.1-latest_20200717.2 dotnet Cycles.dll
2020-10-06T11:31:59.684Z INFO - Initiating warmup request to container wttcycleswebapp_0_590a51f3 for site wttcycleswebapp
2020-10-06T11:32:03.912Z INFO - Container wttcycleswebapp_0_590a51f3 for site wttcycleswebapp initialized successfully and is ready to serve requests.
另外,我可以在“容器崩潰”日志中看到:
Container exited unexpectedly: last 10 seconds logs [
2020-10-06T11:16:14.928728537Z Could not open output /home/logs/dumps/coredump.f7d267b6a38a.28.1601982035: No such file or directory
2020-10-06T11:16:14.931442136Z Writing minidump with heap to file /home/logs/dumps/coredump.f7d267b6a38a.28.1601982035
2020-10-06T11:16:15.118711399Z /opt/startup/startup.sh: line 10: 28 Aborted (core dumped) dotnet Cycles.dll
]
嘗試在文件系統上寫入日志時,您的應用程序似乎崩潰了。 如果您的日志被寫入磁盤或每 15 分鍾輪換一次,這可能是失敗的原因。 作為一種好的做法,最好將日志重定向到標准控制台輸出,而不是將它們寫入文件系統。
另一個可能的解釋可能是日志位置的權限問題
同意 totor 它與日志文件有關。
它在本地工作但在 Azure 中不起作用,這為可能是根本原因提供了線索。
您可能需要啟用容器日志。
應用服務 -> 監控 -> 應用服務日志:然后打開文件系統日志記錄
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.