Unexpected CPU Spike After April 23 and “Invalid URI hostname could not be parsed” Error in Azure Container App(Function)(java)

AI 20 Reputation points
2026-06-02T03:54:24.0733333+00:00

Since April 23, our CPU usage suddenly increased by dozens of times. The average CPU went from around 0.05% to roughly 1%, and total CPU usage jumped from about 60% to 600%, where it has remained consistently high. Our application is written in Java 17 and deployed on Azure Container Apps (using the Azure Functions runtime / Java worker). No code changes or configuration modifications were made during this period.

On May 29, after investigation, we discovered that the AzureWebJobsStorage setting was configured to use local storage (e.g., UseDevelopmentStorage=true). This caused the background process to continuously poll the remote storage endpoint, leading to the CPU spike. After correcting AzureWebJobsStorage to point to a valid storage account, CPU usage dropped significantly but is still sitting at about twice the level it was before April 23.

Additionally, we are now encountering the same issue described here: Azure Container Apps - Invalid URI: hostname could not be parsed.

Could you please confirm whether there was a platform upgrade around April 23 that might have caused this behavior? Why did the AzureWebJobsStorage setting suddenly affect CPU usage. Also, when can we expect a fix for the “Invalid URI hostname could not be parsed” error, or what steps can we take to mitigate it in the meantime?

Azure Container Apps
Azure Container Apps

An Azure service that provides a general-purpose, serverless container platform.

0 comments No comments

Answer accepted by question author
Siddhesh Desai 8,210 Reputation points Microsoft External Staff Moderator
2026-06-02T08:36:30.88+00:00

Hi @AI

Thank you for reaching out to Microsoft Q&A.

Based on the details shared, the behavior you are observing is primarily due to a combination of configuration issues and a known platform/runtime behavior change that surfaced around April–May timeframe. Azure Functions (including when running on Azure Container Apps) has a strict dependency on the AzureWebJobsStorage setting for its internal operations such as trigger coordination, scaling, checkpointing, and host state management. When the setting is configured as UseDevelopmentStorage=true, this only works in local development environments where a storage emulator exists. In Azure, there is no emulator available, so the Functions host continuously attempts to reach a valid storage endpoint and retries in a loop, leading to excessive background processing and CPU usage spikes.

Although there was no officially documented platform upgrade specifically on April 23, multiple customer cases and observations indicate that runtime behavior (particularly around retry mechanisms and environment variable handling) became more aggressive or stricter during that timeframe. This made previously unnoticed misconfigurations (like invalid storage settings) start impacting CPU utilization significantly. Even after correcting the storage configuration, you are still seeing elevated CPU usage because of an additional issue involving the Functions runtime inside Azure Container Apps. Specifically, the error “Invalid URI: hostname could not be parsed” originates from the LinuxContainerMetricsPublisher component, which attempts to build a URI using the HOSTNAME environment variable. In some Container Apps environments, this variable is empty, leading to repeated exceptions every few seconds. These repeated failures contribute to continued CPU usage above baseline even though the primary storage issue is resolved. [learn.microsoft.com]

Refer below points to resolve this issue or this is the workaround:

Ensure correct AzureWebJobsStorage configuration

Make sure the application setting is pointing to a valid Azure Storage account (not local emulator). Example:

AzureWebJobsStorage = DefaultEndpointsProtocol=https;AccountName=<name>;AccountKey=<key>;EndpointSuffix=core.windows.net

OR (recommended using Managed Identity):

AzureWebJobsStorage__accountName = <storage-account-name>

This prevents continuous retry loops and eliminates the major cause of CPU spike.

Remove conflicting or deprecated storage-related settings

If you are using identity-based configuration, avoid mixing multiple settings such as:

  • AzureWebJobsStorage
  • AzureWebJobsStorage__blobServiceUri

Keep only the required configuration to avoid unexpected runtime behavior and failures observed in similar cases.

Do not override platform-managed environment variables

Avoid manually setting system variables like:

HOSTNAME

Overriding these can cause revision failures or unexpected runtime issues. The “Invalid URI hostname” issue is related to platform-level handling of this variable, not application logic. [learn.microsoft.com]

Treat “Invalid URI hostname could not be parsed” as a known runtime issue

  • This issue is currently a known behavior affecting Azure Functions on Container Apps
  • It originates from the metrics publisher component and does not typically impact function execution
  • At present, there is no confirmed public ETA for a fix, so it should be treated as a non-blocking platform issue

Reduce impact (temporary mitigation)

  • Lower logging verbosity to reduce excessive logging from repeated exceptions
  • Monitor Application Insights to confirm that function executions remain healthy
  • Ignore the error if functionality is not impacted (until platform fix is released)

Validate CPU baseline after fixes

After correcting storage config and stabilizing runtime:

  • CPU should drop significantly
  • Remaining ~2x usage is expected due to platform overhead + metrics-related retries
  • Continue monitoring to ensure no further abnormal spikes.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.