Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os.fork() command distributed in windows Python27 (in SocketServer module) #70119

Closed
SamLobel mannequin opened this issue Dec 23, 2015 · 12 comments
Closed

os.fork() command distributed in windows Python27 (in SocketServer module) #70119

SamLobel mannequin opened this issue Dec 23, 2015 · 12 comments
Labels
docs Documentation in the Doc dir type-bug An unexpected behavior, bug, or error

Comments

@SamLobel
Copy link
Mannequin

SamLobel mannequin commented Dec 23, 2015

BPO 25931
Nosy @gpshead, @pfmoore, @tjguk, @bitdancer, @vadmium, @zware, @eryksun, @zooba, @applio, @antvalencia

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2016-06-03.05:56:57.478>
created_at = <Date 2015-12-23.03:10:31.473>
labels = ['type-bug', 'docs']
title = 'os.fork() command distributed in windows Python27 (in SocketServer module)'
updated_at = <Date 2016-06-03.20:27:32.010>
user = 'https://bugs.python.org/SamLobel'

bugs.python.org fields:

activity = <Date 2016-06-03.20:27:32.010>
actor = 'berker.peksag'
assignee = 'docs@python'
closed = True
closed_date = <Date 2016-06-03.05:56:57.478>
closer = 'gregory.p.smith'
components = ['Documentation']
creation = <Date 2015-12-23.03:10:31.473>
creator = 'Sam Lobel'
dependencies = []
files = []
hgrepos = []
issue_num = 25931
keywords = []
message_count = 12.0
messages = ['256896', '256898', '266845', '266999', '267001', '267005', '267006', '267029', '267042', '267045', '267048', '267049']
nosy_count = 14.0
nosy_names = ['gregory.p.smith', 'paul.moore', 'tim.golden', 'r.david.murray', 'docs@python', 'python-dev', 'martin.panter', 'zach.ware', 'eryksun', 'steve.dower', 'davin', 'supriyanto maftuh', 'Sam Lobel', 'antvalencia']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue25931'
versions = ['Python 2.7', 'Python 3.5', 'Python 3.6']

@SamLobel
Copy link
Mannequin Author

SamLobel mannequin commented Dec 23, 2015

I ran into this bug while using multiprocessing in Flask, which deep down uses the SocketServer.py module.

There's a call to os.fork() in the windows version , which obviously doesn't work. So SocketServer.py can't be used on windows.

Maybe replace it with something from the multiprocessing module?

@SamLobel SamLobel mannequin added OS-windows type-bug An unexpected behavior, bug, or error labels Dec 23, 2015
@eryksun
Copy link
Contributor

eryksun commented Dec 23, 2015

Starting a Windows process is expensive. Who not use threading, e.g. SocketServer.ThreadingTCPServer?

It seems to me that it's a bug to even define ForkingMixIn, ForkingTCPServer, and ForkingUDPServer on Windows. Those should be conditionally defined depending on the existence of os.fork.

@eryksun eryksun added the stdlib Python modules in the Lib dir label Dec 23, 2015
@bitdancer
Copy link
Member

They aren't currently defined conditionally, though, and haven't ever been, so I'm not sure it is worth chaning that. However, we should probably add an 'availability' line, since they aren't (effectively) available on Windows.

@bitdancer bitdancer added docs Documentation in the Doc dir and removed stdlib Python modules in the Lib dir OS-windows labels Jun 1, 2016
@python-dev
Copy link
Mannequin

python-dev mannequin commented Jun 3, 2016

New changeset d772400a1211 by Gregory P. Smith in branch 'default':
Issue bpo-25931: Don't defining socketserver.Forking* names on platforms such
https://hg.python.org/cpython/rev/d772400a1211

@gpshead
Copy link
Member

gpshead commented Jun 3, 2016

I made the change to not export the Forking names on Windows or other non-os.fork() supporting platforms in 3.6 only as it is arguably an API change, even though the names it removes would effectively be unusable on those platforms anyways.

the docs still need updating.

@bitdancer
Copy link
Member

Your news entry says "don't defining". The doc note can say that the classes are only defined if the platform supports fork.

@bitdancer
Copy link
Member

Well, defined for 3.6, and "functional" for 2.7 and 3.5 docs.

@vadmium
Copy link
Member

vadmium commented Jun 3, 2016

This broke test_socketserver:

http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/7709/steps/test/logs/stdio
0:08:57 [193/400/1] test_socketserver failed
test test_socketserver crashed -- Traceback (most recent call last):
  File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_socketserver.py", line 371, in <module>
    class ForkingErrorTestServer(socketserver.ForkingMixIn, BaseErrorTestServer):
AttributeError: module 'socketserver' has no attribute 'ForkingMixIn'

I am with David that it may not be worthwhile churning the API like this. Just document the existing (in 3.5) status that even though the classes exist, they need a working os.fork(). Otherwise, everyone that references ForkingMixIn but doesn’t use it (like test_socketserver) will have to update their code for 3.6.

@python-dev
Copy link
Mannequin

python-dev mannequin commented Jun 3, 2016

New changeset 3145242bc81f by Gregory P. Smith in branch 'default':
bpo-25931: fix tests broken by the conditional define of socketserver.Forking*
https://hg.python.org/cpython/rev/3145242bc81f

@gpshead
Copy link
Member

gpshead commented Jun 3, 2016

It may be worth rolling back the above two commits. I'm not sure. I'd like to see if anything else falls out of this during the beta phases.

There is a chance that some library has code similar to that found in test_socketserver.py that defines classes that inherit from the Forking type(s) but which are conditionally never used on Windows. The above commit would break that. I'm not sure how common that'll be.

@python-dev
Copy link
Mannequin

python-dev mannequin commented Jun 3, 2016

New changeset 015b86646d8e by Gregory P. Smith in branch 'default':
bpo-25931: document that socketserver.Forking* are unavailable on platforms
https://hg.python.org/cpython/rev/015b86646d8e

@python-dev
Copy link
Mannequin

python-dev mannequin commented Jun 3, 2016

New changeset a4c0208b10df by Gregory P. Smith in branch '2.7':
bpo-25931: document that socketserver.Forking* are unavailable on platforms
https://hg.python.org/cpython/rev/a4c0208b10df

@gpshead gpshead closed this as completed Jun 3, 2016
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

4 participants