Re: pgadmin3 segfaults on leaving context menu

From: Wander Nauta <info(at)wandernauta(dot)nl>
To: Ashesh Vashi <ashesh(dot)vashi(at)enterprisedb(dot)com>
Cc: Dave Page <dpage(at)pgadmin(dot)org>, pgAdmin Support <pgadmin-support(at)postgresql(dot)org>
Subject: Re: pgadmin3 segfaults on leaving context menu
Date: 2015-04-20 11:54:23
Message-ID: CAPrNmkMrT09cYb0wVeE2H+jGgitHpmK_YK_dYtSoJzmj+_Px8A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support

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(dot)vashi(at)enterprisedb(dot)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 <dpage(at)pgadmin(dot)org> wrote:
>>
>> Ashesh; can you look at this please?
>>
>> Thanks.
>>
>> On Sun, Apr 19, 2015 at 3:44 PM, Wander Nauta <info(at)wandernauta(dot)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(at)postgresql(dot)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
>
>

Attachment Content-Type Size
gdb.txt text/plain 6.0 KB

In response to

Responses

Browse pgadmin-support by date

  From Date Subject
Next Message Алексей Лутовинин 2015-04-20 14:45:11 Incorrect display type of the function result
Previous Message Ashesh Vashi 2015-04-20 09:21:56 Re: pgadmin3 segfaults on leaving context menu