classification
Title: multiprocessing - example "pool of http servers " fails on windows "socket has no attribute fromfd"
Type: behavior Stage: needs patch
Components: Library (Lib) Versions: Python 3.1, Python 3.0, Python 2.7, Python 2.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: jnoller Nosy List: ghum, jnoller (2)
Priority: normal Keywords

Created on 2009-04-29 15:38 by ghum, last changed 2009-06-29 13:54 by jnoller.

Messages (1)
msg86810 - (view) Author: Harald Armin Massa (ghum) Date: 2009-04-29 15:38
the example from

http://docs.python.org/library/multiprocessing.html?highlight=multiprocessing#module-multiprocessing

named "
# Example where a pool of http servers share a single listening socket
#
" 
does not work on windows.

Reason: 

s = socket.fromfd(fd, family, type_, proto)

in line 156 of reduction.py

fails, because fromfd is not available on windows. Sad thing:
reduction.py was put into processing.py exactly to solve that problem
(i.e. reduction.py is provided as workaround for socket.fromfd not
available on windows, from the documentation: 
if sys.platform == 'win32':
    import multiprocessing.reduction
    # make sockets pickable/inheritable


the solution within processing was:

try:
    fromfd = socket.fromfd
except AttributeError:
    def fromfd(fd, family, type, proto=0):
        s = socket._socket.socket()
        _processing.changeFd(s, fd, family, type, proto)
        return s

but: _multiprocessing has no longer a method changeFd.

Harald
History
Date User Action Args
2009-06-29 13:54:35jnollersetassignee: jnoller
2009-04-29 15:59:43r.david.murraysetversions: + Python 3.0, Python 3.1, Python 2.7
nosy: + jnoller

priority: normal
type: behavior
stage: needs patch
2009-04-29 15:38:01ghumcreate