Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
shreyas-gopalakrishna opened this issue Sep 28, 2021 · 0 comments · Fixed by #461
Assignees
Labels

Comments

@shreyas-gopalakrishna
Copy link
Member

shreyas-gopalakrishna commented Sep 28, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant