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

fix(storage): avoid segmentation fault when generating actions #1419

Merged
merged 2 commits into from
Jul 1, 2024

Conversation

joseivanlopez
Copy link
Contributor

@joseivanlopez joseivanlopez commented Jul 1, 2024

Problem

The generation of the storage actions was fixed to avoid a segmentation fault while accessing to the CompoundAction objects, see #1410. But there is still a chance to reference to an actiongraph removed by the ruby GC.

target_graph.actiongraph.compound_actions.map do |action|
  GC.start
  Action.new(a)
end

The actiongraph object could be dropped by the garbage collector while iterating the list of compound actions.

Solution

Keep a reference to the actiongraph, ensuring the actiongraph object is not removed while generating the list of actions.

Note: once the list of actions is generated, the actiongraph is not needed anymore because the Action objects do not keep a reference to the source compound action, see #1410.

@coveralls
Copy link

Coverage Status

coverage: 71.406%. remained the same
when pulling 5a0ebfb on fix-actions-generator
into 55b6728 on master.

@joseivanlopez joseivanlopez marked this pull request as ready for review July 1, 2024 10:48
@coveralls
Copy link

Coverage Status

coverage: 71.406%. remained the same
when pulling 5a0ebfb on fix-actions-generator
into 55b6728 on master.

Copy link
Contributor

@ancorgs ancorgs left a comment

Choose a reason for hiding this comment

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

LGTM

@joseivanlopez joseivanlopez merged commit 680058b into master Jul 1, 2024
3 checks passed
@joseivanlopez joseivanlopez deleted the fix-actions-generator branch July 1, 2024 11:04
@imobachgs imobachgs mentioned this pull request Sep 20, 2024
imobachgs added a commit that referenced this pull request Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants