Skip to content

Commit

Permalink
fix multiprocessing ml bug
Browse files Browse the repository at this point in the history
  • Loading branch information
sansyrox committed Apr 22, 2024
1 parent 0e98815 commit 489ba6b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
12 changes: 12 additions & 0 deletions multtest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import multiprocessing

def worker(a):
print(a)

if __name__ == '__main__':
a = []
multiprocessing.set_start_method('spawn')
p = multiprocessing.Process(target=worker, args=('hello',))
p.start()
a.append(p)
p.join()
7 changes: 4 additions & 3 deletions robyn/processpool.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import asyncio
import webbrowser
from multiprocess import Process
import multiprocessing as mp
import multiprocess as mp
import signal
import sys
from typing import Dict, List
Expand Down Expand Up @@ -78,7 +78,8 @@ def init_processpool(
response_headers: Headers,
) -> List[Process]:
process_pool = []
ctx = mp.get_context('spawn')
ctx = mp.get_context('fork')


if sys.platform.startswith("win32"):
spawn_process(
Expand All @@ -98,7 +99,7 @@ def init_processpool(

for _ in range(processes):
copied_socket = socket.try_clone()
process = Process(
process = ctx.Process(
target=spawn_process,
args=(
directories,
Expand Down

0 comments on commit 489ba6b

Please sign in to comment.