Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #39324 > unrolled thread
| Started by | Ziliang Chen <zlchen.ken@gmail.com> |
|---|---|
| First post | 2013-02-20 00:26 -0800 |
| Last post | 2013-02-21 18:30 -0800 |
| Articles | 4 — 2 participants |
Back to article view | Back to comp.lang.python
Exception in thread QueueFeederThread (most likely raised during interpreter shutdown) Ziliang Chen <zlchen.ken@gmail.com> - 2013-02-20 00:26 -0800
Re: Exception in thread QueueFeederThread (most likely raised during interpreter shutdown) MRAB <python@mrabarnett.plus.com> - 2013-02-20 18:20 +0000
Re: Exception in thread QueueFeederThread (most likely raised during interpreter shutdown) Ziliang Chen <zlchen.ken@gmail.com> - 2013-02-21 18:30 -0800
Re: Exception in thread QueueFeederThread (most likely raised during interpreter shutdown) Ziliang Chen <zlchen.ken@gmail.com> - 2013-02-21 18:30 -0800
| From | Ziliang Chen <zlchen.ken@gmail.com> |
|---|---|
| Date | 2013-02-20 00:26 -0800 |
| Subject | Exception in thread QueueFeederThread (most likely raised during interpreter shutdown) |
| Message-ID | <22cdc2c2-4851-4413-9c2c-b66f4b421b59@googlegroups.com> |
Hi Guys,
I am using the multiprocessing module. The following code snippet occasionally throws the "Exception in thread QueueFeederThread (most likely raised during interpreter shutdown)" exception.
I searched google for the cause, someone says there are some issues with the multiprocessing.Queue (need do some sleep at where the queue is used).
Could you please shed your light here, what is wrong, how can I use the multiprocess correctly ?
Thanks very much !
The python version is 2.6 and on Win7 x64 OS.
------------------
from multiprocessing import Process,Queue
def listTest(q):
print q.get()
def queueTest():
q = Queue()
q.put([1,2,3,4,5,6])
p = Process(target=listTest,args=(q,))
p.start()
p.join()
if __name__=='__main__':
queueTest()
Exception in thread QueueFeederThread (most likely raised during interpreter shutdown):
[toc] | [next] | [standalone]
| From | MRAB <python@mrabarnett.plus.com> |
|---|---|
| Date | 2013-02-20 18:20 +0000 |
| Message-ID | <mailman.2120.1361384443.2939.python-list@python.org> |
| In reply to | #39324 |
On 2013-02-20 08:26, Ziliang Chen wrote: > Hi Guys, > I am using the multiprocessing module. The following code snippet occasionally throws the "Exception in thread QueueFeederThread (most likely raised during interpreter shutdown)" exception. > > I searched google for the cause, someone says there are some issues with the multiprocessing.Queue (need do some sleep at where the queue is used). > > Could you please shed your light here, what is wrong, how can I use the multiprocess correctly ? > > Thanks very much ! > > The python version is 2.6 and on Win7 x64 OS. > > ------------------ > from multiprocessing import Process,Queue > > def listTest(q): > print q.get() > > def queueTest(): > q = Queue() > q.put([1,2,3,4,5,6]) > p = Process(target=listTest,args=(q,)) > p.start() > p.join() > > if __name__=='__main__': > queueTest() > > Exception in thread QueueFeederThread (most likely raised during interpreter shutdown): > I think it may be a race condition. When I tried it, sometimes it failed, sometimes it didn't. It seemed to be better behaved when I put a small sleep at the end to delay the main process exiting.
[toc] | [prev] | [next] | [standalone]
| From | Ziliang Chen <zlchen.ken@gmail.com> |
|---|---|
| Date | 2013-02-21 18:30 -0800 |
| Message-ID | <5848564d-14eb-44f0-866e-a2ffebc69272@googlegroups.com> |
| In reply to | #39369 |
On Thursday, February 21, 2013 2:20:41 AM UTC+8, MRAB wrote: > On 2013-02-20 08:26, Ziliang Chen wrote: > Hi Guys, > I am using the multiprocessing module. The following code snippet occasionally throws the "Exception in thread QueueFeederThread (most likely raised during interpreter shutdown)" exception. > > I searched google for the cause, someone says there are some issues with the multiprocessing.Queue (need do some sleep at where the queue is used). > > Could you please shed your light here, what is wrong, how can I use the multiprocess correctly ? > > Thanks very much ! > > The python version is 2.6 and on Win7 x64 OS. > > ------------------ > from multiprocessing import Process,Queue > > def listTest(q): > print q.get() > > def queueTest(): > q = Queue() > q.put([1,2,3,4,5,6]) > p = Process(target=listTest,args=(q,)) > p.start() > p.join() > > if __name__=='__main__': > queueTest() > > Exception in thread QueueFeederThread (most likely raised during interpreter shutdown): > I think it may be a race condition. When I tried it, sometimes it failed, sometimes it didn't. It seemed to be better behaved when I put a small sleep at the end to delay the main process exiting. Thanks, MRAB! Yeah, I saw such kind of workaround after googling. But seriously, why is there a race condition here ? Is there any misuse of queue here ?
[toc] | [prev] | [next] | [standalone]
| From | Ziliang Chen <zlchen.ken@gmail.com> |
|---|---|
| Date | 2013-02-21 18:30 -0800 |
| Message-ID | <mailman.2234.1361500240.2939.python-list@python.org> |
| In reply to | #39369 |
On Thursday, February 21, 2013 2:20:41 AM UTC+8, MRAB wrote: > On 2013-02-20 08:26, Ziliang Chen wrote: > Hi Guys, > I am using the multiprocessing module. The following code snippet occasionally throws the "Exception in thread QueueFeederThread (most likely raised during interpreter shutdown)" exception. > > I searched google for the cause, someone says there are some issues with the multiprocessing.Queue (need do some sleep at where the queue is used). > > Could you please shed your light here, what is wrong, how can I use the multiprocess correctly ? > > Thanks very much ! > > The python version is 2.6 and on Win7 x64 OS. > > ------------------ > from multiprocessing import Process,Queue > > def listTest(q): > print q.get() > > def queueTest(): > q = Queue() > q.put([1,2,3,4,5,6]) > p = Process(target=listTest,args=(q,)) > p.start() > p.join() > > if __name__=='__main__': > queueTest() > > Exception in thread QueueFeederThread (most likely raised during interpreter shutdown): > I think it may be a race condition. When I tried it, sometimes it failed, sometimes it didn't. It seemed to be better behaved when I put a small sleep at the end to delay the main process exiting. Thanks, MRAB! Yeah, I saw such kind of workaround after googling. But seriously, why is there a race condition here ? Is there any misuse of queue here ?
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web