Re: psycopg2 (async) socket timeout

Поиск
Список
Период
Сортировка
От Jan Urbański
Тема Re: psycopg2 (async) socket timeout
Дата
Msg-id 1297278046.2509.8.camel@Nokia-N900-42-11
обсуждение исходный текст
Ответ на psycopg2 (async) socket timeout  (Danny Milosavljevic <danny.milo@gmail.com>)
Ответы Re: psycopg2 (async) socket timeout  (Danny Milosavljevic <danny.milo+ml@gmail.com>)
Список 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
takessome time for Twisted to detect it (actually it takes time for the kernel to detect it). You might try playing
withyour TCP keepalive settings. 

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

Cheers,
Jan

В списке psycopg по дате отправления:

Предыдущее
От: Nicolas Grilly
Дата:
Сообщение: Re: copy_from does not stop reading after an error
Следующее
От: Mark Theisen
Дата:
Сообщение: Re: psycopg2 (async) socket timeout