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

SocketServer: server_address is... a socket #55339

Closed
progval mannequin opened this issue Feb 5, 2011 · 5 comments
Closed

SocketServer: server_address is... a socket #55339

progval mannequin opened this issue Feb 5, 2011 · 5 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@progval
Copy link
Mannequin

progval mannequin commented Feb 5, 2011

BPO 11130
Nosy @orsenthil

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 2011-02-05.17:15:45.510>
created_at = <Date 2011-02-05.16:57:24.608>
labels = ['invalid', 'type-bug', 'library']
title = 'SocketServer: server_address is... a socket'
updated_at = <Date 2011-02-05.17:15:45.509>
user = 'https://bugs.python.org/progval'

bugs.python.org fields:

activity = <Date 2011-02-05.17:15:45.509>
actor = 'orsenthil'
assignee = 'none'
closed = True
closed_date = <Date 2011-02-05.17:15:45.510>
closer = 'orsenthil'
components = ['Library (Lib)']
creation = <Date 2011-02-05.16:57:24.608>
creator = 'progval'
dependencies = []
files = []
hgrepos = []
issue_num = 11130
keywords = []
message_count = 5.0
messages = ['127999', '128000', '128002', '128003', '128004']
nosy_count = 2.0
nosy_names = ['orsenthil', 'progval']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue11130'
versions = ['Python 2.6', 'Python 2.7']

@progval
Copy link
Mannequin Author

progval mannequin commented Feb 5, 2011

Hello,

I have issues with a script I'm programming (TypeError at every client connection), so I edited BaseServer's __init__():
    def __init__(self, server_address, RequestHandlerClass):
        """Constructor.  May be extended, do not override."""
        if isinstance(server_address, socket._socketobject):
            raise Exception()
        self.server_address = server_address
        self.RequestHandlerClass = RequestHandlerClass
        self.__is_shut_down = threading.Event()
        self.__shutdown_request = False
And it raises sometimes this traceback:
Exception happened during processing of request from ('127.0.0.1', 32810)
Traceback (most recent call last):
  File "/usr/lib/python2.6/SocketServer.py", line 285, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python2.6/SocketServer.py", line 311, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python2.6/SocketServer.py", line 324, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python2.6/SocketServer.py", line 400, in __init__
    BaseServer.__init__(self, server_address, RequestHandlerClass)
  File "/usr/lib/python2.6/SocketServer.py", line 198, in __init__
    raise Exception()

Best regards,
ProgVal

@progval progval mannequin added the stdlib Python modules in the Lib dir label Feb 5, 2011
@progval
Copy link
Mannequin Author

progval mannequin commented Feb 5, 2011

The problem happens on Python 2.7 too.

Additionaly, here is the traceback, if I don't edit the library:
Exception happened during processing of request from ('127.0.0.1', 50378)
Traceback (most recent call last):
  File "/usr/lib/python2.7/SocketServer.py", line 284, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 310, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 323, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python2.7/SocketServer.py", line 408, in __init__
    self.server_bind()
  File "/usr/lib/python2.7/SocketServer.py", line 419, in server_bind
    self.socket.bind(self.server_address)
  File "/usr/lib/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
TypeError: getsockaddrarg: AF_INET address must be tuple, not _socketobject

@progval
Copy link
Mannequin Author

progval mannequin commented Feb 5, 2011

This seems odd to me: this line:
self.RequestHandlerClass(request, client_address, self)
calls TCPServer's constructor:
def __init__(self, server_address, RequestHandlerClass, bind_and_activate=True):

@progval
Copy link
Mannequin Author

progval mannequin commented Feb 5, 2011

Oooooh, excuse me, it's because of my code!

class MyRequestHandler(SocketServer.TCPServer):

@progval progval mannequin added the invalid label Feb 5, 2011
@orsenthil
Copy link
Member

Unable to determine the bug here. If you have questions with using python, please ask python-list@python.org

@orsenthil orsenthil added the type-bug An unexpected behavior, bug, or error label Feb 5, 2011
@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
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant