Skip to content
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

Remove the unsafe cattr_accessor for my_guid_cache #19744

Merged
merged 1 commit into from
Jan 22, 2020

Conversation

carbonin
Copy link
Member

The guid class variable is now wrapped in a mutex, all the methods
for accessing the protected data should be wrapped in the same mutex.

The guid class variable is now wrapped in a mutex, all the methods
for accessing the protected data should be wrapped in the same mutex.
@carbonin
Copy link
Member Author

Extracted this from #19734

@miq-bot
Copy link
Member

miq-bot commented Jan 22, 2020

Checked commit carbonin@ea2b71a with ruby 2.5.5, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0
2 files checked, 3 offenses detected

app/models/miq_server.rb

@carbonin
Copy link
Member Author

Applies to ManageIQ/manageiq-pods#353

@@ -19,7 +19,7 @@
let(:guid_file) { Rails.root.join("GUID") }

it "should return the GUID from the file" do
MiqServer.my_guid_cache = nil
MiqServer.my_guid = nil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be clear, for future me, the unsafe access, before this change, was that we synchronize around the reads of this value but don't synchronize the writes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well if you use the cattr_accessor it wasn't synchronized at all.

@jrafanie jrafanie merged commit 9a80565 into ManageIQ:master Jan 22, 2020
@jrafanie jrafanie added this to the Sprint 129 Ending Feb 3, 2020 milestone Jan 22, 2020
@carbonin carbonin deleted the remove_server_guid_accessor branch January 22, 2020 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants