This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: multiprocessing example "pool of http servers " fails on windows
Type: behavior Stage: resolved
Components: Documentation Versions: Python 2.7
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: ZackerySpytz, falsetru, ggenellina, ghum, jnoller, mher, sbt, terry.reedy
Priority: normal Keywords: easy

Created on 2009-04-29 15:38 by ghum, last changed 2022-04-11 14:56 by admin. This issue is now closed.

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

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


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

in line 156 of

fails, because fromfd is not available on windows. Sad thing: was put into exactly to solve that problem
(i.e. 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:

    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.

msg124431 - (view) Author: Mher Movsisyan (mher) Date: 2010-12-21 13:39
py3k does support socket.fromfd on Windows (#1378)
msg222703 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-07-10 21:24
Unfortunately #1378 refers to r59004 which is incorrect.  I can't find (due to my limited skill set :( where and when fromfd was included in the Python builds for Windows.  If that can be found and if somebody is prepared to do a backport then this can go forward.
msg226109 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-08-29 23:52
r50094 was for 2.7 (see msg216242, part of #21204 that is a partly a duplicate of this). Running in 2.7.8, the message has changed to
"PicklingError: Can't pickle <type 'thread.lock'>: it's not found as thread.lock"

The example has been removed in 3.x. I think the right 'fix' for 2.7 is to remove the reference to Windows in both comment and code and instead say 'Does not run on Windows'.
msg368281 - (view) Author: Zackery Spytz (ZackerySpytz) * (Python triager) Date: 2020-05-06 16:38
Python 2 is EOL.
msg368309 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-05-06 22:55
As I said above, the example was removed from 3.x.  At some point, they were all vetted for Windows execution or failure.

Zach, thanks for reviewing 2.7 issues.
Date User Action Args
2022-04-11 14:56:48adminsetgithub: 50129
2020-05-06 22:55:03terry.reedysetstatus: open -> closed
resolution: out of date
messages: + msg368309

stage: needs patch -> resolved
2020-05-06 16:38:28ZackerySpytzsetnosy: + ZackerySpytz
messages: + msg368281
2019-04-26 20:32:01BreamoreBoysetnosy: - BreamoreBoy
2014-08-29 23:52:32terry.reedysetassignee: jnoller ->

components: + Documentation, - Library (Lib), Windows
title: multiprocessing - example "pool of http servers " fails on windows "socket has no attribute fromfd" -> multiprocessing example "pool of http servers " fails on windows
keywords: + easy
nosy: + terry.reedy
versions: - Python 3.1, Python 3.2
messages: + msg226109
2014-08-29 23:42:32terry.reedylinkissue21204 superseder
2014-07-11 00:29:47ned.deilysetnosy: + sbt
2014-07-10 21:24:41BreamoreBoysetnosy: + BreamoreBoy
messages: + msg222703
2010-12-21 13:39:22mhersetnosy: + mher
messages: + msg124431
2010-08-10 11:38:46floxsetnosy: ggenellina, falsetru, jnoller, ghum
components: + Windows
2010-08-05 03:39:52BreamoreBoysetversions: + Python 3.2, - Python 2.6, Python 3.0
2010-03-17 03:22:42ggenellinasetnosy: + ggenellina
2010-01-20 12:04:11falsetrusetnosy: + falsetru
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