即使客户端死了,Postgres也不会停止连接

Aja*_*tap 5 java postgresql centos postgresql-9.3

我有一个使用Postgres 9.3的Java Web应用程序。每当Web服务器启动时,它都会使用以下查询获取数据库锁定:

select pg_try_advisory_lock(100);
Run Code Online (Sandbox Code Playgroud)

但是,当我停止服务器时,它不会释放它先前获得的互斥锁

  postgres=# SELECT pl.pid,datname,mode, state FROM pg_locks pl LEFT JOIN pg_stat_activity psa  ON pl.pid = psa.pid;
  pid  |       datname        |      mode       | state  
-------+----------------------+-----------------+--------
  5217 | postgres             | AccessShareLock | active
  5217 | postgres             | AccessShareLock | active
  5217 | postgres             | ExclusiveLock   | active
  5217 | postgres             | AccessShareLock | active
  5217 | postgres             | AccessShareLock | active
  5217 | postgres             | AccessShareLock | active
  5217 | postgres             | AccessShareLock | active
  5217 | postgres             | AccessShareLock | active
  5217 | postgres             | AccessShareLock | active
 27669 | oneproduct           | ExclusiveLock   | idle
(10 rows)
Run Code Online (Sandbox Code Playgroud)

oneproduct是Java应用程序使用的数据库(已锁定)

据我所知,当Postgres的客户停止或杀死或死亡时,所有的锁都已释放,如果我错了,请纠正我。

当我检查此PID时,27669它处于睡眠状态,但其对等方已经死了。

为什么这种行为?请解释一下,我在想什么吗?