I am using PostgreSQL-9.3 on Ubuntu-14.04 and using "/usr/share/pgadmin3/pgagent.sql" I have configured my pgAdmin3 to use pgAgent. postgres is my maintenance Db and I have run the pgagent.sql content into it's SQL editor to bring the "Jobs" node in pgAdmin3-gui.

In order to check how does this pgAgent works, I made a sample Db and then a test table under it. I have properly configure the "Steps" and "Schedule" parameters. But after starting this newly created job from the Job node using "right-click and run now", my step is running just once and then it's not terminating after the execution. I am sure that my SQL and other parameters are right since I have seen the table modification after the very first run of the step but then the step is not terminating. It's a simple insert SQL command.

Any help regarding why the step is not terminating?

enter image description here

  • Could you show what the job is supposed to do, together with the table structure? – dezso Nov 17 '14 at 16:23
  • I have created a fresh table like this "create table test1 (id integer);" and under the STEPS window my definition is "insert into test1 (id) values (1000);". When I am running this Job, the pgAgent is executing this SQL command but is not terminating the STEP after the insert operation. I even made two STEPS in alphabetical order in order to assure if the first STEP is getting terminated after successful execution, but as was expected, the second SQL operation is not getting executed since the first STEP is still running. – Zia Nov 17 '14 at 16:31
  • More details: Since pgAgent is connected to the postgresql server through the terminal like this "pgagent -f hostaddr=localhost dbname=postgres user=postgres", when I am running my pgAgent job for the first time, "*** Caught unhandled unknown exception; terminating" error is coming in the Terminal; and in the pgAdmin3 the job's status is "Running" (see the attached snapshot). – Zia Nov 17 '14 at 16:49

This was a bug in pgagent, it has been fixed in http://git.postgresql.org/gitweb/?p=pgagent.git;a=commitdiff;h=f9bf1ccb27ebcfce00e7a6d467bc0e1b5ee9555e.

|improve this answer|||||

try setting pgpass.conf in your AppData postgresql directory, then set the content: localhost:5432:*:postgres:

Maybe the issue last result keep "running" is because you don't have access to other DB except "postgres db".

|improve this answer|||||

I was running into similar issues with pgAgent all the time, as at my company we used it pretty heavily. The reason it stays "running" is because the pgAgent service crashed and was unable to update the logging row. Like tkrennwa said, that was most likely caused by that bug.

The issue is, i've run into too many of those types of bugs with pgAgent where it'll crash. Even compiling it on a new machine is way too time consuming though due to it's inexplicable dependencies.

That led me to write a new scheduler (called jpgAgent) as a replacement. It is compatible with the existing pgAgent schema, and is a drop in replacement.

More info can be found here: https://github.com/Tostino/jpgAgent

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.