Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fSEOi-0005pz-CG for pgadmin-hackers@arkaria.postgresql.org; Mon, 11 Jun 2018 04:25:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fSEOf-0002h3-Vc for pgadmin-hackers@arkaria.postgresql.org; Mon, 11 Jun 2018 04:25:37 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fSEOf-0002gt-QU for pgadmin-hackers@lists.postgresql.org; Mon, 11 Jun 2018 04:25:37 +0000 Received: from mail-oi0-x241.google.com ([2607:f8b0:4003:c06::241]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fSEOX-0007hX-3Q for pgadmin-hackers@postgresql.org; Mon, 11 Jun 2018 04:25:36 +0000 Received: by mail-oi0-x241.google.com with SMTP id t133-v6so16695079oif.10 for ; Sun, 10 Jun 2018 21:25:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to:cc; bh=06O/HOzd3mrskUjlnRQVIJCN0HTFyyrymAeurG7hIg8=; b=hje3NDQ0J1KV3psgc/pBfszo1BywNEiRSXCHwUUEeZGv0yt0twztv7/c1hbrSHj20R gNvzmUijyIdNqF3hZ4M531I8xgSDL8I+nwCr57xaD6Pi61YqYsbWfAkeu3bdl8on/6Ac QYVdpHu71M1aMNwdCdpBVDF3kqDZ5bVBh7a9fqFj5xd6LDSQaHAhqp9Wejmt4BJiQKXL QSQl1waWSCfBt/DAaCvhY7jt88llstPHVTR1x6bqMH2Q4GR8Ggu4ujWu4L/IqX3aucmU 0jVprGqo5xoTc9LwOKOdJimxneNtEp0YJ5yilTMbWcnOKvbKjbR1yHs2hXSV8W2Tqk0x Lbuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=06O/HOzd3mrskUjlnRQVIJCN0HTFyyrymAeurG7hIg8=; b=CZZwyyZ+U4E29a55wwL0OlZtWpGczPpRls2uDpBy6Z9A59XQEvseZZO8jTaxvuRtnb bIOYz76mZBcglTI7a4VnSlFSSvfU73sJKr2qN6lyYGxqyXA0Sd4JpNNV1z+Piw3tOyB3 CqrRXximWm+aHT/BsphVbvRF55vTlcGPIln4t5ii75LoCVq2QBZ/8y1wnYwFEVupRgOm gQJ+yIMsO6uvKrROGAZKeokYG0k7Lg6AezwleN8aKCABgul4bwYHGeBfUlCdJ1f5JXKr doFy128n+gct/dbKDN7zKkToQeDleG7fL59AsYPcIAhxZyHfBbvj7ItQsgGEHszP5b9l 2iLA== X-Gm-Message-State: APt69E1gShb2NnpZ/QaoVtJ8IZdMUuO8L7tEnC1e7E779JijZS+FnQ8o ul0Zkq36m7qlP7+zIjyS2+A3zNRJ6Nka57FRRnAC3Q== X-Google-Smtp-Source: ADUXVKK0uyOarXsA7Xdzl+B5gKYbl9WxJUa6QtbNf889i/yyd6ryxdoVk6rr6HT0WjFpY5lbCVixT7sgIdkExXaNXQM= X-Received: by 2002:aca:6a8c:: with SMTP id f134-v6mr5536493oic.350.1528691126628; Sun, 10 Jun 2018 21:25:26 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ac9:7a54:0:0:0:0:0 with HTTP; Sun, 10 Jun 2018 21:25:06 -0700 (PDT) From: Ashesh Vashi Date: Mon, 11 Jun 2018 09:55:06 +0530 Message-ID: Subject: [PATCH] pgAgent segfault To: Dave Page Cc: pgadmin-hackers Content-Type: multipart/mixed; boundary="00000000000093f5e1056e562341" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --00000000000093f5e1056e562341 Content-Type: multipart/alternative; boundary="00000000000093f5de056e56233f" --00000000000093f5de056e56233f Content-Type: text/plain; charset="UTF-8" Hi Dave, While debugging the issue reported by Rob, I found one segfault. Please find the attached patch to find that fix along with another one. 1. Connection object was being accessed, which was already released. 2. Changed the logic for checking the connection object existence. We're using "if (!ms_primaryCon)", which should convert the logic as boolean operator explicitly, which we defined for the 'DBconn' class. I suspect some compilers (specifically windows one) may not behave that way, and instead of using the boolean operator, it checks for the pointer is NULL or not. -- Thanks & Regards, Ashesh Vashi EnterpriseDB INDIA: Enterprise PostgreSQL Company *http://www.linkedin.com/in/asheshvashi* --00000000000093f5de056e56233f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Dave,

While debugging the issue reported by Rob, I found one se= gfault.
Please find the attached patch to find that fix along wit= h another one.

1. Connection object was being acce= ssed, which was already released.

2. Changed the l= ogic for checking the connection object existence.

We're using "if (!ms_primaryCon)", which should convert the = logic as boolean operator explicitly, which we defined for the 'DBconn&= #39; class.

I suspect some compilers (specifically= windows one) may not=C2=A0behave that way, and instead of using the boolea= n operator, it checks for the pointer is NULL or not.

--

Thanks & Regards,

Ashesh Vashi
EnterpriseDB INDIA: Enterprise PostgreSQL Company

<= br>

<= a href=3D"http://www.linkedin.com/in/asheshvashi" target=3D"_blank">http= ://www.linkedin.com/in/asheshvashi

--00000000000093f5de056e56233f-- --00000000000093f5e1056e562341 Content-Type: application/octet-stream; name="pgagent_segfault.patch" Content-Disposition: attachment; filename="pgagent_segfault.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_ji9r7o4m0 ZGlmZiAtLWdpdCBhL2Nvbm5lY3Rpb24uY3BwIGIvY29ubmVjdGlvbi5jcHAKaW5kZXggMTVmNjA2 Ny4uYTk2MTgzMSAxMDA2NDQKLS0tIGEvY29ubmVjdGlvbi5jc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