Re: psycopg2 (async) socket timeout

From: Jan Urbański <wulczer(at)wulczer(dot)org>
To: Danny Milosavljevic <danny(dot)milo(at)gmail(dot)com>, psycopg(at)postgresql(dot)org
Subject: Re: psycopg2 (async) socket timeout
Date: 2011-02-09 19:00:46
Message-ID: 1297278046.2509.8.camel@Nokia-N900-42-11
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

----- Original message -----
> So the specific case is:
> - connect to the postgres database using psycopg2 while network is up
> - run some queries, get the results fine etc
> - send a query
> - the network goes down before the result to this last query has been
> received - neither a result nor an error callback gets called - as far
> as I can see (using txpostgres.ConnectionPool)
>
> What's the proper way to deal with that?

I'll try to reproduce this problem, AIUI you should have the Deferred errback if the connection is lost, but perhaps it takes some time for Twisted to detect it (actually it takes time for the kernel to detect it). You might try playing with your TCP keepalive settings.

Another option is implementing a timeout with a callLater. The problem there is that it requires additional code and txpostgres does not support query cancellation (yet, it's on the roadmap).

Cheers,
Jan

In response to

Responses

Browse psycopg by date

  From Date Subject
Next Message Mark Theisen 2011-02-09 19:18:16 Re: psycopg2 (async) socket timeout
Previous Message Nicolas Grilly 2011-02-08 14:24:34 Re: copy_from does not stop reading after an error