flink icon indicating copy to clipboard operation
flink copied to clipboard

[hotfix] make previousCpuTicks and previousProcCpuTicks volatile to increase visibility for all threads

Open bjornarjatten opened this issue 9 months ago • 2 comments

What is the purpose of the change

This pull request fixes a visibility issue in the SystemResourcesCounter class by marking previousCpuTicks and previousProcCpuTicks as volatile.

Previously, these variables were not declared as volatile, meaning updates made by one thread might not be immediately visible to others. This could lead to stale values being read by different threads.

By making these variables volatile, we ensure that all threads see the most up-to-date values, preventing inconsistencies.

Brief change log

  • Marked previousCpuTicks and previousProcCpuTicks as volatile to ensure proper visibility across threads.

Verifying this change

This change is a trivial rework/code cleanup without any test coverage.

Does this pull request potentially affect one of the following parts?

  • Dependencies (does it add or upgrade a dependency)? No
  • The public API (i.e., is any changed class annotated with @Public(Evolving))? No
  • The serializers? Unsure
  • The runtime per-record code paths (performance sensitive)? Unsure
  • Anything that affects deployment or recovery (JobManager, Checkpointing, Kubernetes/Yarn, ZooKeeper)? Unsure
  • The S3 file system connector? Unsure

Documentation

  • Does this pull request introduce a new feature? No
  • If yes, how is the feature documented? Not applicable

bjornarjatten avatar Mar 05 '25 21:03 bjornarjatten

CI report:

  • 529badb7740a3165f7e1648df67e97d292f9ea91 Azure: FAILURE
Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

flinkbot avatar Mar 05 '25 22:03 flinkbot

This PR is being marked as stale since it has not had any activity in the last 90 days. If you would like to keep this PR alive, please leave a comment asking for a review. If the PR has merge conflicts, update it with the latest from the base branch.

If you are having difficulty finding a reviewer, please reach out to the community, contact details can be found here: https://flink.apache.org/what-is-flink/community/

If this PR is no longer valid or desired, please feel free to close it. If no activity occurs in the next 30 days, it will be automatically closed.

github-actions[bot] avatar Jun 19 '25 06:06 github-actions[bot]

This PR is being marked as stale since it has not had any activity in the last 90 days. If you would like to keep this PR alive, please leave a comment asking for a review. If the PR has merge conflicts, update it with the latest from the base branch.

If you are having difficulty finding a reviewer, please reach out to the community, contact details can be found here: https://flink.apache.org/what-is-flink/community/

If this PR is no longer valid or desired, please feel free to close it. If no activity occurs in the next 30 days, it will be automatically closed.

github-actions[bot] avatar Oct 23 '25 06:10 github-actions[bot]