Skip to content

Commit 03a2e8c

Browse files
committed
cleanup dead children every seconds
1 parent 32cb829 commit 03a2e8c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

python/pyspark/daemon.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,16 @@ def handle_sigterm(*args):
119119
try:
120120
while True:
121121
try:
122-
ready_fds = select.select([0, listen_sock], [], [])[0]
122+
ready_fds = select.select([0, listen_sock], [], [], 1)[0]
123123
except select.error as ex:
124124
if ex[0] == EINTR:
125125
continue
126126
else:
127127
raise
128128

129+
# cleanup in signal handler will cause deadlock
130+
cleanup_dead_children()
131+
129132
if 0 in ready_fds:
130133
try:
131134
worker_pid = read_int(sys.stdin)
@@ -145,8 +148,6 @@ def handle_sigterm(*args):
145148
continue
146149
raise
147150

148-
# cleanup in signal handler will cause deadlock
149-
cleanup_dead_children()
150151

151152
# Launch a worker process
152153
try:

0 commit comments

Comments
 (0)