Обсуждение: Lock and unlock registry

Поиск
Список
Период
Сортировка

Lock and unlock registry

От
"carlos gustavo"
Дата:
Hello,

My problem:
1. I have a application accessing Postgres 8.2 using NHibernate 3.
2. Using hibernate I lock a registry using the function 'nhibernate.lockmode.upgradenowait'. Ok, its worked.
3. I remove my ethernet cable and lost the connection with Postgres.
4. The registry I locked before remove the cable, continue locked forever!

Question:
How can Postgres detect the connection lost and remove all locks made by this connection? It's a configuration in Postgres or have another way to lock a registry?

Thanks.

Re: Lock and unlock registry

От
Tom Lane
Дата:
"carlos gustavo" <cgcl.comp@gmail.com> writes:
> How can Postgres detect the connection lost and remove all locks made by
> this connection? It's a configuration in Postgres or have another way to
> lock a registry?

It is not Postgres' responsibility to detect a lost network connection,
it is the network stack's responsibility.  When the network code reports
to the backend that the connection is lost, we'll clean up and exit the
session appropriately.

I think your real complaint is that you think the network code's timeout
for declaring the connection lost is too long.  On some platforms you
can shorten the timeout by making the tcp_keepalive settings more
aggressive, but be aware that doing so violates various RFCs and may
result in less-reliable connections.

            regards, tom lane