Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1517635 - Getting 'can't modify frozen String' error when publishing a content view that has lock conflict.
Summary: Getting 'can't modify frozen String' error when publishing a content view tha...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Tasks Plugin
Version: 6.2.12
Hardware: Unspecified
OS: Unspecified
unspecified
medium vote
Target Milestone: Unspecified
Assignee: Adam Ruzicka
QA Contact: Renzo Nuccitelli
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-11-27 06:52 UTC by Hao Chang Yu
Modified: 2019-04-01 20:27 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-02-21 16:54:37 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Foreman Issue Tracker 21770 None None None 2017-11-27 07:33:51 UTC

Description Hao Chang Yu 2017-11-27 06:52:02 UTC
Description of problem:
Getting the following error when publishing a content view that has lock conflict.

2017-11-01 00:15:49 [app] [I] Started POST "/katello/api/content_views/7/publish" for 10.240.44.251 at 2017-11-01 00:15:49 +0900
2017-11-01 00:15:49 [app] [I] Processing by Katello::Api::V2::ContentViewsController#publish as JSON
2017-11-01 00:15:49 [app] [I]   Parameters: {"api_version"=>"v2", "id"=>"7", "content_view"=>{}}
2017-11-01 00:15:49 [app] [I] Authorized user admin(Admin User)
2017-11-01 00:15:50 [foreman-tasks/action] [E] can't modify frozen String (RuntimeError)
 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.7.14.7/app/models/foreman_tasks/lock.rb:17:in `initialize'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.7.14.7/app/models/foreman_tasks/lock.rb:49:in `new'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.7.14.7/app/models/foreman_tasks/lock.rb:49:in `block in <class:Lock>'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:438:in `instance_exec'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:438:in `block in make_lambda'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:184:in `call'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:184:in `block in simple'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:185:in `call'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:185:in `block in simple'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:86:in `call'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:86:in `run_callbacks'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activemodel-4.1.5/lib/active_model/validations.rb:377:in `run_validations!'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activemodel-4.1.5/lib/active_model/validations/callbacks.rb:111:in `block in run_validations!'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:113:in `call'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:113:in `call'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:166:in `block in halting'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:86:in `call'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:86:in `run_callbacks'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activemodel-4.1.5/lib/active_model/validations/callbacks.rb:111:in `run_validations!'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activemodel-4.1.5/lib/active_model/validations.rb:318:in `valid?'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/validations.rb:70:in `valid?'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/validations.rb:77:in `perform_validations'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/validations.rb:57:in `save!'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/attribute_methods/dirty.rb:29:in `save!'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/transactions.rb:273:in `block in save!'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/transactions.rb:329:in `block in with_transaction_returning_status'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/connection_adapters/abstract/database_statements.rb:199:in `transaction'


It appears that this issue only happen when for non-English users as the translated string becomes frozen (immutable) and caused the error.

Below is the prove:

Access 'foreman-rake console' and run:

# Default is English
I18n.locale
=> :en
msg = _("Required lock is already taken by other running tasks.")
=> "Required lock is already taken by other running tasks."

# Frozen return false for English
msg.frozen?
=> false

# Now change locale to Japanese
I18n.locale = :ja
=> :ja
msg = _("Required lock is already taken by other running tasks.")
=> "必要なロックはすでに他の実行中タスクにより取得されました"

# Frozen return true for Japanese
msg.frozen?
=> true

# Now change locale to Chinese
I18n.locale = 'zh-CN'
=> "zh-CN"
msg = _("Required lock is already taken by other running tasks.")
=> "所需锁定已被其他正在运行的任务使用。"

# Same issue as Japanese. It returns frozen string.
msg.frozen?
=> true
exit

Actual results:
Getting 'can't modify frozen String' error

Expected results:
The task should fail with "Required lock is already taken by other running tasks." message for specified language.

Comment 3 pm-sat@redhat.com 2017-11-30 13:14:55 UTC
Upstream bug assigned to aruzicka@redhat.com

Comment 4 pm-sat@redhat.com 2017-11-30 13:14:58 UTC
Upstream bug assigned to aruzicka@redhat.com

Comment 5 pm-sat@redhat.com 2017-12-19 19:15:07 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/21770 has been resolved.

Comment 6 Renzo Nuccitelli 2018-01-04 12:27:44 UTC
VERIFIED on Satellite 6.3. While running rake msg.frozen was false for all the cases.

Comment 7 pm-sat@redhat.com 2018-02-21 16:54:37 UTC
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA.
> > 
> > For information on the advisory, and where to find the updated files, follow the link below.
> > 
> > If the solution does not work for you, open a new bug report.
> > 
> > https://access.redhat.com/errata/RHSA-2018:0336


Note You need to log in before you can comment on or make changes to this bug.