Hello Ashesh,

With that patch applied, pgadmin3 hangs the moment I choose an item
from the context menu. It doesn't crash or hang when I exit the menu
by clicking outside it, but clicking inside it causes the application
to stop responding.

Looking at a backtrace (attached), it seems that `onSelRightClick`
grabs the mutex, then calls `doPopup`. However, because doPopup
(indirectly) causes execSelChange, that method is now being called
with the mutex held.

Regards,
Wander


On Mon, Apr 20, 2015 at 11:21 AM, Ashesh Vashi
<ashesh.va...@enterprisedb.com> wrote:
> Hi Wander Nauta,
>
> As per comment above the mutex lock, we need to hold the lock until, the
> context menu is getting popped up correctly.
> I've modified the code accordingly.
>
> Can you please test the attached patch?
>
> --
>
> Thanks & Regards,
>
> Ashesh Vashi
> EnterpriseDB INDIA: Enterprise PostgreSQL Company
>
>
> http://www.linkedin.com/in/asheshvashi
>
>
> On Mon, Apr 20, 2015 at 1:21 PM, Dave Page <dp...@pgadmin.org> wrote:
>>
>> Ashesh; can you look at this please?
>>
>> Thanks.
>>
>> On Sun, Apr 19, 2015 at 3:44 PM, Wander Nauta <i...@wandernauta.nl> wrote:
>> > Hello all,
>> >
>> > I did some more digging and it seems frmMain::OnSelRightClick is
>> > trying to unlock a mutex it doesn't own, which can result in undefined
>> > behaviour in POSIX.
>> >
>> > I've attached a patch that moves the unlock inside the if where the
>> > mutex is locked. This seems to fix the crash, at least on my end, but
>> > I couldn't say if it affects thread safety at all.
>> >
>> > Again, I hope this helps.
>> >
>> > Kind regards,
>> > Wander Nauta
>> >
>> >
>> > --
>> > Sent via pgadmin-support mailing list (pgadmin-support@postgresql.org)
>> > To make changes to your subscription:
>> > http://www.postgresql.org/mailpref/pgadmin-support
>> >
>>
>>
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>
>
#0  0x00007ffff468864c in __lll_lock_wait () from /usr/lib/libpthread.so.0
#1  0x00007ffff468b090 in __lll_lock_elision () from /usr/lib/libpthread.so.0
#2  0x00007ffff6012a49 in wxMutexInternal::Lock() () from 
/usr/lib/libwx_baseu-2.8.so.0
#3  0x0000000000654dd6 in frmMain::execSelChange(wxTreeItemId, bool) ()
#4  0x000000000069ba26 in frmMain::Refresh(pgObject*) ()
#5  0x00000000005bbaf6 in refreshFactory::StartDialog(frmMain*, pgObject*) ()
#6  0x0000000000652e00 in frmMain::OnAction(wxCommandEvent&) ()
#7  0x00007ffff6014fec in 
wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&, 
wxEvtHandler*, wxEvent&) () from /usr/lib/libwx_baseu-2.8.so.0
#8  0x00007ffff601533f in wxEvtHandler::SearchDynamicEventTable(wxEvent&) ()
   from /usr/lib/libwx_baseu-2.8.so.0
#9  0x00007ffff6015412 in wxEvtHandler::ProcessEvent(wxEvent&) () from 
/usr/lib/libwx_baseu-2.8.so.0
#10 0x00007ffff60153b0 in wxEvtHandler::ProcessEvent(wxEvent&) () from 
/usr/lib/libwx_baseu-2.8.so.0
#11 0x00007ffff69bded9 in wxWindowBase::TryParent(wxEvent&) () from 
/usr/lib/libwx_gtk2u_core-2.8.so.0
#12 0x00007ffff60153b0 in wxEvtHandler::ProcessEvent(wxEvent&) () from 
/usr/lib/libwx_baseu-2.8.so.0
#13 0x00007ffff6a01f86 in wxScrollHelperEvtHandler::ProcessEvent(wxEvent&) ()
   from /usr/lib/libwx_gtk2u_core-2.8.so.0
#14 0x00007ffff6992888 in wxMenuBase::SendEvent(int, int) () from 
/usr/lib/libwx_gtk2u_core-2.8.so.0
#15 0x00007ffff692740c in ?? () from /usr/lib/libwx_gtk2u_core-2.8.so.0
#16 0x00007ffff2d3e2d5 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#17 0x00007ffff2d5000c in ?? () from /usr/lib/libgobject-2.0.so.0
#18 0x00007ffff2d58668 in g_signal_emit_valist () from 
/usr/lib/libgobject-2.0.so.0
#19 0x00007ffff2d588cf in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#20 0x00007ffff347c926 in gtk_widget_activate () from 
/usr/lib/libgtk-x11-2.0.so.0
#21 0x00007ffff337881d in gtk_menu_shell_activate_item () from 
/usr/lib/libgtk-x11-2.0.so.0
#22 0x00007ffff3378bbb in ?? () from /usr/lib/libgtk-x11-2.0.so.0
#23 0x00007ffff336690f in ?? () from /usr/lib/libgtk-x11-2.0.so.0
#24 0x00007ffff2d3e2d5 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#25 0x00007ffff2d4ff02 in ?? () from /usr/lib/libgobject-2.0.so.0
#26 0x00007ffff2d58175 in g_signal_emit_valist () from 
/usr/lib/libgobject-2.0.so.0
#27 0x00007ffff2d588cf in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#28 0x00007ffff347db9c in ?? () from /usr/lib/libgtk-x11-2.0.so.0
#29 0x00007ffff3365054 in gtk_propagate_event () from 
/usr/lib/libgtk-x11-2.0.so.0
#30 0x00007ffff33654eb in gtk_main_do_event () from /usr/lib/libgtk-x11-2.0.so.0
#31 0x00007ffff2fda2cc in ?? () from /usr/lib/libgdk-x11-2.0.so.0
#32 0x00007ffff28439fd in g_main_context_dispatch () from 
/usr/lib/libglib-2.0.so.0
#33 0x00007ffff2843ce0 in ?? () from /usr/lib/libglib-2.0.so.0
#34 0x00007ffff2843d8c in g_main_context_iteration () from 
/usr/lib/libglib-2.0.so.0
#35 0x00007ffff3364681 in gtk_main_iteration () from 
/usr/lib/libgtk-x11-2.0.so.0
#36 0x00007ffff6927924 in wxWindow::DoPopupMenu(wxMenu*, int, int) ()
   from /usr/lib/libwx_gtk2u_core-2.8.so.0
