[hotfix] make previousCpuTicks and previousProcCpuTicks volatile to increase visibility for all threads
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
previousCpuTicksandpreviousProcCpuTicksas 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
CI report:
- 529badb7740a3165f7e1648df67e97d292f9ea91 Azure: FAILURE
Bot commands
The @flinkbot bot supports the following commands:@flinkbot run azurere-run the last Azure build
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.
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.