Skip to content

[BUG] azure-core native-image metadata initializes SLF4J fallback provider with Spring Boot 4.1 / GraalVM 25 #49844

Description

@JFCote

Bug description

Building a Spring Boot application as a GraalVM Native Image fails when azure-core is on the runtime classpath. The failure reproduces after removing Azure Monitor/OpenTelemetry entirely; the application still uses Azure Blob Storage, Azure Identity, and Azure Communication Email.

azure-core's META-INF/native-image/com.azure/azure-core/native-image.properties forces org.slf4j.LoggerFactory and com.azure.core.util.logging.ClientLogger to initialize at build time. During native-image analysis, a static initializer such as com.azure.core.util.ExpandableStringEnum.<clinit> creates a ClientLogger. SLF4J then has SubstituteServiceProvider and NOP_FallbackServiceProvider objects in the image heap, but those types are configured for runtime initialization.

Versions

  • Spring Boot: 4.1.0
  • Java: 25
  • GraalVM Native Image:
    • Oracle GraalVM 25.0.3+9.1 in GitHub Actions
    • GraalVM Community 25.0.2+10.1 locally (same failure)
  • azure-core: 1.58.1
  • Azure SDKs on the classpath:
    • azure-storage-blob 12.35.0
    • azure-identity 1.18.4
    • azure-communication-email 1.1.4

Reproduction

  1. Create a Spring Boot 4.1 application with the Azure SDK dependencies above.
  2. Apply org.graalvm.buildtools.native.
  3. Run ./gradlew nativeCompile with GraalVM 25.

The failure is reproducible both locally in a Linux Docker build and in GitHub Actions.

Actual result

Native image analysis fails:

Fatal error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException:
An object of type 'org.slf4j.helpers.SubstituteServiceProvider' was found in the image heap.
This type, however, is marked for initialization at image run time.

Object was reached by
  org.slf4j.LoggerFactory.getProvider(...)
  org.slf4j.LoggerFactory.getLogger(...)
  com.azure.core.util.logging.ClientLogger.getLogger(...)
  com.azure.core.util.logging.ClientLogger.<init>(...)
  com.azure.core.util.ExpandableStringEnum.<clinit>(...)

The same build also reports org.slf4j.helpers.NOP_FallbackServiceProvider.

Expected result

azure-core should support native-image builds with current Spring Boot / SLF4J 2 / GraalVM 25, or its native-image metadata should avoid forcing SLF4J initialization in a way that creates a fallback provider in the image heap.

Notes

  • Explicitly setting --initialize-at-run-time=org.slf4j.LoggerFactory conflicts with the build-time rule from azure-core's native-image.properties.
  • Forcing the fallback providers to build time may allow the build to progress, but appears unsafe because it can freeze SLF4J's NOP fallback into the executable.
  • We would appreciate recommended GraalVM arguments or an updated native-image metadata configuration.

Metadata

Metadata

Assignees

Labels

Azure.Coreazure-coreClientThis issue points to a problem in the data-plane of the library.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions