Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes leaked semaphores #2125

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions bittensor/utils/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import hashlib
import math
import multiprocessing
import multiprocessing.queues # this must be imported separately, or could break type annotations
import os
import random
import time
Expand Down Expand Up @@ -1082,11 +1083,14 @@ def _solve_for_difficulty_fast_cuda(


def _terminate_workers_and_wait_for_exit(
workers: List[multiprocessing.Process],
workers: List[Union[multiprocessing.Process, multiprocessing.queues.Queue]],
) -> None:
for worker in workers:
worker.terminate()
worker.join()
if isinstance(worker, multiprocessing.queues.Queue):
worker.join_thread()
else:
worker.join()
worker.close()


def create_pow(
Expand Down
Loading