Re: [pgAgent][Patch] Fixing connection pool leak
От | Rob Emery |
---|---|
Тема | Re: [pgAgent][Patch] Fixing connection pool leak |
Дата | |
Msg-id | CAPCETpvo24W37EV-zcFd7S8xQRqC0bhOvxS1cey5B0en663BvQ@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: [pgAgent][Patch] Fixing connection pool leak (Ashesh Vashi <ashesh.vashi@enterprisedb.com>) |
Список | pgadmin-hackers |
Hiya,
That seems absolutely fine. I've tested the patch I had over the weekend, the problem is pretty easy to reproduce with a job that runs every minute and 4 instances of pgagent.
I'll give this version a test as well, but I'm confident it should be fine.
Thanks,That seems absolutely fine. I've tested the patch I had over the weekend, the problem is pretty easy to reproduce with a job that runs every minute and 4 instances of pgagent.
I'll give this version a test as well, but I'm confident it should be fine.
On 23 October 2017 at 06:00, Ashesh Vashi <ashesh.vashi@enterprisedb.com> wrote:
Hi Rob,How about this?On Sat, Oct 21, 2017 at 8:36 PM, Rob Emery <re-pgsql@codeweavers.net> wrote:Hi,
Following on from https://www.postgresql.org/message-id/CA%2BOCxoz4tONxSpd1rdU -9SPKRzucz8Bar2CXkEDnCwV6H77Zy A%40mail.gmail.com
I think I've identified and fixed the issue, please see the patch attached.
As I understand it when there are multiple pgagent instances and they clash executing a job (i.e rc != 1 on job.cpp:38), the loser of the conflict's thread will never be executed (i.e. job.cpp:418 JobThread::Entry), which is responsible for deleting the job owned by the thread, meaning that the connection is never returned to the pool. By moving the delete of the job into the destructor, we can assure that the connection is tidied up in both cases as the thread is deleted in the error case explicitly in pgAgent.cpp:185.
The only possibly unintended difference that I can see with doing this is that the log "Completed job: %s" is now output when before it wasn't, however I think this new behaviour is actually correct as the job object is completed at that time.
Thanks,
RobPhone: 0800 021 0888 Email: contactus@codeweavers.net
Codeweavers Ltd | Barn 4 | Dunston Business Village | Dunston | ST18 9AB
Registered in England and Wales No. 04092394 | VAT registration no. 974 9705 63
--Robert Emery
Infrastructure Director
E: robertemery@codeweavers.net | T: 01785 711633 | W: www.codeweavers.net

Phone: 0800 021 0888 Email: contactus@ codeweavers.net
Codeweavers Ltd | Barn 4 | Dunston Business Village | Dunston | ST18 9AB
Registered in England and Wales No. 04092394 | VAT registration no. 974 9705 63
Codeweavers Ltd | Barn 4 | Dunston Business Village | Dunston | ST18 9AB
Registered in England and Wales No. 04092394 | VAT registration no. 974 9705 63
В списке pgadmin-hackers по дате отправления: