Skip site navigation (1) Skip section navigation (2)

pgAgent crashes on failed connection

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: pgAgent crashes on failed connection
Date: 2011-08-04 19:19:46
Message-ID: 4E3AF0D2.8020908@enterprisedb.com (view raw or flat)
Thread:
Lists: pgadmin-hackers
I created 100 identical pgagent jobs, with one step that simply does 
"SELECT pg_sleep(10)". I then forced them all to run immediately, with 
"UPDATE pgagent.pga_job SET jobnextrun=now();". pgagent crashed.

What happened is that the when all those jobs are launched at the same 
time, the server ran into the max_connections limit, and pgagent didn't 
handle that too well. JobThread::JobThread constructor does not check 
for NULL result from DBConn::Get(), and passes a NULL connection to 
Job::Job, which tries to reference it, leading to a segfault.

I propose the attached patch.

-- 
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com

Attachment: fix-pgagent-segfault-on-failed-connection.patch
Description: text/x-diff (885 bytes)

Responses

pgadmin-hackers by date

Next:From: Merlin MoncureDate: 2011-08-04 19:30:17
Subject: Re: pgAgent crashes on failed connection
Previous:From: Heikki LinnakangasDate: 2011-08-04 17:59:18
Subject: Broken link in pgAgent/README

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group