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

ERROR: can't modify frozen Chef::Node::ImmutableMash #14

Open
wbotelhos opened this issue Feb 16, 2018 · 4 comments
Open

ERROR: can't modify frozen Chef::Node::ImmutableMash #14

wbotelhos opened this issue Feb 16, 2018 · 4 comments

Comments

@wbotelhos
Copy link
Contributor

Hi,

After some period where I did not update my server code, i'm facing the following error:

* apt_package[nodejs] action install (up to date)
Recipe: unicorn-ng::default
* unicorn_ng_config[default] action create[2018-02-16T05:37:21+00:00] WARN: only_if block for unicorn_ng_config[default] returned "/var/www/app/shared/config/unicorn.rb", did you mean to run a command? If so use 'only_if "/var/www/app/shared/config/unicorn.rb"' in your code.


Running handlers:
[2018-02-16T05:37:21+00:00] ERROR: Running exception handlers
Running handlers complete
[2018-02-16T05:37:21+00:00] ERROR: Exception handlers complete
Chef Client failed. 14 resources updated in 13 seconds
[2018-02-16T05:37:21+00:00] FATAL: Stacktrace dumped to /home/ubuntu/chef-solo/local-mode-cache/cache/chef-stacktrace.out
[2018-02-16T05:37:21+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2018-02-16T05:37:21+00:00] ERROR: can't modify frozen Chef::Node::ImmutableMash
[2018-02-16T05:37:21+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
ERROR: RuntimeError: chef-solo failed. See output above.

The log is:

root@ip-10-0-1-249:~# cat /home/ubuntu/chef-solo/local-mode-cache/cache/chef-stacktrace.out
Generated at 2018-02-16 05:37:21 +0000
RuntimeError: can't modify frozen Chef::Node::ImmutableMash
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/node/immutable_collections.rb:300:in `ensure_generated_cache!'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/node/immutable_collections.rb:236:in `block (2 levels) in <class:ImmutableMash>'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/resource.rb:668:in `value_to_text'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/resource.rb:645:in `block in to_text'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/resource.rb:643:in `map'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/resource.rb:643:in `to_text'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb:46:in `add_explanation'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/formatters/error_mapper.rb:72:in `resource_failed'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/formatters/base.rb:139:in `resource_failed'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/formatters/doc.rb:313:in `resource_failed'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/event_dispatch/dispatcher.rb:43:in `call'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/event_dispatch/dispatcher.rb:43:in `block in call_subscribers'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/event_dispatch/dispatcher.rb:34:in `each'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/event_dispatch/dispatcher.rb:34:in `call_subscribers'
(eval):2:in `resource_failed'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/resource.rb:603:in `rescue in run_action'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/resource.rb:589:in `run_action'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/runner.rb:70:in `run_action'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/runner.rb:98:in `block (2 levels) in converge'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/runner.rb:98:in `each'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/runner.rb:98:in `block in converge'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/resource_collection/resource_list.rb:94:in `block in execute_each_resource'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/resource_collection/stepable_iterator.rb:114:in `call_iterator_block'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/resource_collection/stepable_iterator.rb:103:in `iterate'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/resource_collection/resource_list.rb:92:in `execute_each_resource'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/runner.rb:97:in `converge'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/client.rb:718:in `block in converge'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/client.rb:713:in `catch'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/client.rb:713:in `converge'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/client.rb:752:in `converge_and_save'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/client.rb:286:in `run'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/application.rb:292:in `block in fork_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/application.rb:280:in `fork'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/application.rb:280:in `fork_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/application.rb:245:in `block in run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/local_mode.rb:44:in `with_server_connectivity'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/application.rb:233:in `run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/application/client.rb:469:in `sleep_then_run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/application/client.rb:458:in `block in interval_run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/application/client.rb:457:in `loop'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/application/client.rb:457:in `interval_run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/application/client.rb:441:in `run_application'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/application.rb:59:in `run'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/application/solo.rb:225:in `run'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/bin/chef-solo:25:in `<top (required)>'
/usr/bin/chef-solo:59:in `load'
/usr/bin/chef-solo:59:in `<main>'

>>>> Caused by RuntimeError: can't modify frozen Chef::Node::ImmutableMash
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/node/immutable_collections.rb:300:in `ensure_generated_cache!'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/node/immutable_collections.rb:236:in `block (2 levels) in <class:ImmutableMash>'
/home/ubuntu/chef-solo/local-mode-cache/cache/cookbooks/unicorn-ng/providers/config.rb:30:in `block (2 levels) in class_from_file'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/resource_builder.rb:66:in `instance_eval'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/resource_builder.rb:66:in `build'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/dsl/declare_resource.rb:293:in `build_resource'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/dsl/declare_resource.rb:250:in `declare_resource'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/dsl/resources.rb:38:in `template'
/home/ubuntu/chef-solo/local-mode-cache/cache/cookbooks/unicorn-ng/providers/config.rb:23:in `block in class_from_file'
(eval):2:in `block in action_create'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/provider.rb:211:in `instance_eval'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/provider.rb:211:in `compile_and_converge_action'
(eval):2:in `action_create'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/provider.rb:171:in `run_action'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/resource.rb:591:in `run_action'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/runner.rb:70:in `run_action'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/runner.rb:98:in `block (2 levels) in converge'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/runner.rb:98:in `each'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/runner.rb:98:in `block in converge'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/resource_collection/resource_list.rb:94:in `block in execute_each_resource'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/resource_collection/stepable_iterator.rb:114:in `call_iterator_block'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/resource_collection/stepable_iterator.rb:103:in `iterate'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/resource_collection/resource_list.rb:92:in `execute_each_resource'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/runner.rb:97:in `converge'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/client.rb:718:in `block in converge'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/client.rb:713:in `catch'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/client.rb:713:in `converge'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/client.rb:752:in `converge_and_save'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/client.rb:286:in `run'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/application.rb:292:in `block in fork_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/application.rb:280:in `fork'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/application.rb:280:in `fork_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/application.rb:245:in `block in run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/local_mode.rb:44:in `with_server_connectivity'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/application.rb:233:in `run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/application/client.rb:469:in `sleep_then_run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/application/client.rb:458:in `block in interval_run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/application/client.rb:457:in `loop'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/application/client.rb:457:in `interval_run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/application/client.rb:441:in `run_application'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/application.rb:59:in `run'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/lib/chef/application/solo.rb:225:in `run'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.7.16/bin/chef-solo:25:in `<top (required)>'
/usr/bin/chef-solo:59:in `load'
/usr/bin/chef-solo:59:in `<main>'root@ip-10-0-1-249:~# 
$ chef-solo -v
Chef: 13.7.16
unicorn-ng (2.0.1)

Any idea? Thanks. :)

