Skip to content

Reconnect on each request #47

@akopytov

Description

@akopytov

I noticed that my test program reconnects on each request. Debugging and code analysis reveals this code in connection.py as the culprit:

205             def check():  # Check that connection is alive
206                 buf = ctypes.create_string_buffer(2)
207                 self._sys_recv(self._socket.fileno(), buf, 1,
208                         socket.MSG_DONTWAIT | socket.MSG_PEEK)
209  ->             if ctypes.get_errno() == errno.EAGAIN:
210                     ctypes.set_errno(0)
211                     return errno.EAGAIN
212                 return (ctypes.get_errno() if ctypes.get_errno()
213                         else errno.ECONNRESET)

self._sys_recv() always returns EFAULT (Bad address) for me, so connection is always considered dead. I'm not a Python expert, but could it be a bug in the way _sys_recv() is defined/used?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions