forked from pantsbuild/pants
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve error handling for nailgun client connection attempts
Fixes pantsbuild#2238 - Use 127.0.0.1 vs localhost for nailgun default host. this prevents a situation where a broken /etc/hosts can affect pants ability to connect to the nailgun (currently raises an unhandled and generic socket.gaierror). - Add a specialized NailgunClient.NailgunConnectionError exception type. - Convert NailgunClient.try_connect() from socket.connect_ex() to socket.connect() with added catching of socket.gaierror which is not covered by socket.connect_ex(). - Make NailgunClient.try_connect() raise a helpful NailgunConnectionError exception on failure vs returning None. - Propagate the helpful NailgunConnectionError in both NailgunClient.__call__() and NailgunExecutor.ensure_connectable(). - Improve debug logging. Testing Done: https://travis-ci.org/pantsbuild/pants/builds/81720419 + manual testing. Before/After for a broken /etc/hosts: Exception message: [Errno 8] nodename nor servname provided, or not known vs Exception message: Problem connecting to nailgun server at localhost:55261: gaierror(8, 'nodename nor servname provided, or not known') Before (with resident ng)/Before (without resident ng)/After for an unconnectable nailgun: Exception message: Failed to connect to ng server. vs Exception message: 'NoneType' object has no attribute 'close' vs Exception message: Problem connecting to nailgun server at 127.0.0.1:9999: error(61, 'Connection refused') Bugs closed: 2238, 2246 Reviewed at https://rbcommons.com/s/twitter/r/2869/
- Loading branch information
Showing
2 changed files
with
41 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters