Thread: Patch for Race Condition.
Hi Dave/Team,
While working on one of the assigned task, i have been noticed the race condition on object "currentObject", which is concurrently updating by "onSelRightClick" and "execSelChange" methods. Due to this, sometimes, i am getting "n" Node context menu on "m" node.
Ex:- When i right click on "server node", it is showing the "database node" popup menu options.
I have been attaching the patch along with this request, and will be awaiting for your inputs.
Thanks in advance.
Dinesh
--
Dinesh Kumar
Follow us on Twitter
@EnterpriseDB
Visit EnterpriseDB for tutorials, webinars, whitepapers and more
--
Dinesh Kumar
Software Engineer
Skype ID: dinesh.kumar432
www.enterprisedb.comFollow us on Twitter
@EnterpriseDB
Visit EnterpriseDB for tutorials, webinars, whitepapers and more
Attachment
On Tue, Sep 24, 2013 at 12:37 PM, Dinesh Kumar <dinesh.kumar@enterprisedb.com> wrote:
Hi Dave/Team,While working on one of the assigned task, i have been noticed the race condition on object "currentObject", which is concurrently updating by "onSelRightClick" and "execSelChange" methods. Due to this, sometimes, i am getting "n" Node context menu on "m" node.Ex:- When i right click on "server node", it is showing the "database node" popup menu options.I have been attaching the patch along with this request, and will be awaiting for your inputs.
This doesn't apply - can you check the patch is correct please?
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Hi Dave,
Sorry, it's my bad. The patch is build on another branch.
Please find the attached patch which has been built on the pgAdmin master branch.
Thanks in advance.
Dinesh
--
Dinesh Kumar
.jpg)
Ph: +918087463317
Follow us on Twitter
@EnterpriseDB
Visit EnterpriseDB for tutorials, webinars, whitepapers and more
--
Dinesh Kumar
Software Engineer
.jpg)
Ph: +918087463317
Skype ID: dinesh.kumar432
www.enterprisedb.comFollow us on Twitter
@EnterpriseDB
Visit EnterpriseDB for tutorials, webinars, whitepapers and more
On Thu, Sep 26, 2013 at 7:54 PM, Dave Page <dpage@pgadmin.org> wrote:
On Tue, Sep 24, 2013 at 12:37 PM, Dinesh Kumar <dinesh.kumar@enterprisedb.com> wrote:Hi Dave/Team,While working on one of the assigned task, i have been noticed the race condition on object "currentObject", which is concurrently updating by "onSelRightClick" and "execSelChange" methods. Due to this, sometimes, i am getting "n" Node context menu on "m" node.Ex:- When i right click on "server node", it is showing the "database node" popup menu options.I have been attaching the patch along with this request, and will be awaiting for your inputs.This doesn't apply - can you check the patch is correct please?--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Attachment
Thanks - applied with minor changes to the comments and mutex name.
On Fri, Sep 27, 2013 at 8:51 AM, Dinesh Kumar <dinesh.kumar@enterprisedb.com> wrote:
Hi Dave,Sorry, it's my bad. The patch is build on another branch.Please find the attached patch which has been built on the pgAdmin master branch.Thanks in advance.Dinesh
--
Dinesh KumarSoftware EngineerSkype ID: dinesh.kumar432www.enterprisedb.com
Follow us on Twitter
@EnterpriseDB
Visit EnterpriseDB for tutorials, webinars, whitepapers and moreOn Thu, Sep 26, 2013 at 7:54 PM, Dave Page <dpage@pgadmin.org> wrote:On Tue, Sep 24, 2013 at 12:37 PM, Dinesh Kumar <dinesh.kumar@enterprisedb.com> wrote:Hi Dave/Team,While working on one of the assigned task, i have been noticed the race condition on object "currentObject", which is concurrently updating by "onSelRightClick" and "execSelChange" methods. Due to this, sometimes, i am getting "n" Node context menu on "m" node.Ex:- When i right click on "server node", it is showing the "database node" popup menu options.I have been attaching the patch along with this request, and will be awaiting for your inputs.This doesn't apply - can you check the patch is correct please?--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Thanks Dave.
Dinesh
--
Dinesh Kumar
.jpg)
Ph: +918087463317
Follow us on Twitter
@EnterpriseDB
Visit EnterpriseDB for tutorials, webinars, whitepapers and more
--
Dinesh Kumar
Software Engineer
.jpg)
Ph: +918087463317
Skype ID: dinesh.kumar432
www.enterprisedb.comFollow us on Twitter
@EnterpriseDB
Visit EnterpriseDB for tutorials, webinars, whitepapers and more
On Fri, Sep 27, 2013 at 8:22 PM, Dave Page <dpage@pgadmin.org> wrote:
Thanks - applied with minor changes to the comments and mutex name.On Fri, Sep 27, 2013 at 8:51 AM, Dinesh Kumar <dinesh.kumar@enterprisedb.com> wrote:Hi Dave,Sorry, it's my bad. The patch is build on another branch.Please find the attached patch which has been built on the pgAdmin master branch.Thanks in advance.Dinesh
--
Dinesh KumarSoftware EngineerSkype ID: dinesh.kumar432www.enterprisedb.com
Follow us on Twitter
@EnterpriseDB
Visit EnterpriseDB for tutorials, webinars, whitepapers and moreOn Thu, Sep 26, 2013 at 7:54 PM, Dave Page <dpage@pgadmin.org> wrote:On Tue, Sep 24, 2013 at 12:37 PM, Dinesh Kumar <dinesh.kumar@enterprisedb.com> wrote:Hi Dave/Team,While working on one of the assigned task, i have been noticed the race condition on object "currentObject", which is concurrently updating by "onSelRightClick" and "execSelChange" methods. Due to this, sometimes, i am getting "n" Node context menu on "m" node.Ex:- When i right click on "server node", it is showing the "database node" popup menu options.I have been attaching the patch along with this request, and will be awaiting for your inputs.This doesn't apply - can you check the patch is correct please?--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
I think - the fix may not work on every platform.
We do unlock the mutex, which is not locked always.
diff --git a/pgadmin/frm/events.cpp b/pgadmin/frm/events.cpp
index 359e372..1bc4b04 100644
--- a/pgadmin/frm/events.cpp
+++ b/pgadmin/frm/events.cpp
@@ -791,6 +791,10 @@ void frmMain::OnSelRightClick(wxTreeEvent &event)
s_currentObjectMutex.Lock();
currentObject = browser->GetObject(item);
}
+ else
+ {
+ s_currentObjectMutex.Lock();
+ }
if (currentObject)
doPopup(browser, event.GetPoint(), currentObject);
On Fri, Sep 27, 2013 at 8:22 PM, Dave Page <dpage@pgadmin.org> wrote:
Thanks - applied with minor changes to the comments and mutex name.On Fri, Sep 27, 2013 at 8:51 AM, Dinesh Kumar <dinesh.kumar@enterprisedb.com> wrote:Hi Dave,Sorry, it's my bad. The patch is build on another branch.Please find the attached patch which has been built on the pgAdmin master branch.Thanks in advance.Dinesh
--
Dinesh KumarSoftware EngineerSkype ID: dinesh.kumar432www.enterprisedb.com
Follow us on Twitter
@EnterpriseDB
Visit EnterpriseDB for tutorials, webinars, whitepapers and moreOn Thu, Sep 26, 2013 at 7:54 PM, Dave Page <dpage@pgadmin.org> wrote:On Tue, Sep 24, 2013 at 12:37 PM, Dinesh Kumar <dinesh.kumar@enterprisedb.com> wrote:Hi Dave/Team,While working on one of the assigned task, i have been noticed the race condition on object "currentObject", which is concurrently updating by "onSelRightClick" and "execSelChange" methods. Due to this, sometimes, i am getting "n" Node context menu on "m" node.Ex:- When i right click on "server node", it is showing the "database node" popup menu options.I have been attaching the patch along with this request, and will be awaiting for your inputs.This doesn't apply - can you check the patch is correct please?--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Thanks & Regards,
Ashesh Vashi
EnterpriseDB INDIA: Enterprise PostgreSQL Company

Sorry - that was wrong file (it was from my working branching, hence - wrong number shown for the line number.)
diff --git a/pgadmin/frm/events.cpp b/pgadmin/frm/events.cpp
index a73fa6a..276a6de 100644
--- a/pgadmin/frm/events.cpp
+++ b/pgadmin/frm/events.cpp
@@ -745,6 +745,10 @@ void frmMain::OnSelRightClick(wxTreeEvent &event)
s_currentObjectMutex.Lock();
currentObject = browser->GetObject(item);
}
+ else
+ {
+ s_currentObjectMutex.Lock();
+ }
if (currentObject)
doPopup(browser, event.GetPoint(), currentObject);
On Thu, Oct 3, 2013 at 10:29 PM, Ashesh Vashi <ashesh.vashi@enterprisedb.com> wrote:
I think - the fix may not work on every platform.We do unlock the mutex, which is not locked always.diff --git a/pgadmin/frm/events.cpp b/pgadmin/frm/events.cppindex 359e372..1bc4b04 100644--- a/pgadmin/frm/events.cpp+++ b/pgadmin/frm/events.cpp@@ -791,6 +791,10 @@ void frmMain::OnSelRightClick(wxTreeEvent &event)s_currentObjectMutex.Lock();currentObject = browser->GetObject(item);}+ else+ {+ s_currentObjectMutex.Lock();+ }if (currentObject)doPopup(browser, event.GetPoint(), currentObject);--On Fri, Sep 27, 2013 at 8:22 PM, Dave Page <dpage@pgadmin.org> wrote:Thanks - applied with minor changes to the comments and mutex name.On Fri, Sep 27, 2013 at 8:51 AM, Dinesh Kumar <dinesh.kumar@enterprisedb.com> wrote:Hi Dave,Sorry, it's my bad. The patch is build on another branch.Please find the attached patch which has been built on the pgAdmin master branch.Thanks in advance.Dinesh
--
Dinesh KumarSoftware EngineerSkype ID: dinesh.kumar432www.enterprisedb.com
Follow us on Twitter
@EnterpriseDB
Visit EnterpriseDB for tutorials, webinars, whitepapers and moreOn Thu, Sep 26, 2013 at 7:54 PM, Dave Page <dpage@pgadmin.org> wrote:On Tue, Sep 24, 2013 at 12:37 PM, Dinesh Kumar <dinesh.kumar@enterprisedb.com> wrote:Hi Dave/Team,While working on one of the assigned task, i have been noticed the race condition on object "currentObject", which is concurrently updating by "onSelRightClick" and "execSelChange" methods. Due to this, sometimes, i am getting "n" Node context menu on "m" node.Ex:- When i right click on "server node", it is showing the "database node" popup menu options.I have been attaching the patch along with this request, and will be awaiting for your inputs.This doesn't apply - can you check the patch is correct please?--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--Thanks & Regards,
Ashesh Vashi
EnterpriseDB INDIA: Enterprise PostgreSQL Company
--
Thanks & Regards,
Ashesh Vashi
EnterpriseDB INDIA: Enterprise PostgreSQL Company

