Обсуждение: pgadmin3 segfaults on leaving context menu
Hello all, pgAdmin consistently crashes with a segmentation fault for me after leaving the right-click menu in the object browser. Either selecting an option or clicking elsewhere to close it will cause a crash. pgAdmin version: 1.20.0 wxgtk version: 2.8.12.1-2 gtk2 version: 2.24.27-1 OS: Arch Linux 3.19.3-3-ARCH Both the OS-provided package and a self-compiled binary exhibit the same behaviour. I apologize if this issue has already been reported/fixed - there were a few threads in the archive that looked similar, but I don't know enough about pgAdmin to know if they're the same problem. I hope this helps. Keep up the good work. Kind regards, Wander Nauta
Вложения
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
Вложения
Ashesh; can you look at this please? Thanks. On Sun, Apr 19, 2015 at 3:44 PM, Wander Nauta <info@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
Hi Wander Nauta,
Can you please test the attached patch?
On Mon, Apr 20, 2015 at 1:21 PM, Dave Page <dpage@pgadmin.org> wrote:
Ashesh; can you look at this please?
Thanks.> --
On Sun, Apr 19, 2015 at 3:44 PM, Wander Nauta <info@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
Вложения
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.vashi@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 <dpage@pgadmin.org> wrote: >> >> Ashesh; can you look at this please? >> >> Thanks. >> >> On Sun, Apr 19, 2015 at 3:44 PM, Wander Nauta <info@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 > >
Вложения
On Mon, Apr 20, 2015 at 5:24 PM, Wander Nauta <info@wandernauta.nl> wrote:
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.
Yeah - you're right.
I've checked-in your patch with comment changes.
Thanks for the patch.
Regards,
Wander
On Mon, Apr 20, 2015 at 11:21 AM, Ashesh Vashi
<ashesh.vashi@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 <dpage@pgadmin.org> wrote:
>>
>> Ashesh; can you look at this please?
>>
>> Thanks.
>>
>> On Sun, Apr 19, 2015 at 3:44 PM, Wander Nauta <info@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
>
>
Hello Ashesh,
Works great! Thank you taking the time to look at this.
Regards,
Wander
On Wed, Apr 22, 2015 at 10:56 AM, Ashesh Vashi <ashesh.vashi@enterprisedb.com> wrote:
On Mon, Apr 20, 2015 at 5:24 PM, Wander Nauta <info@wandernauta.nl> wrote: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.Yeah - you're right.I've checked-in your patch with comment changes.Thanks for the patch.--
Thanks & Regards,
Ashesh Vashi
EnterpriseDB INDIA: Enterprise PostgreSQL Company
Regards,
Wander
On Mon, Apr 20, 2015 at 11:21 AM, Ashesh Vashi
<ashesh.vashi@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 <dpage@pgadmin.org> wrote:
>>
>> Ashesh; can you look at this please?
>>
>> Thanks.
>>
>> On Sun, Apr 19, 2015 at 3:44 PM, Wander Nauta <info@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
>
>