PGAgent:抓到未处理的未知异常;终止

时间:2015-10-16 10:27:09

标签: pgagent

在postgre数据库上不断运行作业的麻烦,永远不会完成。

我已尝试以下操作来修复它:

  • apt-get update&升级(postgresql更新到最新)
  • /etc/init.d/postgresql restart

    postgresql.service - PostgreSQL RDBMS
       Loaded: loaded (/lib/systemd/system/postgresql.service; enabled)
       Active: active (exited) since Fri 2015-10-16 10:06:04 UTC; 9s ago
       Process: 6787 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
       Main PID: 6787 (code=exited, status=0/SUCCESS)
         CGroup: /system.slice/postgresql.service
    
  • /etc/init.d/pgagent restart

    pgagent.service - Postgres Job Agent Daemon
      Loaded: loaded (/lib/systemd/system/pgagent.service; enabled)
      Active: active (running) since Fri 2015-10-16 10:06:04 UTC; 1min 48s ago
      Main PID: 6793 (pgagent)
         CGroup: /system.slice/pgagent.service
           └─6793 /usr/bin/pgagent -f -l 2 -s /var/log/pgagent hostaddr=localhost dbname=postgres user=postgresext
    
    Oct 16 10:07:00 m-t-db-01 pgagent[6793]: *** Caught unhandled unknown exception; terminating
    Oct 16 10:07:50 m-t-db-01 pgagent[6793]: *** Caught unhandled unknown exception; terminating
    
  • 尝试在pgagent vim /etc/default/pgagent

    上启用调试模式
    EXTRA_OPTS="-f -l 2 -s /var/log/pgagent hostaddr=localhost dbname=postgres user=postgresext"
    
  • 尝试重启机器
  • /var/log/pgagent日志中我只看到:

    ERROR: Failed to query jobs table!
    DEBUG: Creating primary connection
    DEBUG: Connection Information:
    DEBUG:      user         : postgresext
    DEBUG:      port         : 0
    DEBUG:      host         : localhost
    DEBUG:      dbname       : postgres
    DEBUG:      password     :
    DEBUG:      conn timeout : 0
    DEBUG: Connection Information:
    DEBUG:      user         : postgresext
    DEBUG:      port         : 0
    DEBUG:      host         : localhost
    DEBUG:      dbname       : postgres
    DEBUG:      password     :
    DEBUG:      conn timeout : 0
    DEBUG: Creating DB connection: user=postgresext host=localhost dbname=postgres
    DEBUG: Database sanity check
    DEBUG: Clearing zombies
    DEBUG: Checking for jobs to run
    DEBUG: Sleeping...
    DEBUG: Clearing inactive connections
    DEBUG: Connection stats: total - 1, free - 0, deleted - 0
    DEBUG: Checking for jobs to run
    DEBUG: Sleeping...
    DEBUG: Creating primary connection
    DEBUG: Connection Information:
    DEBUG:      user         : postgresext
    DEBUG:      port         : 0
    DEBUG:      host         : localhost
    DEBUG:      dbname       : postgres
    DEBUG:      password     :
    DEBUG:      conn timeout : 0
    DEBUG: Connection Information:
    DEBUG:      user         : postgresext
    DEBUG:      port         : 0
    DEBUG:      host         : localhost
    DEBUG:      dbname       : postgres
    DEBUG:      password     :
    DEBUG:      conn timeout : 0
    DEBUG: Creating DB connection: user=postgresext host=localhost dbname=postgres
    DEBUG: Database sanity check
    DEBUG: Clearing zombies
    DEBUG: Checking for jobs to run
    DEBUG: Sleeping...
    DEBUG: Clearing inactive connections
    DEBUG: Connection stats: total - 1, free - 0, deleted - 0
    DEBUG: Checking for jobs to run
    DEBUG: Sleeping...
    DEBUG: Clearing inactive connections
    DEBUG: Connection stats: total - 1, free - 0, deleted - 0
    DEBUG: Checking for jobs to run
    DEBUG: Creating job thread for job 8
    DEBUG: Creating DB connection: user=postgresext host=localhost dbname=postgres
    DEBUG: Allocating new connection to database postgres
    DEBUG: Starting job: 8
    DEBUG: Creating job thread for job 5
    DEBUG: Creating DB connection: user=postgresext host=localhost dbname=postgres
    DEBUG: Allocating new connection to database postgres
    DEBUG: Starting job: 5
    DEBUG: Creating DB connection: user=postgresext host=localhost dbname=postgres dbname=testdb
    DEBUG: Sleeping...
    DEBUG: Allocating new connection to database testdb
    DEBUG: Executing SQL step 23 (part of job 8)
    DEBUG: Creating DB connection: user=postgresext host=localhost dbname=postgres dbname=testdb
    DEBUG: Allocating new connection to database testdb
    DEBUG: Executing SQL step 15 (part of job 5)
    DEBUG: Checking for jobs to run
    DEBUG: Sleeping...
    DEBUG: Clearing inactive connections
    DEBUG: Connection stats: total - 5, free - 0, deleted - 0
    DEBUG: Checking for jobs to run
    DEBUG: Sleeping...
    DEBUG: Destroying job thread for job 8
    DEBUG: Clearing inactive connections
    DEBUG: Connection stats: total - 5, free - 0, deleted - 0
    DEBUG: Checking for jobs to run
    DEBUG: Sleeping...
    DEBUG: Clearing inactive connections
    DEBUG: Connection stats: total - 5, free - 0, deleted - 0
    DEBUG: Checking for jobs to run
    DEBUG: Sleeping...
    DEBUG: Clearing inactive connections
    DEBUG: Connection stats: total - 5, free - 0, deleted - 0
    DEBUG: Checking for jobs to run
    DEBUG: Sleeping...
    DEBUG: Clearing inactive connections
    DEBUG: Connection stats: total - 5, free - 0, deleted - 0
    DEBUG: Checking for jobs to run
    DEBUG: Sleeping...
    
  • {li>

    vim /var/log/postgresql/postgresql-9.4-main.log我只看到:

    [unknown]@[unknown] LOG:  incomplete startup packet
    LOG:  MultiXact member wraparound protections are now enabled
    LOG:  database system is ready to accept connections
    LOG:  autovacuum launcher started
    postgresext@postgres LOG:  could not receive data from client: Connection reset by peer
    postgresext@testdb LOG:  could not receive data from client: Connection reset by peer
    postgresext@postgres LOG:  could not receive data from client: Connection reset by peer
    postgresext@postgres LOG:  could not receive data from client: Connection reset by peer
    postgresext@testdb LOG:  could not receive data from client: Connection reset by peer
    postgresext@postgres LOG:  could not receive data from client: Connection reset by peer
    postgresext@postgres LOG:  could not receive data from client: Connection reset by peer
    postgresext@testdb LOG:  could not receive data from client: Connection reset by peer
    postgresext@testdb LOG:  could not receive data from client: Connection reset by peer
    postgresext@testdb LOG:  could not receive data from client: Connection reset by peer
    postgresext@postgres LOG:  could not receive data from client: Connection reset by peer
    

我无法弄清楚实际问题是什么以及如何解决它?

我调查的另一件事是pgagent[6793]: *** Caught unhandled unknown exception; terminating可以通过错误的连接终止来调用...

1 个答案:

答案 0 :(得分:0)

回答这个问题有点晚了,但是在使用pgAgent时遇到了同样的问题,它只会导致挫败感。我甚至试图深入挖掘修复它的源代码,但只是试图让它在我的服务器上进行编译是一个彻头彻尾的噩梦,因为它需要依赖(没有充分的理由)。

因此,考虑到这一点,我决定为Postgres编写一个新的作业调度程序,以替代pgAgent。它被称为jpgAgent,我已经在我的公司使用它几个月了,完全没有任何问题。现在我们使用jpgAgent时更加稳定,不必担心代理会随机停止我们的工作,并且工作没有像他们应该的那样运行,而以前这是一个常见的问题。

无论如何,希望它可以帮助你。