Net::HTTPServerException: 413 "Request Entity Too Large"

Hi,

This appears to be related to a host (1 of a few) bound to
corporate AD where the ‘user’ resource is returning ~23MB
of data … when I try to set the local root account’s
password.

What are my options here? Any thoughts would be welcome.

The obvious workaround is to edit /etc/shadow directly
and not use the ‘user’ resource :expressionless:

[2013-03-18T11:35:34-04:00] INFO: *** Chef 11.4.0 ***

[2013-03-18T11:36:00-04:00] INFO: Processing user[root] action modify
(rcf-rootuser::default line 10)
[2013-03-18T11:36:09-04:00] ERROR: Running exception handlers
[2013-03-18T11:36:16-04:00] FATAL: Saving node information to
/var/chef/cache/failed-run-data.json
[2013-03-18T11:36:16-04:00] ERROR: Exception handlers complete
[2013-03-18T11:36:16-04:00] FATAL: Stacktrace dumped to
/var/chef/cache/chef-stacktrace.out
[2013-03-18T11:36:16-04:00] FATAL: Net::HTTPServerException: 413
"Request Entity Too Large"
[root@dev02 ~]# more /var/chef/cache/chef-stacktrace.out
Generated at 2013-03-18 11:36:16 -0400
Net::HTTPServerException: 413 “Request Entity Too Large”
/opt/chef/embedded/lib/ruby/1.9.1/net/http.rb:2632:in error!' /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/rest.rb:199:inblock in raw_http_request’
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/rest.rb:280:in
retriable_rest_request' /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/rest.rb:164:inraw_http_request’
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/rest.rb:158:in
api_request' /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/rest.rb:125:input’
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/node.rb:489:in
save' /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/client.rb:236:insave_updated_node’
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/client.rb:471:in
do_run' /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/client.rb:200:inrun’
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/application.rb:190:in
run_chef_client' /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/application/client.rb:297:inblock in run_ap
plication’
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/application/client.rb:290:in
loop' /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/application/client.rb:290:inrun_application

/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/application.rb:73:in
run' /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/bin/chef-client:26:in<top (required)>’
/usr/bin/chef-client:23:in load' /usr/bin/chef-client:23:in'
[root@dev02 ~]#

Shooting from the hip here. Try disabling the Ohai passwd plugin via role,
or whatever your choice is, see if that alleviates it. Something like this

"ohai": {
  "disabled_plugins": ["passwd"]
}

On Mon, Mar 18, 2013 at 11:47 AM, Jeff Blaine jblaine@kickflop.net wrote:

Hi,

This appears to be related to a host (1 of a few) bound to
corporate AD where the 'user' resource is returning ~23MB
of data ... when I try to set the local root account's
password.

What are my options here? Any thoughts would be welcome.

The obvious workaround is to edit /etc/shadow directly
and not use the 'user' resource :expressionless:

