Skip to content

Commit

Permalink
fix(storage): avoid error in storage actions (hot-fix) (#1400)
Browse files Browse the repository at this point in the history
## Problem

Generating storage actions crashes, see:

* #1396
* #1379

## Solution

Avoid actiongraph clean-up by the ruby GC. 

Note: This is a hot-fix. A better solution is required.
  • Loading branch information
joseivanlopez authored Jun 27, 2024
2 parents 9e671e9 + 5e83aae commit f5e867a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
21 changes: 20 additions & 1 deletion service/lib/agama/storage/manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,26 @@ def actions

probed = Y2Storage::StorageManager.instance.probed
staging = Y2Storage::StorageManager.instance.staging
ActionsGenerator.new(probed, staging).generate
# FIXME: This is a hot-fix to avoid segmentation fault in the actions, see
# https://github.com/openSUSE/agama/issues/1396.
#
# Source of the problem:
# * An actiongraph is generated from the target devicegraph.
# * The list of compound actions is recovered from the actiongraph.
# * No refrence to the actiongraph is kept, so the object is a candidate to be cleaned by
# the ruby GC.
# * Accessing to the generated actions raises a segmentation fault if the actiongraph was
# cleaned.
#
# There was a previous attempt of fixing the issue by keeping a reference to the
# actiongraph in the ActionsGenerator object. But that solution is not enough because
# the ActionGenerator object is also cleaned up.
#
# As a hot-fix, the generator is kept in an instance variable to avoid the GC to kill it.
# A better solution is needed, for example, by avoiding to store an instance of a compound
# action in the Action object.
@generator = ActionsGenerator.new(probed, staging)
@generator.generate
end

# Changes the service's locale
Expand Down
6 changes: 6 additions & 0 deletions service/package/rubygem-agama-yast.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Jun 27 08:36:13 UTC 2024 - José Iván López González <[email protected]>

- Avoid error in storage actions (hot-fix)
(gh#openSUSE/agama#1400).

-------------------------------------------------------------------
Wed Jun 26 13:54:28 UTC 2024 - José Iván López González <[email protected]>

Expand Down

0 comments on commit f5e867a

Please sign in to comment.