Github user JoshRosen commented on a diff in the pull request:
https://github.com/apache/spark/pull/6338#discussion_r33014586
--- Diff: python/pyspark/rdd.py ---
@@ -121,14 +121,21 @@ def _parse_memory(s):
def _load_from_socket(port, serializer):
- sock = socket.socket()
- sock.settimeout(3)
- try:
- sock.connect(("localhost", port))
+ sock = None
+ for res in socket.getaddrinfo("localhost", port, socket.AF_UNSPEC,
socket.SOCK_STREAM):
+ af, socktype, proto, canonname, sa = res
+ try:
+ sock = socket.socket(af, socktype, proto)
+ sock.settimeout(3)
+ sock.connect(sa)
+ except socket.error:
+ sock = None
+ continue
+ break
+ if sock:
--- End diff --
If `sock is None` (the logical `else` branch), should we log an error or
throw an exception?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]