@chr4
Copy link
Member

chr4 commented Feb 16, 2018

The cookbook is currently not compatible with Chef 13.

Chef 13 doesn't allow the way I'm inferring defaults for resources from attributes - which is the only reliable way I found to make a cookbook compatible for use with node attributes as well as wrapper-cookbooks (using providers).

To upgrade this, it's probably necessary to drop attribute support completely (potentially breaking some setups) or rewriting the resource defaults using if statements and .dup.

Suggestions welcome!

@wbotelhos
Copy link
Contributor Author

Thanks to anwer @chr4 .

I tried with:

$ chef-solo -v
Chef: 12.21.31

Same error:

[2018-02-17T02:14:00+00:00] ERROR: Running exception handlers
  Running handlers complete
[2018-02-17T02:14:00+00:00] ERROR: Exception handlers complete
  Chef Client failed. 14 resources updated in 13 seconds
[2018-02-17T02:14:00+00:00] FATAL: Stacktrace dumped to /home/ubuntu/chef-solo/local-mode-cache/cache/chef-stacktrace.out
[2018-02-17T02:14:00+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2018-02-17T02:14:00+00:00] ERROR: can't modify frozen Chef::Node::ImmutableMash
[2018-02-17T02:14:00+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
ERROR: RuntimeError: chef-solo failed. See output above.

Sorry about my question, but I'm not used to use the resources and providers files. The problem comes from this files? Could we drop this files? Maybe just the templates and service commands could be a recipe.

@chr4
Copy link
Member

chr4 commented Feb 17, 2018

This might also be because of chef-solo maybe?
I'm running this without problems with chef-12.19.36 - but this should obviously be ported to Chef-13 eventually. PR's welcome!

@wbotelhos
Copy link
Contributor Author

I use knife-solo and I'm not tested without it.
For now, just copy um template file and config is enough.
Maybe with more time I try to understand better this problem.

Thank you.

@wbotelhos wbotelhos reopened this Feb 19, 2018
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

No branches or pull requests

2 participants