File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
core/src/main/scala/org/apache/spark/api/python Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -613,7 +613,16 @@ private[spark] object PythonRDD extends Logging {
613
613
setDaemon(true )
614
614
override def run () {
615
615
try {
616
- val sock = serverSocket.accept()
616
+ var sock : Socket = null
617
+ try {
618
+ sock = serverSocket.accept()
619
+ } catch {
620
+ case e : SocketTimeoutException =>
621
+ // there is a small chance that the client had connected, so retry
622
+ logWarning(" Timed out after 4 seconds, retry once" )
623
+ serverSocket.setSoTimeout(10 )
624
+ sock = serverSocket.accept()
625
+ }
617
626
val out = new DataOutputStream (new BufferedOutputStream (sock.getOutputStream))
618
627
try {
619
628
writeIteratorToStream(items, out)
Original file line number Diff line number Diff line change @@ -113,6 +113,7 @@ def _parse_memory(s):
113
113
114
114
def _load_from_socket (port , serializer ):
115
115
sock = socket .socket ()
116
+ sock .settimeout (5 )
116
117
try :
117
118
sock .connect (("localhost" , port ))
118
119
rf = sock .makefile ("rb" , 65536 )
You can’t perform that action at this time.
0 commit comments