Re: threading and multiprocessing deadlock

2021-12-06 Thread Dieter Maurer
Johannes Bauer wrote at 2021-12-6 00:50 +0100: >I'm a bit confused. In my scenario I a mixing threading with >multiprocessing. Threading by itself would be nice, but for GIL reasons >I need both, unfortunately. I've encountered a weird situation in which >multiprocessing Process()es which are start

Re: threading and multiprocessing deadlock

2021-12-06 Thread Barry Scott
> On 5 Dec 2021, at 23:50, Johannes Bauer wrote: > > Hi there, > > I'm a bit confused. In my scenario I a mixing threading with > multiprocessing. Threading by itself would be nice, but for GIL reasons > I need both, unfortunately. I've encountered a weird situation in which > multiprocessing

Re: threading and multiprocessing deadlock

2021-12-06 Thread Johannes Bauer
Am 06.12.21 um 13:56 schrieb Martin Di Paola: > Hi!, in short your code should work. > > I think that the join-joined problem is just an interpretation problem. > > In pseudo code the background_thread function does: > > def background_thread() >   # bla >   print("join?") >   # bla >   print("j

Re: threading and multiprocessing deadlock

2021-12-06 Thread Martin Di Paola
Hi!, in short your code should work. I think that the join-joined problem is just an interpretation problem. In pseudo code the background_thread function does: def background_thread() # bla print("join?") # bla print("joined") When running this function in parallel using threads, you

threading and multiprocessing deadlock

2021-12-05 Thread Johannes Bauer
Hi there, I'm a bit confused. In my scenario I a mixing threading with multiprocessing. Threading by itself would be nice, but for GIL reasons I need both, unfortunately. I've encountered a weird situation in which multiprocessing Process()es which are started in a new thread don't actually start

Re: multiprocessing deadlock

2009-10-24 Thread Brian Quinlan
On 24 Oct 2009, at 21:37, larudwer wrote: "Brian Quinlan" schrieb im Newsbeitrag news:mailman.1895.1256264717.2807.python-l...@python.org... Any ideas why this is happening? Cheers, Brian IMHO your code is buggy. You run in an typical race condition. consider following part in your code

Re: multiprocessing deadlock

2009-10-24 Thread larudwer
"Brian Quinlan" schrieb im Newsbeitrag news:mailman.1895.1256264717.2807.python-l...@python.org... > > Any ideas why this is happening? > > Cheers, > Brian IMHO your code is buggy. You run in an typical race condition. consider following part in your code: > def _make_some_processes(q): >

Re: multiprocessing deadlock

2009-10-24 Thread Brian Quinlan
On 24 Oct 2009, at 19:49, Gabriel Genellina wrote: En Sat, 24 Oct 2009 02:48:38 -0300, Brian Quinlan escribió: On 24 Oct 2009, at 14:10, Gabriel Genellina wrote: En Thu, 22 Oct 2009 23:18:32 -0300, Brian Quinlan > escribió: I don't like a few things in the code: I'm actually not looking f

Re: multiprocessing deadlock

2009-10-24 Thread Gabriel Genellina
En Sat, 24 Oct 2009 02:48:38 -0300, Brian Quinlan escribió: On 24 Oct 2009, at 14:10, Gabriel Genellina wrote: En Thu, 22 Oct 2009 23:18:32 -0300, Brian Quinlan escribió: I don't like a few things in the code: I'm actually not looking for workarounds. I want to know if this is a multip

Re: multiprocessing deadlock

2009-10-24 Thread Ishwor Gurung
Hi Brian, I think there could be a slight problem (if I've understood your code). > import multiprocessing > import queue > > def _process_worker(q): >    while True: do you really want to run it indefinitely here? >        try: >            something = q.get(block=True, timeout=0.1) >        exc

Re: multiprocessing deadlock

2009-10-23 Thread Brian Quinlan
On 24 Oct 2009, at 14:10, Gabriel Genellina wrote: En Thu, 22 Oct 2009 23:18:32 -0300, Brian Quinlan escribió: I don't like a few things in the code: def _do(i): print('Run:', i) q = multiprocessing.Queue() for j in range(30): q.put(i*30+j) processes = _make_some_p

Re: multiprocessing deadlock

2009-10-23 Thread Gabriel Genellina
En Thu, 22 Oct 2009 23:18:32 -0300, Brian Quinlan escribió: I don't like a few things in the code: def _do(i): print('Run:', i) q = multiprocessing.Queue() for j in range(30): q.put(i*30+j) processes = _make_some_processes(q) while not q.empty(): p

Re: multiprocessing deadlock

2009-10-23 Thread Brian Quinlan
On 24 Oct 2009, at 06:01, paulC wrote: Hey Paul, I guess I was unclear in my explanation - the deadlock only happens when I *don't* call join. Cheers, Brian Whoops, my bad. Have you tried replacing prints with writing a another output Queue? I'm wondering if sys.stdout has a problem. Re

Re: multiprocessing deadlock

2009-10-23 Thread paulC
> > Hey Paul, > > I guess I was unclear in my explanation - the deadlock only happens   > when I *don't* call join. > > Cheers, > Brian Whoops, my bad. Have you tried replacing prints with writing a another output Queue? I'm wondering if sys.stdout has a problem. Regards, Paul C. -- http://mail

Re: multiprocessing deadlock

2009-10-23 Thread Brian Quinlan
On 24 Oct 2009, at 00:02, paulC wrote: On Oct 23, 3:18 am, Brian Quinlan wrote: My test reduction: import multiprocessing import queue def _process_worker(q): while True: try: something = q.get(block=True, timeout=0.1) except queue.Empty: retu

Re: multiprocessing deadlock

2009-10-23 Thread paulC
On Oct 23, 3:18 am, Brian Quinlan wrote: > My test reduction: > > import multiprocessing > import queue > > def _process_worker(q): >      while True: >          try: >              something = q.get(block=True, timeout=0.1) >          except queue.Empty: >              return >          else: >  

multiprocessing deadlock

2009-10-22 Thread Brian Quinlan
My test reduction: import multiprocessing import queue def _process_worker(q): while True: try: something = q.get(block=True, timeout=0.1) except queue.Empty: return else: print('Grabbed item from queue:', something) def _make_som