classification
Title: test_socketserver fails on trunk in test_ForkingTCPServer
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: kristjan.jonsson, r.david.murray
Priority: normal Keywords: patch

Created on 2009-06-30 01:58 by r.david.murray, last changed 2009-12-13 17:57 by r.david.murray. This issue is now closed.

Files
File name Uploaded Description Edit
SocketServer.py kristjan.jonsson, 2009-07-07 00:13 patched SocketServer.py for test on linux
issue6382.patch r.david.murray, 2009-07-07 01:38
Messages (9)
msg89897 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2009-06-30 01:58
Gentoo linux, trunk r73699.  test_socketserver fails with the following
tracebacks:

======================================================================
FAIL: test_ForkingTCPServer (test.test_socketserver.SocketServerTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/rdmurray/python/trunk/Lib/test/test_socketserver.py", line
189, in test_ForkingTCPServer
    self.stream_examine)
  File "/home/rdmurray/python/trunk/Lib/test/test_socketserver.py", line
147, in run_server
    testfunc(svrcls.address_family, addr)
  File "/home/rdmurray/python/trunk/Lib/test/test_socketserver.py", line
161, in stream_examine
    self.assertEquals(buf, TEST_STR)
AssertionError: '' != 'hello world\n'

======================================================================
FAIL: test_ForkingUnixStreamServer (test.test_socketserver.SocketServerTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/rdmurray/python/trunk/Lib/test/test_socketserver.py", line
207, in test_ForkingUnixStreamServer
    self.stream_examine)
  File "/home/rdmurray/python/trunk/Lib/test/test_socketserver.py", line
147, in run_server
    testfunc(svrcls.address_family, addr)
  File "/home/rdmurray/python/trunk/Lib/test/test_socketserver.py", line
161, in stream_examine
    self.assertEquals(buf, TEST_STR)
AssertionError: '' != 'hello world\n'
msg90120 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2009-07-04 15:44
This is a "fork" problem.
socket.close must be done on the parent, while socket.shutdown and 
socket.close must be performed on the child.
I must restructure this a little bit to make it work.
msg90160 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2009-07-05 20:57
submitted revision 73863.  Please test for me on gentoo.
msg90182 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2009-07-06 16:17
I now get a different error, followed by zsh detecting an alarm:

rdmurray@partner:~/python/trunk>./python -m test.regrtest -uall
test_socketserver
Could not find '/home/rdmurray/python/trunk/Lib/test' in sys.path to
remove it
test_socketserver
Exception in thread SocketServer.ForkingUDPServer serving:
Traceback (most recent call last):
  File "/home/rdmurray/python/trunk/Lib/threading.py", line 524, in
__bootstrap_inner
    self.run()
  File "/home/rdmurray/python/trunk/Lib/threading.py", line 477, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/rdmurray/python/trunk/Lib/SocketServer.py", line 226, in
serve_forever
    self._handle_request_noblock()
  File "/home/rdmurray/python/trunk/Lib/SocketServer.py", line 283, in
_handle_request_noblock
    self.handle_error(request, client_address)
  File "/home/rdmurray/python/trunk/Lib/SocketServer.py", line 281, in
_handle_request_noblock
    self.process_request(request, client_address)
  File "/home/rdmurray/python/trunk/Lib/SocketServer.py", line 535, in
process_request
    request.close() #close socket handle in parent process
AttributeError: 'tuple' object has no attribute 'close'

zsh: alarm      ./python -m test.regrtest -uall test_socketserver
msg90198 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2009-07-06 23:41
How unfortunate.  This means that we need to virtualize the shutdown. I'll 
submit a proposed patch.
msg90204 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2009-07-07 00:13
I'm uploading a patched SocketServer.py.  Could you please try it out on 
the gentoo box before I commit it?
msg90209 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2009-07-07 01:38
I had to fix one line, but after that it runs successfully.  Updated
patch attached.  The change is to add the 'request' argument to the
close_request call on line 549.
msg90219 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2009-07-07 09:09
committed in revision 73877 and revision 73878
msg96340 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2009-12-13 17:57
NB: this issue was triggered by the issue 6267 patch.
History
Date User Action Args
2009-12-13 17:57:41r.david.murraysetstatus: open -> closed
type: behavior
messages: + msg96340

resolution: fixed
stage: needs patch -> resolved
2009-07-07 09:09:54kristjan.jonssonsetmessages: + msg90219
2009-07-07 01:38:39r.david.murraysetfiles: + issue6382.patch
keywords: + patch
messages: + msg90209
2009-07-07 00:13:57kristjan.jonssonsetfiles: + SocketServer.py

messages: + msg90204
2009-07-06 23:41:38kristjan.jonssonsetmessages: + msg90198
2009-07-06 16:17:05r.david.murraysetmessages: + msg90182
2009-07-05 20:57:21kristjan.jonssonsetmessages: + msg90160
2009-07-04 15:44:19kristjan.jonssonsetnosy: + kristjan.jonsson
messages: + msg90120
2009-06-30 01:58:43r.david.murraycreate