[2013-03-18T11:35:34-04:00] INFO: *** Chef 11.4.0 ***
...
[2013-03-18T11:36:00-04:00] INFO: Processing user[root] action modify
(rcf-rootuser::default line 10)
[2013-03-18T11:36:09-04:00] ERROR: Running exception handlers
[2013-03-18T11:36:16-04:00] FATAL: Saving node information to
/var/chef/cache/failed-run-**data.json
[2013-03-18T11:36:16-04:00] ERROR: Exception handlers complete
[2013-03-18T11:36:16-04:00] FATAL: Stacktrace dumped to
/var/chef/cache/chef-**stacktrace.out
[2013-03-18T11:36:16-04:00] FATAL: Net::HTTPServerException: 413 "Request
Entity Too Large"
[root@dev02 ~]# more /var/chef/cache/chef-**stacktrace.out
Generated at 2013-03-18 11:36:16 -0400
Net::HTTPServerException: 413 "Request Entity Too Large"
/opt/chef/embedded/lib/ruby/1.**9.1/net/http.rb:2632:in error!' /opt/chef/embedded/lib/ruby/**gems/1.9.1/gems/chef-11.4.0/**lib/chef/rest.rb:199:in block in raw_http_request'
/opt/chef/embedded/lib/ruby/**gems/1.9.1/gems/chef-11.4.0/**lib/chef/rest.rb:280:in
retriable_rest_request' /opt/chef/embedded/lib/ruby/**gems/1.9.1/gems/chef-11.4.0/**lib/chef/rest.rb:164:in raw_http_request'
/opt/chef/embedded/lib/ruby/**gems/1.9.1/gems/chef-11.4.0/**lib/chef/rest.rb:158:in
api_request' /opt/chef/embedded/lib/ruby/**gems/1.9.1/gems/chef-11.4.0/**lib/chef/rest.rb:125:in put'
/opt/chef/embedded/lib/ruby/**gems/1.9.1/gems/chef-11.4.0/**lib/chef/node.rb:489:in
save' /opt/chef/embedded/lib/ruby/**gems/1.9.1/gems/chef-11.4.0/**lib/chef/client.rb:236:in save_updated_node'
/opt/chef/embedded/lib/ruby/**gems/1.9.1/gems/chef-11.4.0/**lib/chef/client.rb:471:in
do_run' /opt/chef/embedded/lib/ruby/**gems/1.9.1/gems/chef-11.4.0/**lib/chef/client.rb:200:in run'
/opt/chef/embedded/lib/ruby/**gems/1.9.1/gems/chef-11.4.0/**lib/chef/application.rb:190:in
run_chef_client' /opt/chef/embedded/lib/ruby/**gems/1.9.1/gems/chef-11.4.0/** lib/chef/application/client.**rb:297:in block in run_ap
plication'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/
lib/chef/application/client.**rb:290:in loop' /opt/chef/embedded/lib/ruby/**gems/1.9.1/gems/chef-11.4.0/** lib/chef/application/client.**rb:290:in run_application
'
/opt/chef/embedded/lib/ruby/**gems/1.9.1/gems/chef-11.4.0/**lib/chef/application.rb:73:in
run' /opt/chef/embedded/lib/ruby/**gems/1.9.1/gems/chef-11.4.0/**bin/chef-client:26:in <top (required)>'
/usr/bin/chef-client:23:in load' /usr/bin/chef-client:23:in '
[root@dev02 ~]#

--
Elvin Abordo
Mobile: (845) 475-8744

On 3/18/2013 11:51 AM, Elvin Abordo wrote:

Shooting from the hip here. Try disabling the Ohai passwd plugin via
role, or whatever your choice is, see if that alleviates it. Something
like this

 "ohai": {
   "disabled_plugins": ["passwd"]
 }

Thanks. That worked.

Aside: I went to update the community wiki page on this (which only
mentions doing it through client.rb), but I couldn't make any sense
of the new wiki after 10 minutes, so bailed.

On 3/18/2013 6:08 PM, Jeff Blaine wrote:

On 3/18/2013 11:51 AM, Elvin Abordo wrote:

Shooting from the hip here. Try disabling the Ohai passwd plugin via
role, or whatever your choice is, see if that alleviates it. Something
like this

 "ohai": {
   "disabled_plugins": ["passwd"]
 }

Thanks. That worked.

I take that back (O_o at self). This appeared to work yesterday
in my apparently crappy testing, but I am seeing this morning that
it doesn't.

chef-client does not talk to the server to build the node's
object until after Ohai runs, so will not see the attribute
in a timely manner.

The solution in the wiki, modifying /etc/chef/client.rb, works.

I do appreciate the original reply though, from the hip and all :slight_smile:

I'm going to open a ticket about this default Ohai behavior.
IMO, it's bad. It may stem from the fact that the Ohai passwd
plugin uses the Ruby stdlib 'Etc' module which states that it
only references /etc/passwd and /etc/group, but in fact was
clearly written by someone who does not understand what they're
doing, as it calls getpwent() and friends which will, of course,
enumerate everything defined in the NSS source list (like LDAP).

This error is still around in 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