summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-01-27 07:38:02 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2016-01-27 07:38:02 -0800
commitdaee733688af24312438654dc15d067ad01b168e (patch)
tree2b114f4385fceff09cd97efb42aedde2a6aa2d09
parent58eff3ad063fb44f14d77239085a9be85325235f (diff)
parent9ee924785e46c7cddc9db13df5de3e10b1de53fa (diff)
downloadchef-daee733688af24312438654dc15d067ad01b168e.tar.gz
Merge pull request #4434 from chef/lcg/better-eof-errors
adds EOFError message to handlers
-rw-r--r--lib/chef/formatters/error_inspectors/api_error_formatting.rb38
-rw-r--r--lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb5
-rw-r--r--lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb4
-rw-r--r--lib/chef/formatters/error_inspectors/node_load_error_inspector.rb4
-rw-r--r--lib/chef/formatters/error_inspectors/registration_error_inspector.rb2
-rw-r--r--lib/chef/formatters/error_inspectors/run_list_expansion_error_inspector.rb5
-rw-r--r--spec/unit/formatters/base_spec.rb29
7 files changed, 77 insertions, 10 deletions
diff --git a/lib/chef/formatters/error_inspectors/api_error_formatting.rb b/lib/chef/formatters/error_inspectors/api_error_formatting.rb
index 5f2a912a01..a327089121 100644
--- a/lib/chef/formatters/error_inspectors/api_error_formatting.rb
+++ b/lib/chef/formatters/error_inspectors/api_error_formatting.rb
@@ -1,6 +1,6 @@
#--
# Author:: Daniel DeLeo (<dan@opscode.com>)
-# Copyright:: Copyright (c) 2012 Opscode, Inc.
+# Copyright:: Copyright (c) 2012-2016 Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -36,6 +36,42 @@ chef_server_url "#{server_url}"
E
end
+ def describe_eof_error(error_description)
+ error_description.section("Authentication Error:",<<-E)
+Received an EOF on transport socket. This almost always indicates a network
+error external to chef-client. Some causes include:
+
+ - Blocking ICMP Dest Unreachable (breaking Path MTU Discovery)
+ - IPsec or VPN tunnelling / TCP Encapsulation MTU issues
+ - Jumbo frames configured only on one side (breaking Path MTU)
+ - Jumbo frames configured on a LAN that does not support them
+ - Proxies or Load Balancers breaking large POSTs
+ - Broken TCP offload in network drivers/hardware
+
+Try sending large pings to the destination:
+
+ windows: ping server.example.com -f -l 9999
+ unix: ping server.example.com -s 9999
+
+Try sending large POSTs to the destination (any HTTP code returned is success):
+
+ e.g.: curl http://server.example.com/`printf '%*s' 9999 '' | tr ' ' 'a'`
+
+Try disabling TCP Offload Engines (TOE) in your ethernet drivers.
+
+ windows:
+ Disable-NetAdapterChecksumOffload * -TcpIPv4 -UdpIPv4 -IpIPv4 -NoRestart
+ Disable-NetAdapterLso * -IPv4 -NoRestart
+ Set-NetAdapterAdvancedProperty * -DisplayName "Large Receive Offload (IPv4)" -DisplayValue Disabled –NoRestart
+ Restart-NetAdapter *
+ unix(bash):
+ for i in rx tx sg tso ufo gso gro lro rxvlan txvlan rxhash; do /sbin/ethtool -K eth0 $i off; done
+
+In some cases the underlying virtualization layer (Xen, VMware, KVM, Hyper-V, etc) may have
+broken virtual networking code.
+ E
+ end
+
def describe_401_error(error_description)
if clock_skew?
error_description.section("Authentication Error:",<<-E)
diff --git a/lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb b/lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb
index a1f2c8ce37..b5b31454be 100644
--- a/lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb
+++ b/lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb
@@ -1,6 +1,6 @@
#--
# Author:: Daniel DeLeo (<dan@opscode.com>)
-# Copyright:: Copyright (c) 2012 Opscode, Inc.
+# Copyright:: Copyright (c) 2012-2016 Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -39,6 +39,8 @@ class Chef
humanize_http_exception(error_description)
when *NETWORK_ERROR_CLASSES
describe_network_errors(error_description)
+ when EOFError
+ describe_eof_error(error_description)
else
error_description.section("Unexpected Error:","#{exception.class.name}: #{exception.message}")
end
@@ -165,4 +167,3 @@ EOM
end
end
end
-
diff --git a/lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb b/lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb
index 30811a6d24..5e4fc0fff1 100644
--- a/lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb
+++ b/lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb
@@ -1,6 +1,6 @@
#--
# Author:: Daniel DeLeo (<dan@opscode.com>)
-# Copyright:: Copyright (c) 2012 Opscode, Inc.
+# Copyright:: Copyright (c) 2012-2016 Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -45,6 +45,8 @@ class Chef
describe_network_errors(error_description)
when Net::HTTPServerException, Net::HTTPFatalError
humanize_http_exception(error_description)
+ when EOFError
+ describe_eof_error(error_description)
else
error_description.section("Unexpected Error:","#{exception.class.name}: #{exception.message}")
end
diff --git a/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb b/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb
index 6371243624..0212217d01 100644
--- a/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb
+++ b/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb
@@ -1,6 +1,6 @@
#--
# Author:: Daniel DeLeo (<dan@opscode.com>)
-# Copyright:: Copyright (c) 2012 Opscode, Inc.
+# Copyright:: Copyright (c) 2012-2016 Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -53,6 +53,8 @@ E
error_description.section("Relevant Config Settings:",<<-E)
client_key "#{api_key}"
E
+ when EOFError
+ describe_eof_error(error_description)
else
error_description.section("Unexpected Error:","#{exception.class.name}: #{exception.message}")
end
diff --git a/lib/chef/formatters/error_inspectors/registration_error_inspector.rb b/lib/chef/formatters/error_inspectors/registration_error_inspector.rb
index 312e35adb6..8c070742f7 100644
--- a/lib/chef/formatters/error_inspectors/registration_error_inspector.rb
+++ b/lib/chef/formatters/error_inspectors/registration_error_inspector.rb
@@ -47,6 +47,8 @@ E
error_description.section("Invalid Redirect:",<<-E)
Change your server location in client.rb to the server's FQDN to avoid unwanted redirections.
E
+ when EOFError
+ describe_eof_error(error_description)
else
"#{exception.class.name}: #{exception.message}"
end
diff --git a/lib/chef/formatters/error_inspectors/run_list_expansion_error_inspector.rb b/lib/chef/formatters/error_inspectors/run_list_expansion_error_inspector.rb
index 7ba5448227..263c6cddc7 100644
--- a/lib/chef/formatters/error_inspectors/run_list_expansion_error_inspector.rb
+++ b/lib/chef/formatters/error_inspectors/run_list_expansion_error_inspector.rb
@@ -1,7 +1,7 @@
#--
# Author:: Daniel DeLeo (<dan@opscode.com>)
# Author:: Tyler Cloke (<tyler@opscode.com>)
-# Copyright:: Copyright (c) 2012 Opscode, Inc.
+# Copyright:: Copyright (c) 2012-2016 Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -45,6 +45,8 @@ E
humanize_http_exception(error_description)
when Chef::Exceptions::MissingRole
describe_missing_role(error_description)
+ when EOFError
+ describe_eof_error(error_description)
else
error_description.section("Unexpected Error:","#{exception.class.name}: #{exception.message}")
end
@@ -117,4 +119,3 @@ E
end
end
end
-
diff --git a/spec/unit/formatters/base_spec.rb b/spec/unit/formatters/base_spec.rb
index 9fe8109e98..ba11edaf18 100644
--- a/spec/unit/formatters/base_spec.rb
+++ b/spec/unit/formatters/base_spec.rb
@@ -20,8 +20,8 @@
require "spec_helper"
describe Chef::Formatters::Base do
- let(:out) { double("out") }
- let(:err) { double("err") }
+ let(:out) { StringIO.new }
+ let(:err) { StringIO.new }
let(:formatter) { Chef::Formatters::Base.new(out, err) }
it "starts with an indentation of zero" do
@@ -43,6 +43,29 @@ describe Chef::Formatters::Base do
formatter.indent_by(-2)
expect(formatter.output.indent).to eql(0)
end
-end
+ it "humanizes EOFError exceptions for #registration_failed" do
+ formatter.registration_failed("foo.example.com", EOFError.new, double("Chef::Config"))
+ expect(out.string).to match(/Received an EOF on transport socket/)
+ end
+
+ it "humanizes EOFError exceptions for #node_load_failed" do
+ formatter.node_load_failed("foo.example.com", EOFError.new, double("Chef::Config"))
+ expect(out.string).to match(/Received an EOF on transport socket/)
+ end
+
+ it "humanizes EOFError exceptions for #run_list_expand_failed" do
+ formatter.run_list_expand_failed(double("Chef::Node"), EOFError.new)
+ expect(out.string).to match(/Received an EOF on transport socket/)
+ end
+
+ it "humanizes EOFError exceptions for #cookbook_resolution_failed" do
+ formatter.run_list_expand_failed(double("Expanded Run List"), EOFError.new)
+ expect(out.string).to match(/Received an EOF on transport socket/)
+ end
+ it "humanizes EOFError exceptions for #cookbook_sync_failed" do
+ formatter.cookbook_sync_failed("foo.example.com", EOFError.new)
+ expect(out.string).to match(/Received an EOF on transport socket/)
+ end
+end