Repaint lockup in ctlSQLBox::OnPositionStc on windows (Was: SQL-panel causes 100% CPU and lockup on windows)

От: Nikolai Zhubr
Тема: Repaint lockup in ctlSQLBox::OnPositionStc on windows (Was: SQL-panel causes 100% CPU and lockup on windows)
Дата: ,
Msg-id: 561024FB.9000805@yandex.ru
(см: обсуждение, исходный текст)
Ответ на: Re: SQL-panel causes 100% CPU and lockup on windows (Was Stability and compatability issues on windows xp)  (Nikolai Zhubr)
Ответы: Re: Repaint lockup in ctlSQLBox::OnPositionStc on windows (Was: SQL-panel causes 100% CPU and lockup on windows)  (Nikolai Zhubr)
Список: pgadmin-support


Hi all,

Ok, I've verified that ctlSQLBox::OnPositionStc() is broken.

If I comment the code for highlighting in it (that is, almost all of its 
body), the problem goes away.

I've found quite some problems observed with it and attempted to fix 
previously, like e.g. the one from 2011:
---------------
+   // Ensure we don't recurse through any paint handlers
+   Freeze();    UpdateLineNumber();
+   Thaw();
    // Clear all highlighting
---------------
That was most probably only a partial fix, and it was subsequently reverted.

I'd like to also note that 'OnPositionStc' name is pretty much 
misleading. If it was named 'OnPaintedStc' it would be more consistent 
and more hinting where the problem is. I'm aware that renaming alone 
don't usually fix bugs, but it might help humans better catch ones.

Ok, anyway, I've got no real fix for now, but I'm going on.


Thank you,
Nikolai


29.09.2015 21:40, I wrote:
> Hi,
> 29.09.2015 1:17, I wrote:
> [...]
>> Here is how to reproduce. (Procedure valid at least for win xp and 7)
>> In under 1 minute!
>
> Some more observations. Same problem happens also in function properties
> window, in the 'Code' tab:
>
> - choose some simple (lets say empty) function, open its properties;
> - click on the 'Code' tab;
> - place this properties window so that its righthand margin is somewhat
> beyond the right margin of the monitor, making some part of SQL editor
> invisible (out of the real screen space);
> - click to place cursor into the function body and type 'select now()';
> - watch the CPU load.
>
> So it looks like ctlSQLBox instances are affected, although ctlSQLBox
> itself seems quite harmless (looking at the code), except for maybe
> ctlSQLBox::OnPositionStc() about which I've just no idea. And since
> ctlSQLBox is a direct descendant of a wx class, it looks like maybe it
> is actually wxwin to blame.
> So my theory is:
> -- either ctlSQLBox::OnPositionStc() itself,
> -- or the underlying wx class (classes).
>
> I haven't arranged a development environment yet, but am going to.
>
>
> Thank you,
> Nikolai
>
>> - Aero have to be disabled (on versions that have it). If you can not or
>> do not want to disable aero for some reason, you might try connecting
>> via remote desktop instead, it should basically behave very similar,
>> I've tested it as well.
>> - start windows task manager and minimize it so it just shows CPU load
>> within a tray icon. (taskmgr.exe)
>> - start pgamin as usual, connect to some server, then click on some
>> database, so that SQL-panel button becomes available.
>> - open SQL-panel (click the above mentioned button), then move SQL-panel
>> window in the righthand direction till some part of SQL-editor window
>> rectangle goes beyond the right border of the screen. Let is stay like
>> that (partly invisible). Note that I mean exactly SQL-editor window
>> itself, not additional notepad window that might happen to be located to
>> the right of SQL-editor. (Or you can just close this notepad to be sure)
>> - now click into SQL-editor so that you can start typing.
>> - type just exactly this: 'select now()' then stop, do not touch
>> anything and watch the CPU load. it should go 100% (50% on dual core,
>> 25% on quad core) and stick there.
>> - note: it is critical to put brackets there, otherwise bug is not
>> triggered, so I'd guess this is related to code highlighting.
>> - now go to SQL-panel's main menu - select file - select exit. instead
>> of closing, SQL-panel goes completely unresponsive here.
>>
>> I'd be glad to hear some feedback (from windows users) :)
>>
>>
>> Thank you,
>> Nikolai
>>
>>>
>>>
>>> Thank you,
>>> Nikolai
>>
>>
>>
>
>
>





В списке pgadmin-support по дате сообщения:

От: Nikolai Zhubr
Дата:
Сообщение: Re: Repaint lockup in ctlSQLBox::OnPositionStc on windows (Was: SQL-panel causes 100% CPU and lockup on windows)
От: Christoph Berg
Дата:
Сообщение: Bug#797804: pgadmin3 segfaults after rightclick (fwd)