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

feat(storage): avoid reference to compound actions #1410

Merged
merged 2 commits into from
Jun 28, 2024

Conversation

joseivanlopez
Copy link
Contributor

@joseivanlopez joseivanlopez commented Jun 28, 2024

A hot-fix was implemeted by #1400 in order to avoid possible segmentation fault when generating the list of storage actions.

This PR provides a better solution. It avoids references to CompoundAction objects instead of keeping an unnecessary reference to the source Actiongraph object.

See #1396

@joseivanlopez joseivanlopez force-pushed the avoid-actiongraph-ref branch from 53acfcd to 0638ef9 Compare June 28, 2024 11:55
@joseivanlopez joseivanlopez marked this pull request as ready for review June 28, 2024 11:59
@coveralls
Copy link

Coverage Status

coverage: 71.406% (+0.006%) from 71.4%
when pulling 0638ef9 on avoid-actiongraph-ref
into fc04e35 on master.

@joseivanlopez joseivanlopez merged commit 5ca4494 into master Jun 28, 2024
3 checks passed
@joseivanlopez joseivanlopez deleted the avoid-actiongraph-ref branch June 28, 2024 12:06
@coveralls
Copy link

Coverage Status

coverage: 71.406% (+0.006%) from 71.4%
when pulling 591c536 on avoid-actiongraph-ref
into fc04e35 on master.

joseivanlopez added a commit that referenced this pull request 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.

~~~ruby
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.
@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.

3 participants