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: SocketServer call shutdown in the wrong way
Type: behavior Stage: resolved
Components: Versions: Python 2.7
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Erik.Günther, asvetlov, orsenthil, r.david.murray
Priority: normal Keywords:

Created on 2012-11-08 12:33 by Erik.Günther, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (6)
msg175152 - (view) Author: Erik Günther (Erik.Günther) Date: 2012-11-08 12:33
I have a small development WSGI-server using PythonPaste and when shutting it down I somtimes get the following error on one or two threads:


Traceback (most recent call last):
  File "/usr/lib/python2.7/", line 551, in __bootstrap_inner
  File "/usr/lib/python2.7/", line 504, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/lib/python2.7/", line 586, in process_request_thread
  File "/usr/lib/python2.7/", line 459, in shutdown_request
TypeError: shutdown() takes exactly 0 arguments (1 given)


/usr/lib/python2.7/ ------------8<-----------

    def shutdown_request(self, request):
        """Called to shutdown and close an individual request."""
            #explicitly shutdown.  socket.close() merely releases
            #the socket and waits for GC to perform the actual close.
        except socket.error:
            pass #some platforms may raise ENOTCONN here


So I recon its a bug...
msg175153 - (view) Author: Erik Günther (Erik.Günther) Date: 2012-11-08 12:47
Sorry forgot to tell in what versions..

Its in Ubuntu 12.04-1 Python version 2.7.3

Ubuntu package version: 2.7.3-0ubuntu3.1
msg176821 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2012-12-03 00:18
request should be socket.socket instance which definitely has shutdown method accepting socket.SHUT_WR.
I guest the problem not in stdlib but in your code or maybe in the Paste (I'm not familiar with it, sorry).
msg178544 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2012-12-30 00:08
Move to pending until additional info will be provided.
Required short test to reproduce the problem.
msg178717 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2012-12-31 22:38
Looks an invalid bug to me as well. request is a socket.socket object and has shutdown method taking a single argument. 
The error pasted in the report leads me to believe if the shutdown_request call is not thread-safe and it is ending up called shutdown method in the module instead of the proper shutdown method of the request object.
msg225212 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-08-12 00:08
Given the lack of additional info from the OP, I'm closing this.
Date User Action Args
2022-04-11 14:57:38adminsetgithub: 60638
2014-08-12 00:08:44r.david.murraysetstatus: open -> closed

nosy: + r.david.murray
messages: + msg225212

resolution: not a bug
stage: test needed -> resolved
2012-12-31 22:38:12orsenthilsetstatus: pending -> open
nosy: + orsenthil
messages: + msg178717

2012-12-30 00:08:34asvetlovsetstatus: open -> pending

messages: + msg178544
2012-12-03 00:19:08asvetlovsetstage: needs patch -> test needed
2012-12-03 00:18:42asvetlovsetmessages: + msg176821
2012-11-15 19:42:44asvetlovsetstage: needs patch
2012-11-15 15:52:19asvetlovsetnosy: + asvetlov
2012-11-08 12:47:34Erik.Günthersetmessages: + msg175153
2012-11-08 12:34:07Erik.Günthersettype: crash -> behavior
2012-11-08 12:33:10Erik.Günthercreate