다음 섹션에서는 일반적인 문제 해결 전략을 적용하여 오류를 해결하는 방법을 설명합니다. 문제 해결 가이드의 단계를 따르고도 오류가 계속 발생하면 다음 단계를 참조하세요.
Cloud Logging을 사용하여 유효한 로그 출력
디버깅을 위한 유효한 로그가 있으면 Cloud Run 리소스를 더 쉽게 해결할 수 있습니다. 컨테이너 로그와 요청 로그를 연결하는 방식으로 로그를 작성해야 합니다.
상관관계가 지정된 로그를 사용하면 추가 분석이 필요한 요청을 식별하고, 요청 트레이스를 찾고, 문제의 근본 원인을 분석할 수 있습니다. 로그 작성에 관한 자세한 내용은 컨테이너 로그 작성을 참조하세요.
로그 탐색기를 사용하여 인스턴스 조사
Cloud Run의 각 요청 로그에는 요청을 처리하는 인스턴스를 식별하는 instanceId 필드가 포함됩니다. 지정하는 동시 실행 값에 따라 단일 인스턴스가 여러 요청을 동시에 처리할 수 있습니다.
한 번에 로그를 내보내는 인스턴스가 여러 개 있는 경우 인스턴스를 필터링하여 인스턴스 비정상 종료로 이어지는 순차적 요청을 식별해야 합니다.
인스턴스를 필터링하면 콜드 스타트 또는 지연 시간 증가와 관련된 특정 성능 문제를 디버그할 수 있습니다. 이러한 문제는 후속 동시 요청에서 값이 재사용될 때 전역 범위에서 선언된 변수에 바인딩될 수도 있습니다. 인스턴스에 대해 단일 연결 풀 전역 객체를 만든 다음 여러 요청 내에서 이를 사용하는 경우를 예로 들 수 있습니다.
사용 가능한 모든 Cloud Run 측정항목 및 보다 자세한 세부정보의 목록은 Cloud Monitoring의 Google Cloud 측정항목을 참고하세요.
지연 시간이 긴 요청을 식별하여 지연 시간의 원인을 파악합니다.
Cloud Trace 또는 Cloud Logging을 사용하여 특정 요청에 걸린 시간을 파악할 수 있습니다.
Cloud Logging을 사용하여 지연 시간이 긴 요청을 식별하려면 traceSampled=true 필터를 적용하여 Cloud Logging의 로그를 Cloud Trace의 trace와 연결합니다. 자세한 내용은 Cloud Logging과 통합을 참조하세요.
때때로 서비스에 대한 요청과 같은 종속 항목으로 인해 지연 문제가 발생할 수 있습니다. 이러한 요청을 식별하려면 해당 요청을 대상으로 하는 명시적인 로깅이 있어야 합니다. 이러한 로그를 출력하지 않으면 Cloud Run 서비스에서 발생하는 지연 문제로 보일 수 있습니다.
또한 선택한 기간 컨텍스트에서 지연 시간 급증을 평가하는 것이 좋습니다. 이러한 급증의 중요성은 상대적입니다. 짧은 기간의 대규모 급증이 더 긴 기간에서는 무시할 만할 수 있고 그 반대의 경우도 마찬가지입니다.
따라서 기간은 지연 시간 데이터의 해석에 큰 영향을 미칩니다.
최소 인스턴스 수를 늘려 수신 요청의 지연 시간을 줄이고 콜드 스타트를 방지해 보세요. 소스 코드를 수정하고 확장 설정을 조정하여 지원 서비스에 대한 연결 수를 제한하는 것도 고려해야 합니다.
콘솔 툴바에서 Google Cloud 프로젝트를 선택합니다. Gemini Cloud Assist 액세스 권한을 부여받은 후 제출한 프로젝트 ID와 연결된 프로젝트를 사용합니다.
sparkGemini AI 채팅 열기 또는 닫기를 클릭합니다.
Gemini 패널이 열립니다.
필요한 경우 약관에 동의한다면 동의를 클릭합니다.
특정 애플리케이션에 관한 질문인 경우 질문하기 전에 리소스가 표시된 페이지로 이동하여 컨텍스트를 제공하세요. Gemini는 대답을 생성할 때 현재 콘솔 페이지와 프로젝트에 관한 정보를 포함합니다.
Gemini 패널에 프롬프트를 입력합니다.
다음 표에는 Cloud Run에서 Gemini Cloud Assist를 사용하는 프롬프트의 예가 나와 있습니다.
프롬프트
대답 유형
"Cloud Run 컨테이너 로그에 표시되는 이 오류 메시지를 설명해 줘."
프롬프트에 구체적인 오류 메시지가 없으면 출력에서 일반적인 Cloud Run 컨테이너 로그 오류 메시지에 대한 문제 해결 안내를 제공합니다.
"Cloud Run 서비스의 로그에 표시되는 이 오류 메시지를 설명해 줘."
HTTP 429 The request was aborted because there was no available instance. The Cloud Run service might have reached its maximum container instance limit or the service was otherwise not able to scale to incoming requests. This might be caused by a sudden increase in traffic, a long container startup time or a long request processing time."
Cloud Run 오류 메시지 및 오류 해결 방법 설명
"Cloud Run 서비스를 배포할 때 다음 오류 메시지를 어떻게 해결해야 해?"
HTTP 404: Not found
오류의 일반적인 원인과 오류를 해결하는 방법
"Cloud Run 서비스가 계속 비정상 종료되고 있어. 문제의 원인이 뭐야?"
원인 조사 접근 방식 및 문제 해결 방법
"로그에 표시된 5XX 오류가 Google 인프라 서비스 중단으로 인한 것인지 확인하려면 어떻게 해야 해?"
5XX 오류의 원인을 확인하는 단계
"com.google.apps.framework.request.BadRequestException Project PROJECT has serving status SYSTEM_DISABLED and cannot be modified 오류의 원인을 어떻게 파악해?"
Google Cloud 프로젝트가 시스템 수준에서 관리적으로 중지된 것으로 보입니다. 원인을 추가로 조사하는 단계를 제공합니다.
"ingress=internal을 설정했는데 브라우저에서 Cloud Run 서비스에 액세스할 수 있는 이유가 뭐야?"
ingress 설정을 internal로 구성한 경우 예상되는 동작에 대한 설명. 브라우저에서 액세스가 작동하는 것처럼 보이는 다른 시나리오도 포함됩니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-15(UTC)"],[],[],null,["# Introduction to Cloud Run troubleshooting\n\nThis page describes the common troubleshooting strategies for Cloud Run\nerrors. [Personalized Service Health](/service-health/docs/overview) publishes\nall Cloud Run incidents that stem from the\nunderlying Google Cloud infrastructure to identify Google Cloud service disruptions\nimpacting your projects. You should also consider [setting up alerts on Personalized Service Health events](/service-health/docs/configure-alerts-dashboard). For information\nabout incidents affecting all Google Cloud services, see the [Google Cloud Service Health](https://status.cloud.google.com/summary) dashboard.\n\nSee the following sections in the [Cloud Run troubleshooting guide](/run/docs/troubleshooting) for resolving issues related to your Cloud Run resource:\n\n- [Deployment errors](/run/docs/troubleshooting#deployment)\n- [Serving errors](/run/docs/troubleshooting#serving)\n- [Connectivity and security errors](/run/docs/troubleshooting#connectivity)\n\nCloud Run troubleshooting strategies\n------------------------------------\n\nThe following sections explain how you can apply general troubleshooting\nstrategies to resolve your error. If you continue to encounter errors even after\nfollowing the steps in the [troubleshooting](/run/docs/troubleshooting) guide,\nsee [What's next](#next-steps).\n\n### Output good logs using Cloud Logging\n\nTroubleshooting your Cloud Run resource is easier if you have good logs for debugging. You should write logs in a way that\n[correlates your container logs with a request log](/run/docs/logging#correlate-logs).\n\nWith correlated logs, you can identify the request that needs further analysis,\nfind the request trace, and analyze the root cause of the issue. For more\ninformation on writing logs, see [Write container logs](/run/docs/logging#container-logs).\n\n### Investigate instances using the Logs Explorer\n\nEach request log in Cloud Run contains an [`instanceId`](/run/docs/logging#service-fields) field that identifies an instance that handles your\nrequest. Depending on the [concurrency value](/run/docs/about-concurrency) you\nspecify, a single instance can handle multiple requests at the same time.\n\nWhen you have multiple instances emitting logs at once, you should filter your\ninstances to identify the sequential requests that lead up to an instance crash.\n\nFiltering an instance lets you debug specific performance issues related\nto cold starts or increased latencies. These issues could also be bound to\nvariables declared in a global scope, when the value is reused in subsequent\nconcurrent requests. An example of this is when you create a single connection\npool global object for the instance, and then use it within multiple requests.\n\nTo filter a specific instance in the Logs Explorer, follow these steps:\n\n1. In the Google Cloud console, go to the Logs Explorer page:\n\n [Go to Logs Explorer](https://console.cloud.google.com/logs/query)\n2. Select an existing Google Cloud project at the top of the page, or create a\n new project.\n\n3. Select the resource **Cloud Run Revision** for a service, or\n **Cloud Run Job** for a job.\n\n4. Expand a log entry to filter by a specific instance.\n\n5. Click the instance ID value, and select **Show matching entries**.\n\nWhile you investigate instances, you can [use Gemini Cloud Assist Investigations](#use-investigations) to gain additional insights into your logs.\nFor more information about different ways to initiate an\ninvestigation by using the Logs Explorer, see\n[Troubleshoot issues with Gemini Cloud Assist Investigations](/gemini/docs/cloud-assist/investigations#entry-points) in the Gemini documentation.\n\n### Resolve unexpected request latencies\n\nIf you encounter issues with latency, do the following:\n\n1. Check if the latency is affecting all requests to your Cloud Run\n resource or only a small percentage. Cloud Run is automatically integrated with Cloud Monitoring **with no setup or configuration required.**\n\n To see individual request latency metrics, follow these steps:\n 1. In the Google Cloud console, go to the Cloud Run page:\n\n [Go to Cloud Run](https://console.cloud.google.com/run)\n 2. Select the service or jobs from the list.\n\n 3. Click the **METRICS** tab to show the **Request latencies** dashboard.\n\n To [view latency metrics in Cloud Monitoring](/run/docs/monitoring#view-metrics-cloud-monitoring), select from the **Metrics** list,\n **Cloud Run Revision \\\u003e Request_latencies \\\u003e Request latency**.\n\n For a list of all available Cloud Run metrics and more in-depth\n details, see [Google Cloud metrics](/monitoring/api/metrics_gcp_p_z#gcp-run) in Cloud Monitoring.\n2. Identify the request with high latency to understand the source of latency.\n You can use Cloud Trace or Cloud Logging to understand how long a\n particular request has taken.\n\n To identify requests with high latency using Cloud Logging, apply the `traceSampled=true` filter to correlate logs in Cloud Logging with traces\n in Cloud Trace. For more information, see [Integrate with Cloud Logging](/trace/docs/trace-log-integration).\n\n Sometimes dependencies such as requests to other services might cause latency\n issues. To identify such requests, you should have explicit logging targeting\n the requests. If you don't output such logs, it could appear as a latency\n issue originating from a Cloud Run service.\n\n Additionally, you should consider evaluating latency spikes in the context of\n the chosen time window. A spike's significance is relative; a large spike\n in a small window might be negligible in a larger window, and vice-versa.\n Therefore, the time window significantly impacts the interpretation of\n latency data.\n3. Try increasing the number of [minimum instances](/run/docs/configuring/min-instances#setting-service-level) to reduce latency for incoming requests,\n and avoid cold starts. You should also consider modifying your source code,\n and [adjust the scaling settings](/run/docs/configuring/max-instances) to\n limit the number of connections to a backing service.\n\n For more information, see [Optimizing performance](/run/docs/tips/general#optimize_performance).\n\n### Troubleshoot with Gemini assistance\n\n\u003cbr /\u003e\n\n|\n| **Preview**\n|\n|\n| This product or feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA products and features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nYou can use [Gemini Cloud Assist](/gemini/docs/cloud-assist/overview)\nchat to analyze logs and troubleshoot errors. With Gemini assistance, you\ncan quickly pinpoint and resolve errors by leveraging the tool's log analysis\ncapabilities, saving valuable time and effort.\n\nTo use Gemini Cloud Assist from the Google Cloud console, do\nthe following:\n\n1. [Ensure that Gemini Cloud Assist is set up for your Google Cloud user account and project](/gemini/docs/cloud-assist/set-up-gemini).\n\n2. [Set up your Cloud Run development environment](/run/docs/setup)\n in your Google Cloud project and ensure you have the appropriate\n [deployment permissions](/run/docs/reference/iam/roles#additional-configuration).\n\n3. Go to the Cloud Run page in the Google Cloud console.\n\n [Go to Cloud Run](https://console.cloud.google.com/run)\n4. In the console toolbar, select a Google Cloud project. Use a project\n associated with a project ID you submitted after you were granted access to\n Gemini Cloud Assist.\n\n5. Click spark\n **Open or close Gemini AI chat**.\n\n The Gemini panel opens.\n6. If necessary, click **Accept** if you agree to the terms.\n\n7. If you have a question about a specific application, provide context by\n going to the page that shows your resource before asking your question. When\n generating a response, Gemini includes information about the\n current console page and project.\n\n8. Enter a prompt in the **Gemini** panel.\n\n The following table provide some example prompts for using\n Gemini Cloud Assist with Cloud Run.\n\nFor more details, see the following resources:\n\n- Learn how to [write better prompts](/gemini/docs/discover/write-prompts).\n- Learn how to use the [Gemini Cloud Assist panel](/gemini/docs/cloud-assist-panel).\n- Read [Use Gemini for AI assistance and development](/gemini/docs/overview).\n- Learn [how Gemini for Google Cloud uses your data](/gemini/docs/discover/data-governance).\n\n### Use Gemini Cloud Assist Investigations\n\nIn addition to interactive chat, Gemini Cloud Assist can perform more\nautomated, in-depth analysis through Gemini Cloud Assist\nInvestigations. This feature is integrated directly into workflows like\nLogs Explorer, and is a powerful root-cause analysis tool.\n\nWhen you initiate an investigation from an error or a specific resource,\nGemini Cloud Assist analyzes logs, configurations, and metrics.\nIt uses this data to produce ranked observations and hypotheses about probable\nroot causes, and then provides you with recommended next steps. You can also\ntransfer these results to a Google Cloud support case to provide valuable\ncontext that can help you resolve your issue faster.\n\nFor more information about different ways to initiate an\ninvestigation, see\n[Troubleshoot issues with Gemini Cloud Assist Investigations](/gemini/docs/cloud-assist/investigations#entry-points) in the Gemini documentation.\n\n### What's next\n\nIf you can't find a solution to your problem in the Cloud Run\ndocumentation, follow these steps:\n\n- Open a support case by contacting [Cloud Customer Care](/support-hub).\n- Get support from the community by [asking questions on StackOverflow](https://stackoverflow.com/questions/tagged/google-cloud-run), or search for similar issues using the `google-cloud-run` tag.\n- Open bugs or feature requests by using the [public issue tracker](/support/docs/issue-trackers)."]]