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.

classification
Title: test_xmlrpc: global name 'stop_serving' is not defined
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.2
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: kristjan.jonsson Nosy List: akuchling, christian.heimes, dstanek, jesstess, kristjan.jonsson, pitrou, r.david.murray
Priority: high Keywords:

Created on 2009-10-10 20:39 by pitrou, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (6)
msg93843 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-10-10 20:39
This happens at least on the py3k branch, I haven't checked other branches.


test test_xmlrpc failed -- Traceback (most recent call last):
  File "/home/antoine/py3k/bz-multistream/Lib/test/test_xmlrpc.py", line
344, in tearDown
    stop_serving()
NameError: global name 'stop_serving' is not defined

1 test failed:
    test_xmlrpc
Unhandled exception in thread started by <bound method Thread._bootstrap
of <Thread(Thread-13, started 140424593951056)>>
Error in sys.excepthook:
TypeError: 'NoneType' object is not callable

Original exception was:
Traceback (most recent call last):
  File "/home/antoine/py3k/bz-multistream/Lib/socketserver.py", line
282, in _handle_request_noblock
  File "/home/antoine/py3k/bz-multistream/Lib/socketserver.py", line
308, in process_request
  File "/home/antoine/py3k/bz-multistream/Lib/socketserver.py", line
321, in finish_request
  File "/home/antoine/py3k/bz-multistream/Lib/socketserver.py", line
639, in __init__
  File "/home/antoine/py3k/bz-multistream/Lib/socketserver.py", line
693, in finish
  File "/home/antoine/py3k/bz-multistream/Lib/socket.py", line 242, in close
AttributeError: 'NoneType' object has no attribute 'RawIOBase'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/antoine/py3k/bz-multistream/Lib/test/test_xmlrpc.py", line
294, in http_server
  File "/home/antoine/py3k/bz-multistream/Lib/socketserver.py", line
267, in handle_request
  File "/home/antoine/py3k/bz-multistream/Lib/socketserver.py", line
284, in _handle_request_noblock
  File "/home/antoine/py3k/bz-multistream/Lib/socketserver.py", line
340, in handle_error
ImportError: No module named traceback

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/antoine/py3k/bz-multistream/Lib/test/test_xmlrpc.py", line
297, in http_server
AttributeError: 'NoneType' object has no attribute 'timeout'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/antoine/py3k/bz-multistream/Lib/threading.py", line 509,
in _bootstrap_inner
  File "/home/antoine/py3k/bz-multistream/Lib/threading.py", line 462,
in run
  File "/home/antoine/py3k/bz-multistream/Lib/test/test_xmlrpc.py", line
300, in http_server
  File "/home/antoine/py3k/bz-multistream/Lib/socket.py", line 178, in close
  File "/home/antoine/py3k/bz-multistream/Lib/socket.py", line 173, in
_real_close
AttributeError: 'NoneType' object has no attribute 'socket'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/antoine/py3k/bz-multistream/Lib/threading.py", line 527,
in _bootstrap_inner
AttributeError: 'Thread' object has no attribute '_exc_info'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/antoine/py3k/bz-multistream/Lib/threading.py", line 482,
in _bootstrap
  File "/home/antoine/py3k/bz-multistream/Lib/threading.py", line 557,
in _bootstrap_inner
AttributeError: __exit__
[101191 refs]

1 test failed:
    test_xmlrpc
Unhandled exception in thread started by <bound method Thread._bootstrap
of <Thread(Thread-13, started 140014861584720)>>
Error in sys.excepthook:
TypeError: 'NoneType' object is not callable

Original exception was:
Traceback (most recent call last):
  File "/home/antoine/py3k/bz-multistream/Lib/socketserver.py", line
282, in _handle_request_noblock
  File "/home/antoine/py3k/bz-multistream/Lib/socketserver.py", line
308, in process_request
  File "/home/antoine/py3k/bz-multistream/Lib/socketserver.py", line
321, in finish_request
  File "/home/antoine/py3k/bz-multistream/Lib/socketserver.py", line
639, in __init__
  File "/home/antoine/py3k/bz-multistream/Lib/socketserver.py", line
693, in finish
  File "/home/antoine/py3k/bz-multistream/Lib/socket.py", line 242, in close
AttributeError: 'NoneType' object has no attribute 'RawIOBase'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/antoine/py3k/bz-multistream/Lib/test/test_xmlrpc.py", line
294, in http_server
  File "/home/antoine/py3k/bz-multistream/Lib/socketserver.py", line
267, in handle_request
  File "/home/antoine/py3k/bz-multistream/Lib/socketserver.py", line
284, in _handle_request_noblock
  File "/home/antoine/py3k/bz-multistream/Lib/socketserver.py", line