On Thu, Oct 3, 2013 at 12:59 PM, Ashesh Vashi <ashesh.vashi@enterprisedb.com> wrote:
I think - the fix may not work on every platform.We do unlock the mutex, which is not locked always.diff --git a/pgadmin/frm/events.cpp b/pgadmin/frm/events.cppindex 359e372..1bc4b04 100644--- a/pgadmin/frm/events.cpp+++ b/pgadmin/frm/events.cpp@@ -791,6 +791,10 @@ void frmMain::OnSelRightClick(wxTreeEvent &event)s_currentObjectMutex.Lock();currentObject = browser->GetObject(item);}+ else+ {+ s_currentObjectMutex.Lock();+ }if (currentObject)doPopup(browser, event.GetPoint(), currentObject);
Have you seen it fail? I did wonder about that myself, but it worked in testing and as far as I could see the unlock was silently ignored when appropriate.
--On Fri, Sep 27, 2013 at 8:22 PM, Dave Page <dpage@pgadmin.org> wrote:Thanks - applied with minor changes to the comments and mutex name.On Fri, Sep 27, 2013 at 8:51 AM, Dinesh Kumar <dinesh.kumar@enterprisedb.com> wrote:Hi Dave,Sorry, it's my bad. The patch is build on another branch.Please find the attached patch which has been built on the pgAdmin master branch.Thanks in advance.Dinesh
--
Dinesh KumarSoftware EngineerSkype ID: dinesh.kumar432www.enterprisedb.com
Follow us on Twitter
@EnterpriseDB
Visit EnterpriseDB for tutorials, webinars, whitepapers and moreOn Thu, Sep 26, 2013 at 7:54 PM, Dave Page <dpage@pgadmin.org> wrote:On Tue, Sep 24, 2013 at 12:37 PM, Dinesh Kumar <dinesh.kumar@enterprisedb.com> wrote:Hi Dave/Team,While working on one of the assigned task, i have been noticed the race condition on object "currentObject", which is concurrently updating by "onSelRightClick" and "execSelChange" methods. Due to this, sometimes, i am getting "n" Node context menu on "m" node.Ex:- When i right click on "server node", it is showing the "database node" popup menu options.I have been attaching the patch along with this request, and will be awaiting for your inputs.This doesn't apply - can you check the patch is correct please?--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--Thanks & Regards,
Ashesh Vashi
EnterpriseDB INDIA: Enterprise PostgreSQL Company
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
On Thu, Oct 3, 2013 at 10:33 PM, Dave Page <dpage@pgadmin.org> wrote:
--
--

