[Pkg-postgresql-public] Bug#781105: pgagent: SQL jobstep deadlock

Thomas Krennwallner tk at postsubmeta.net
Tue Mar 24 15:33:11 UTC 2015


Package: pgagent
Version: 3.4.0-3
Severity: important
Tags: patch

Running pgagent on Debian jessie with an SQL jobstep crashes the worker
thread with the error message "Caught unhandled unknown exception;
terminating". Both job and jobstep status then remain as 'r' (running)
until the pgagent process quits. After restarting pgagent, which cleans
up the job status and sets it to 'd' (aborted), the job containing the
SQL jobstep is free to run again, but the next run will end up in the
same deadlock situation.

$ pgagent -l 2 -f hostaddr=127.0.0.1 port=5432 dbname=pgdb user=pgdb
[...]
DEBUG: Connection stats: total - 1, free - 0, deleted - 0
DEBUG: Checking for jobs to run
DEBUG: Creating job thread for job 5
DEBUG: Creating DB connection: user=pgdb port=5432 hostaddr=127.0.0.1 dbname=pgdb
DEBUG: Allocating new connection to database pgdb
DEBUG: Starting job: 5
DEBUG: Sleeping...
DEBUG: Creating DB connection: user=pgdb port=5432 hostaddr=127.0.0.1 dbname=pgdb dbname=pgdb
DEBUG: Allocating new connection to database pgdb
DEBUG: Executing SQL step 40 (part of job 5)
*** Caught unhandled unknown exception; terminating
DEBUG: Destroying job thread for job 5
DEBUG: Checking for jobs to run
DEBUG: Sleeping...
DEBUG: Clearing inactive connections
DEBUG: Connection stats: total - 3, free - 0, deleted - 0
DEBUG: Checking for jobs to run
DEBUG: Sleeping...
DEBUG: Clearing inactive connections
DEBUG: Connection stats: total - 3, free - 0, deleted - 0
DEBUG: Checking for jobs to run
DEBUG: Sleeping...
[...]

I have tracked down the problem to DBconn::GetLastError(), which gets
called after each SQL jobstep execution in Job::Execute(): there,
DBconn::GetLastError() throws an exception whenever the last error
message is empty.

The supplied patch (also sent as pull request
https://github.com/postgres/pgagent/pull/5 to upstream) fixes this
problem.

-- System Information:
Debian Release: 8.0
  APT prefers testing-updates
  APT policy: (500, 'testing-updates'), (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages pgagent depends on:
ii  libc6           2.19-15
ii  libgcc1         1:4.9.2-10
ii  libpq5          9.4.1-1
ii  libstdc++6      4.9.2-10
ii  libwxbase3.0-0  3.0.2-1+b1

pgagent recommends no packages.

Versions of packages pgagent suggests:
ii  pgadmin3  1.20.0~beta2-1

-- no debconf information
-------------- next part --------------
A non-text attachment was scrubbed...
Name: connection.patch
Type: text/x-diff
Size: 1085 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-postgresql-public/attachments/20150324/077ba4d8/attachment.patch>


More information about the Pkg-postgresql-public mailing list