Skip to content

Commit

Permalink
[SPARK-21551][Python] Increase timeout for PythonRDD.serveIterator
Browse files Browse the repository at this point in the history
  • Loading branch information
peay committed Jul 27, 2017
1 parent 9f5647d commit 9d3c664
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ private[spark] object PythonRDD extends Logging {
* Create a socket server and a background thread to serve the data in `items`,
*
* The socket server can only accept one connection, or close if no connection
* in 3 seconds.
* in 15 seconds.
*
* Once a connection comes in, it tries to serialize all the data in `items`
* and send them into this connection.
Expand All @@ -692,8 +692,8 @@ private[spark] object PythonRDD extends Logging {
*/
def serveIterator[T](items: Iterator[T], threadName: String): Int = {
val serverSocket = new ServerSocket(0, 1, InetAddress.getByName("localhost"))
// Close the socket if no connection in 3 seconds
serverSocket.setSoTimeout(3000)
// Close the socket if no connection in 15 seconds
serverSocket.setSoTimeout(15000)

new Thread(threadName) {
setDaemon(true)
Expand Down
2 changes: 1 addition & 1 deletion python/pyspark/rdd.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def _load_from_socket(port, serializer):
af, socktype, proto, canonname, sa = res
sock = socket.socket(af, socktype, proto)
try:
sock.settimeout(3)
sock.settimeout(15)
sock.connect(sa)
except socket.error:
sock.close()
Expand Down

0 comments on commit 9d3c664

Please sign in to comment.