On Thu, Oct 3, 2013 at 12:59 PM, Ashesh Vashi <ashesh.vashi@enterprisedb.com> wrote:I think - the fix may not work on every platform.We do unlock the mutex, which is not locked always.diff --git a/pgadmin/frm/events.cpp b/pgadmin/frm/events.cppindex 359e372..1bc4b04 100644--- a/pgadmin/frm/events.cpp+++ b/pgadmin/frm/events.cpp@@ -791,6 +791,10 @@ void frmMain::OnSelRightClick(wxTreeEvent &event)s_currentObjectMutex.Lock();currentObject = browser->GetObject(item);}+ else+ {+ s_currentObjectMutex.Lock();+ }if (currentObject)doPopup(browser, event.GetPoint(), currentObject);Have you seen it fail? I did wonder about that myself, but it worked in testing and as far as I could see the unlock was silently ignored when appropriate.
Yeah - it's ignoring when unlocking an unlocked mutex. (I've not seen any error).
--On Fri, Sep 27, 2013 at 8:22 PM, Dave Page <dpage@pgadmin.org> wrote:Thanks - applied with minor changes to the comments and mutex name.On Fri, Sep 27, 2013 at 8:51 AM, Dinesh Kumar <dinesh.kumar@enterprisedb.com> wrote:Hi Dave,Sorry, it's my bad. The patch is build on another branch.Please find the attached patch which has been built on the pgAdmin master branch.Thanks in advance.Dinesh
--
Dinesh KumarSoftware EngineerSkype ID: dinesh.kumar432www.enterprisedb.com
Follow us on Twitter
@EnterpriseDB
Visit EnterpriseDB for tutorials, webinars, whitepapers and moreOn Thu, Sep 26, 2013 at 7:54 PM, Dave Page <dpage@pgadmin.org> wrote:On Tue, Sep 24, 2013 at 12:37 PM, Dinesh Kumar <dinesh.kumar@enterprisedb.com> wrote:Hi Dave/Team,While working on one of the assigned task, i have been noticed the race condition on object "currentObject", which is concurrently updating by "onSelRightClick" and "execSelChange" methods. Due to this, sometimes, i am getting "n" Node context menu on "m" node.Ex:- When i right click on "server node", it is showing the "database node" popup menu options.I have been attaching the patch along with this request, and will be awaiting for your inputs.This doesn't apply - can you check the patch is correct please?--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--Thanks & Regards,
Ashesh Vashi
EnterpriseDB INDIA: Enterprise PostgreSQL Company
--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Thanks & Regards,
Ashesh Vashi
EnterpriseDB INDIA: Enterprise PostgreSQL Company
