-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
socket_helper.transient_internet
helper fails when FTP server returns 500
#122999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I tried to fix this with the following change: diff --git a/Lib/test/support/socket_helper.py b/Lib/test/support/socket_helper.py
index 87941ee1791..dcbd7e3ebd4 100644
--- a/Lib/test/support/socket_helper.py
+++ b/Lib/test/support/socket_helper.py
@@ -234,9 +234,12 @@ def filter_error(err):
(isinstance(err, urllib.error.HTTPError) and
500 <= err.code <= 599) or
(isinstance(err, urllib.error.URLError) and
- (("ConnectionRefusedError" in err.reason) or
- ("TimeoutError" in err.reason) or
- ("EOFError" in err.reason))) or
+ ((isinstance(err.reason, BaseException) and
+ isinstance(err.reason.__cause__,
+ (ConnectionRefusedError, TimeoutError, EOFError))) or
+ ("ConnectionRefusedError" in str(err.reason)) or
+ ("TimeoutError" in str(err.reason)) or
+ ("EOFError" in str(err.reason)))) or
n in captured_errnos):
if not support.verbose:
sys.stderr.write(denied.args[0] + "\n") But then the underlying issue was solved, and I do not know how to reproduce the failure. This may only fix some symptoms, and I am not sure that it is the best fix. There may be a regression in the stdlib code after making an argument of URLError an exception instead of a string. Or the helper take this into account and unroll these exceptions like it already do with other exception chains. Without reproducer I cannot do experiments. |
#32074 may be one of culprits. Before, the error message was formatted as |
@serhiy-storchaka I was thinking taking of a similar approach, but hit the same issue - how do you validate the code is actually working? However - @zware raised an interesting point on Discord: the fact this failed could be considered a good thing, because it drew our attention to the fact the So - maybe not fixing this is the better approach? |
Looks like @jeremyhylton reported this separately a few days ago (#122909), and has a prototype patch that goes a bit deeper into url lib (#122913). Closing as a duplicate. |
Bug report
Bug description:
We've seen a bunch of CI failures over the last few hours in the urllib2 FTP tests. These errors have been observed on iOS (1 2), macOS (1) and Linux (1). [edit: and Windows too (1) – @encukou]
The affected tests are:
It's not yet clear how to reliably reproduce the error - it appears to be a transient issue caused by the upstream FTP server raising a 500 error (possibly as a result of #122795).
From a code perspective, the issue is that the error being raised internally is an instance of
error_perm
; this is used as theerr.reason
for the URLError raised by urllib2, which breaks the exception filter.The error manifests as:
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
The text was updated successfully, but these errors were encountered: