This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ankostis
Recipients ankostis
Date 2017-03-08.14:45:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1488984317.87.0.296010902983.issue29757@psf.upfronthosting.co.za>
In-reply-to
Content
## Context
The utility method `socket.create_connection()` currently works like that:
1. resolve the destination-address into one or more IP(v4 & v6) addresses;
2. loop on each IP address and stop to the 1st one to work;
3. if none works, re-raise the last error.


## The problem
So currently the loop in `socket.create_connection()` ignores all intermediate errors and reports only the last connection failure, 
which  might be irrelevant.  For instance, when both IPv4 & IPv6 networks are supported, usually the last address is a IPv6 address and it frequently fails with an irrelevant error - the actual cause have already been ignored.


## Possible solutions & open questions
To facilitate network debugging, there are at least 3 options:
a. log each failure [as they happen](/python/cpython/blob/6f0eb93183519024cb360162bdd81b9faec97ba6/Lib/socket.py#L717), but that would get the final failure twice: once as a (warning?) message, and once as an exception .
b. collect all failures and log them only when connection fails to collect the errors, 
   but that might miss important infos to the user;
c. collect and return all failures in list attached to the raised exception.

A question for cases (a) & (b) is what logging "means" to use: the `warnings` or `logging` module?
And if `logging` is chosen, log them in `'DEBUG'` or `'WARNING'` level?

Case (c) sidesteps the above questions.
History
Date User Action Args
2017-03-08 14:45:17ankostissetrecipients: + ankostis
2017-03-08 14:45:17ankostissetmessageid: <1488984317.87.0.296010902983.issue29757@psf.upfronthosting.co.za>
2017-03-08 14:45:17ankostislinkissue29757 messages
2017-03-08 14:45:17ankostiscreate