#37 0x0000000000655752 in frmMain::doPopup(wxWindow*, wxPoint, pgObject*) ()
#38 0x0000000000655ad4 in frmMain::OnSelRightClick(wxTreeEvent&) ()
#39 0x00007ffff6014fec in 
wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&, 
wxEvtHandler*, wxEvent&) () from /usr/lib/libwx_baseu-2.8.so.0
#40 0x00007ffff60150a3 in wxEventHashTable::HandleEvent(wxEvent&, 
wxEvtHandler*) ()
   from /usr/lib/libwx_baseu-2.8.so.0
#41 0x00007ffff601543b in wxEvtHandler::ProcessEvent(wxEvent&) () from 
/usr/lib/libwx_baseu-2.8.so.0
#42 0x00007ffff60153b0 in wxEvtHandler::ProcessEvent(wxEvent&) () from 
/usr/lib/libwx_baseu-2.8.so.0
#43 0x00007ffff69bded9 in wxWindowBase::TryParent(wxEvent&) () from 
/usr/lib/libwx_gtk2u_core-2.8.so.0
#44 0x00007ffff60153b0 in wxEvtHandler::ProcessEvent(wxEvent&) () from 
/usr/lib/libwx_baseu-2.8.so.0
#45 0x00007ffff6a01f86 in wxScrollHelperEvtHandler::ProcessEvent(wxEvent&) ()
   from /usr/lib/libwx_gtk2u_core-2.8.so.0
#46 0x00007ffff6a164dd in wxGenericTreeCtrl::OnMouse(wxMouseEvent&) ()
   from /usr/lib/libwx_gtk2u_core-2.8.so.0
#47 0x00007ffff6014fec in 
wxEvtHandler::ProcessEventIfMatches(wxEventTableEntryBase const&, 
wxEvtHandler*, wxEvent&) () from /usr/lib/libwx_baseu-2.8.so.0
#48 0x00007ffff60150a3 in wxEventHashTable::HandleEvent(wxEvent&, 
wxEvtHandler*) ()
   from /usr/lib/libwx_baseu-2.8.so.0
#49 0x00007ffff601543b in wxEvtHandler::ProcessEvent(wxEvent&) () from 
/usr/lib/libwx_baseu-2.8.so.0
#50 0x00007ffff60153b0 in wxEvtHandler::ProcessEvent(wxEvent&) () from 
/usr/lib/libwx_baseu-2.8.so.0
#51 0x00007ffff6a01f86 in wxScrollHelperEvtHandler::ProcessEvent(wxEvent&) ()
   from /usr/lib/libwx_gtk2u_core-2.8.so.0
#52 0x00007ffff68cda0f in ?? () from /usr/lib/libwx_gtk2u_core-2.8.so.0
#53 0x00007ffff336690f in ?? () from /usr/lib/libgtk-x11-2.0.so.0
#54 0x00007ffff2d3e2d5 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#55 0x00007ffff2d5000c in ?? () from /usr/lib/libgobject-2.0.so.0
#56 0x00007ffff2d58175 in g_signal_emit_valist () from 
/usr/lib/libgobject-2.0.so.0
#57 0x00007ffff2d588cf in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#58 0x00007ffff347db9c in ?? () from /usr/lib/libgtk-x11-2.0.so.0
#59 0x00007ffff3365054 in gtk_propagate_event () from 
/usr/lib/libgtk-x11-2.0.so.0
#60 0x00007ffff33654eb in gtk_main_do_event () from /usr/lib/libgtk-x11-2.0.so.0
#61 0x00007ffff2fda2cc in ?? () from /usr/lib/libgdk-x11-2.0.so.0
#62 0x00007ffff28439fd in g_main_context_dispatch () from 
/usr/lib/libglib-2.0.so.0
#63 0x00007ffff2843ce0 in ?? () from /usr/lib/libglib-2.0.so.0
#64 0x00007ffff2844002 in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
#65 0x00007ffff3364467 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
#66 0x00007ffff68b598a in wxEventLoop::Run() () from 
/usr/lib/libwx_gtk2u_core-2.8.so.0
#67 0x00007ffff693fc7b in wxAppBase::MainLoop() () from 
/usr/lib/libwx_gtk2u_core-2.8.so.0
#68 0x00007ffff5fba2ca in wxEntry(int&, wchar_t**) () from 
/usr/lib/libwx_baseu-2.8.so.0
#69 0x0000000000444812 in main ()
-- 
Sent via pgadmin-support mailing list (pgadmin-support@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-support

Reply via email to