Skip to content

Java11: v3 - Static variable appears to be in different instance even though it's in the same class. #465

@shreyas-gopalakrishna

Description

@shreyas-gopalakrishna

Investigative information

Using a static variable in java 11 appears to be treated as different instance even though it exists in the same class.
The issue is similar to #412 which will be fixed in v3 with an application setting.

Repro steps

Use a static variable in a Java function and update it from multiple objects.

Expected behavior

The variable must be static across all objects.

Actual behavior

The variable appears to be in different instance and updated individually in every instance.

Related information

This issue will be fixed in v3 provided FUNCTIONS_WORKER_JAVA_V3_SINGLE_CLASSLOADER application setting/environment variable is set to true. If the variable is set to false or if left unset, the original behavior is retained.

This issue will be a break change in v4 with no application setting/environment variable need and updates on it can be found at Azure/Azure-Functions#1997

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions