public inbox for [email protected]
help / color / mirror / Atom feed[PATCH] pgAgent segfault
2+ messages / 2 participants
[nested] [flat]
* [PATCH] pgAgent segfault
@ 2018-06-11 04:25 Ashesh Vashi <[email protected]>
2018-06-11 16:14 ` Re: [PATCH] pgAgent segfault Dave Page <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Ashesh Vashi @ 2018-06-11 04:25 UTC (permalink / raw)
To: Dave Page <[email protected]>; +Cc: pgadmin-hackers
Hi Dave,
While debugging the issue
<https://www.postgresql.org/message-id/CAG7mmoxXB0DsLZyvZ7qevoG17x7bJyw2DWdd0SXEgFg2Uc993A%40mail.gma...;
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.enterprisedb.com;
*http://www.linkedin.com/in/asheshvashi*
<http://www.linkedin.com/in/asheshvashi;
Attachments:
[application/octet-stream] pgagent_segfault.patch (865B, 3-pgagent_segfault.patch)
download | inline diff:
diff --git a/connection.cpp b/connection.cpp
index 15f6067..a961831 100644
--- a/connection.cpp
+++ b/connection.cpp
@@ -160,7 +160,7 @@ DBconn *DBconn::InitConnection(const std::wstring &connectString)
);
}
- if (!ms_primaryConn)
+ if (ms_primaryConn->m_conn == NULL)
{
std::wstring error = ms_primaryConn->GetLastError();
delete ms_primaryConn;
diff --git a/pgAgent.cpp b/pgAgent.cpp
index 6928e4d..36b3835 100644
--- a/pgAgent.cpp
+++ b/pgAgent.cpp
@@ -207,7 +207,7 @@ void MainLoop()
MainRestartLoop(serviceConn);
}
- LogMessage((boost::wformat(L"Couldn't create the primary connection (attempt %d): %s") % attemptCount % serviceConn->GetLastError()).str(), LOG_STARTUP);
+ LogMessage((boost::wformat(L"Couldn't create the primary connection [Attempt #%d]") % attemptCount).str(), LOG_STARTUP);
DBconn::ClearConnections(true);
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [PATCH] pgAgent segfault
2018-06-11 04:25 [PATCH] pgAgent segfault Ashesh Vashi <[email protected]>
@ 2018-06-11 16:14 ` Dave Page <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Dave Page @ 2018-06-11 16:14 UTC (permalink / raw)
To: Ashesh Vashi <[email protected]>; +Cc: pgadmin-hackers
Thanks, patch applied.
On Mon, Jun 11, 2018 at 5:25 AM, Ashesh Vashi <[email protected]
> wrote:
> Hi Dave,
>
> While debugging the issue
> <https://www.postgresql.org/message-id/CAG7mmoxXB0DsLZyvZ7qevoG17x7bJyw2DWdd0SXEgFg2Uc993A%40mail.gma...;
> 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.enterprisedb.com;
>
>
> *http://www.linkedin.com/in/asheshvashi*
> <http://www.linkedin.com/in/asheshvashi;
>
--
Dave Page
VP, Chief Architect, Tools & Installers
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2018-06-11 16:14 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-06-11 04:25 [PATCH] pgAgent segfault Ashesh Vashi <[email protected]>
2018-06-11 16:14 ` Dave Page <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox