multiprocessing.Queue & vim python interpreter

unknown3000 at gmail.com unknown3000 at gmail.com
Fri Jan 30 09:56:18 EST 2015


On Friday, January 23, 2015 at 10:59:46 PM UTC-5, Cameron Simpson wrote:
> On 18Jan2015 16:20, unknown3000 at gmail.com <unknown3000 at gmail.com> wrote:
> >I am experimenting on a fork of vim-plug for managing vim plugins. I wanted to add parallel update support for python since ruby isn't nearly as common. I've come across a weird bug that only seems to happen when I'm inside vim, I'm wondering if someone could tell me why.
> >
> >This problem can be reproduced by sourcing a vim file with the following snippet. Then execute the command PyCrash.
> >command! -nargs=0 PyCrash call s:py_crash()
> >function! s:py_crash()
> >    python << EOF
> >import multiprocessing as multi
> >queue = multi.Queue()
> >queue.put('a')
> >queue.close()
> >EOF
> >endfunction
> >
> >This prints to messages the following:
> >Traceback (most recent call last):
> >  File "/usr/lib/python2.7/multiprocessing/queues.py", line 266, in _feed
> >    send(obj)
> >IOError: [Errno 32] Broken pipe
> 
> Please include the entire traceback in errors.
> 
> I would guess this is because you have made a Queue but have not got subprocess 
> to read from it. So when you .put onto it, you get a broken pipe.
> 
> Cheers,
> Cameron Simpson <cs at zip.com.au>
> 
> Nothing is impossible for the man who doesn't have to do it.

Hi there. Thanks for getting back to me. I don't really need an answer to this issue anymore as I went with threads instead since multiprocessing. The latter doesn't work well on Windows and worse inside an embedded context like GVim ON Windows. Not having fork is a real pain.

This bug was probably related to the embedded python nature of the code rather than python as I never experienced it outside of Vim using the same multiprocessing/Queue code. Also, I don't remember which commit it was so since I'm working on other stuff I'm just gonna leave this unfixed/investigated. Thanks anyway.

Regards,

Jeremy



More information about the Python-list mailing list