340, in handle_error
ImportError: No module named traceback

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/antoine/py3k/bz-multistream/Lib/test/test_xmlrpc.py", line
297, in http_server
AttributeError: 'NoneType' object has no attribute 'timeout'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/antoine/py3k/bz-multistream/Lib/threading.py", line 509,
in _bootstrap_inner
  File "/home/antoine/py3k/bz-multistream/Lib/threading.py", line 462,
in run
  File "/home/antoine/py3k/bz-multistream/Lib/test/test_xmlrpc.py", line
300, in http_server
  File "/home/antoine/py3k/bz-multistream/Lib/socket.py", line 178, in close
  File "/home/antoine/py3k/bz-multistream/Lib/socket.py", line 173, in
_real_close
AttributeError: 'NoneType' object has no attribute 'socket'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/antoine/py3k/bz-multistream/Lib/threading.py", line 527,
in _bootstrap_inner
AttributeError: 'Thread' object has no attribute '_exc_info'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/antoine/py3k/bz-multistream/Lib/threading.py", line 482,
in _bootstrap
  File "/home/antoine/py3k/bz-multistream/Lib/threading.py", line 557,
in _bootstrap_inner
AttributeError: __exit__
[101191 refs]
msg93853 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2009-10-11 11:58
I can't repro on my windows box.
From what I can see, for some reason the server thread isn't 
terminating, so we enter an errorhandling codepath that is broken.
The slew of errors that follow occur when the process is exiting and the 
worker threads have had the carpet pulled from underneath them, as it 
were.

We should remove the "stop_serving()" call, it is some rudiment of 
ancient code.  But the real error is still hidden, whatever caused the 
server to not exit.  If this is easily repro, maybe you can produce a 
traceback of the worker thread at this point?
msg100170 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2010-02-26 20:22
The stop_serving() code was only added on the Py3k branch
in rev59424.  It was removed in rev60350,
which is a merge commit; the diff is http://svn.python.org/view/python/branches/py3k/Lib/test/test_xmlrpc.py?r1=60094&r2=60350.

I don't know if this is a merging error, or if the 2.x changes mean stop_serving() is no longer required. Christian Heimes was responsible for both originally adding stop_serving() and for the merge that removed it. Adding him to the nosy list.
msg100172 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-02-26 20:29
Having looked at this code for another reason, I suspect that the stop_serving change was an attempt to handle a possible hang in the test, and that the py2 code simply doesn't try to handle that possible hang.  Note that you can simulate the hang by having a test method never issue a request.  I couldn't figure out a way to get the server to stop serving, but I didn't try for too long before I gave up and used a different solution to the problem I was facing (skipping one of the tests...)
msg186834 - (view) Author: Jessica McKellar (jesstess) * (Python triager) Date: 2013-04-13 20:38
To summarize (as I understand it) the state of this ticket:

* stop_serving no longer exists anywhere in the code base, so the proximal  cause of the bug report from 2009 no longer exists.

* the tests in test_xmlrpc currently all pass without issue.

* If you tried to create a test in a subclass of BaseServerTestCase which never issues a request to the MyXMLRPCServer instance set up by http_server, it will hang. The reason is that BaseServerTestCase uses setUp and tearDown methods that force the test to coordinate a threading.Event with http_server; if no request is made to the XMLRPC server, the test will hang in tearDown waiting for the server to set the Event flag.

I think this ticket could be closed because the proximal issue no longer exists. Alternatively, a docstring could be added to BaseServerTestCase saying tests in subclasses must make at least 1 request else they should live in a different TestCase, or BaseServerTestCase could be refactored to not have this constraint.
msg186839 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-04-13 20:48
Indeed, this issue looks obsolete. Thanks for taking a look!
History
Date User Action Args
2022-04-11 14:56:53adminsetgithub: 51349
2013-04-13 20:48:09pitrousetstatus: open -> closed
resolution: out of date
messages: + msg186839

stage: needs patch -> resolved
2013-04-13 20:38:11jesstesssetnosy: + jesstess
messages: + msg186834
2011-02-04 03:47:41belopolskysetnosy: akuchling, pitrou, kristjan.jonsson, dstanek, christian.heimes, r.david.murray
type: crash -> behavior
2011-01-26 17:57:42dstaneksetnosy: + dstanek
2010-02-26 20:29:09r.david.murraysetnosy: + r.david.murray
messages: + msg100172
2010-02-26 20:22:22akuchlingsetnosy: + christian.heimes, akuchling
messages: + msg100170
2009-10-11 11:58:23kristjan.jonssonsetmessages: + msg93853
2009-10-10 20:39:29pitroucreate