Skip to content

Commit e1249d3

Browse files
authored
Test if closing explicitly solves recursive lock issues (#13304)
1 parent 40422ff commit e1249d3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

spacy/language.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1716,6 +1716,7 @@ def prepare_input(
17161716
# is done, so that they can exit gracefully.
17171717
for q in texts_q:
17181718
q.put(_WORK_DONE_SENTINEL)
1719+
q.close()
17191720

17201721
# Otherwise, we are stopping because the error handler raised an
17211722
# exception. The sentinel will be last to go out of the queue.
@@ -2347,7 +2348,8 @@ def _apply_pipes(
23472348

23482349
# Stop working if we encounter the end-of-work sentinel.
23492350
if isinstance(texts_with_ctx, _WorkDoneSentinel):
2350-
return
2351+
sender.close()
2352+
receiver.close()
23512353

23522354
docs = (
23532355
ensure_doc(doc_like, context) for doc_like, context in texts_with_ctx
@@ -2371,7 +2373,8 @@ def _apply_pipes(
23712373
# Parent has closed the pipe prematurely. This happens when a
23722374
# worker encounters an error and the error handler is set to
23732375
# stop processing.
2374-
return
2376+
sender.close()
2377+
receiver.close()
23752378

23762379

23772380
class _Sender:

0 commit comments

Comments
 (0)