2

I'm registering a node that search for other nodes attributes in the run list. The problem is when the node information is too big for put on the server via HTTP.

Then chef-client prints a 'FATAL: Net::HTTPServerException: 413 "Request Entity Too Large"' message.

The server is in Opscode Hosted Chef.

Anyone can help me with this issue?

Thanks!!

4 Answers4

1

This has to do with the http server's upload size limit. I've heard of people having issues with this before on Hosted Chef, and I myself have experienced it on OpenSource Chef. However on OpenSource Chef I had the power to do something to increase the limit.

Not that this will necessarily help you on Hosted Chef, but my nginx.conf needed me to add this line in the http section:

client_max_body_size 2M;

this then upped the limit after I reloaded nginx and fixed the problem for me.

(on Apache this would be the LimitRequestBody attribute, I believe, in the .htaccess or httpd.conf files)

As for your issue, the suggestions I've heard people try is to decrease the node information's size. That's not exactly easy in some situations, but supposedly some OHAI plugins can cause this to happen, and removing them can fix it.

I don't know if that will help you very much in your situation or not, but perhaps it'll help people using OpenSource Chef, who encounter this.

Best of luck!

CRThaze
  • 544
  • 3
  • 16
1

Changing nginx config did not work for me. However, I did find the following from the Chef community site IRC logs (courtesy of Joshua Timberman) and it worked for me (Chef v11.4.4):

 put this in /etc/chef/client.rb: Ohai::Config[:disabled_plugins] = ["passwd"]

Here is the link: http://community.opscode.com/chat/chef/2013-02-07

As this is client side it should work regardless of the chef server type you are using.

Note: I have not seen this in testing (chef v11.10.4) when working on the cookbook that generated the error. It is possible that this has been fixed in more recent versions of Chef.

Tensibai
  • 15,557
  • 1
  • 37
  • 57
  • should be "passwd" not "passed" – lamont Apr 24 '14 at 00:53
  • also for ohai v7 syntax: `Ohai::Config[:disabled_plugins] = [ :Passwd ]` – lamont Apr 24 '14 at 00:59
  • 1
    Also this addresses the common root cause of the problem which is that ohai uses ruby's Etc module to enumerate passwd entries which will walk your LDAP directory if you configure nss to use LDAP. It is possible that other plugins could generate enormous amounts of ohai node data, but the Passwd plugin is the typical offender. – lamont Apr 24 '14 at 01:03
1

I ran into this problem also. It seems that our clients were sending 1.17meg back to the chef server. These answers are good but they don't really say how to diagnose the issue as there are multiple reasons you can find yourself in this situation.

1) How much is my server sending back.

To find this information you need to run a chef run in debug mode. This gives you access to the HTTP messages being sent out from the client and the response messages. chef-client -r'recipe[run_awesome_resources]' --log_level debug

Handy tip the message can be searched for by using the search term http 1.1 413

2) Where the fluff do I put these settings?

The settings are placed in the chef configuration file. You touch this file so rarely that you are forgiven for forgetting its locations.

/etc/opscode/chef-server.rb

You will need to run a reconfigure command to get the chef server to take to setting. chef-server-ctl reconfigure

3) What setting must I change?

This link gives all the settings you can use.

https://docs.chef.io/config_rb_server_optional_settings.html

The one for this problem is: opscode_erchef['max_request_size']

Like so in the file

opscode_erchef['max_request_size'] = 3000000 # Yields 3megabit of head room.

Some of the answers state that you should remove some Ohia plugins. This works but is not the root of the problem. By removing the plugins you are in fact reducing the size of the request to the chef server. The result is that it works but, could mislead you to blame the plugin as the root cause of the problem.

1

Another update from 2019.

If running chef-client throws the error HTTPServerException: 413 "Request Entity Too Large" check that:

  • the option ohai.disabled_plugins = [:Passwd] lives on /etc/chef/client.rb on the server
  • the option ohai.disabled_plugins = [:Passwd] lives on /etc/chef/client.rb on the client(s) throwing the error
g0to
  • 13
  • 2