socket_timeout option removed

44 views
Skip to first unread message

Jimmy Angelakos

unread,
Feb 13, 2015, 7:46:26 AM2/13/15
to pg8...@googlegroups.com, michae...@gmail.com
Hi there,

We can see that the socket_timeout connect() option was removed in 1.10.1, we found this option really useful for detecting dropped connections.

How would you propose that we handle network failure detection with pg8000 in the future?

Many thanks in advance,
Jimmy

Tony Locke

unread,
Feb 15, 2015, 2:20:13 PM2/15/15
to pg8...@googlegroups.com, michae...@gmail.com
Hi Jimmy, that's a good question. We communicate with the server using a file-like object created using socket.makefile(). The docs are at:

https://docs.python.org/2/library/socket.html#socket.socket.makefile

where it says:

> The socket must be in blocking mode (it can not have a timeout).

So that's the reason why we don't have a timeout. However, looking at the docs for Python 3.4:

https://docs.python.org/3.4/library/socket.html#socket.socket.makefile

it says:

> The socket must be in blocking mode; it can have a timeout, but the file object’s internal buffer may end up in a inconsistent state if a timeout occurs.

So perhaps we could have a timeout for Python 3 users? Would that help you Jimmy? Can anyone shed any more light on this?

Cheers,

Tony.

Tony Locke

unread,
Feb 22, 2015, 10:20:29 AM2/22/15
to pg8...@googlegroups.com, michae...@gmail.com
I've done a version that allows a socket timeout for Python 3 at:

https://github.com/tlocke/pg8000/commit/eba4e72c20407c5a2278e03af348857d4b4fb329

It also includes some source code changes to make pg8000 pass the new, stricter flake8.

Jimmy Angelakos

unread,
Feb 22, 2015, 10:34:27 AM2/22/15
to pg8...@googlegroups.com, michael pap

That's great, will try it out as soon as we migrate the application to python 3 (now we're stuck with 2.7) - thanks so much!

--
Has recibido este mensaje porque estás suscrito a un tema del grupo "pg8000" de Grupos de Google.
Para anular la suscripción a este tema, visita https://groups.google.com/d/topic/pg8000/3BefdOSvg5g/unsubscribe.
Para anular la suscripción a este grupo y a todos sus temas, envía un correo electrónico a pg8000+un...@googlegroups.com.
Para acceder a más opciones, visita https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages