Thread: Bug in SQL editor find and replace
If from the SQL editor I click edit->find and replace, complete a text string to find and a text string to replace it with, then click Replace All pgAdmin3 freezes, consuming 100% cpu usage of one of my cpu cores until I kill the process. Replace each occurence singly works, but replace all freezes. It looks like it's repeatedly looping over the whole file? Pgadmin version 1.8.4 Ubuntu Linux 8.10 64 bit (I also had this problem with 8.04) Many thanks, Steve Roberts
Hi All: Sorry for resurrecting this bug [1], but it's been annoying me now for a few weeks (since I switched my main desktop at work from winxp to ubuntu 9.04). Symptoms: open a query editor to an 8.3 database (SSL enabled, not sure if that matters). Paste some text inside and try to find/replace all any item (not changing any options). Result: CPU gets pegged until the process is terminated. (BTW, why does terminating a query editor take down *every other* pgadmin3 window?) I tried building 1.10.0 rc1, but couldn't on stock Ubuntu 9.04 (with all -dev packages, etc). I had to download wxGTK manually and build it to get 1.10.0rc1 to build. Unfortunately, it displays the exact same problem. FWIW, I did not have this problem on my WinXP box. I have no idea how to debug this, but maybe some of the stuff at the end might help. David http://archives.postgresql.org/message-id/937d27e10811040140h3ad50294i78de915eea0810c1@mail.gmail.com $ gdb /usr/local/bin/pgadmin3 GNU gdb 6.8-debian Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu"... (gdb) (gdb) run Starting program: /usr/local/bin/pgadmin3 [Thread debugging using libthread_db enabled] [New Thread 0x7fc5eff31800 (LWP 8606)] I: caps.c: Limited capabilities successfully to CAP_SYS_NICE. I: caps.c: Dropping root privileges. I: caps.c: Limited capabilities successfully to CAP_SYS_NICE. [New Thread 0x7fc5e00fc950 (LWP 9072)] [Thread 0x7fc5e00fc950 (LWP 9072) exited] [New Thread 0x7fc5e00fc950 (LWP 9408)] [Thread 0x7fc5e00fc950 (LWP 9408) exited] ^C Program received signal SIGINT, Interrupt. [Switching to Thread 0x7fc5eff31800 (LWP 8606)] 0x00007fc5ea6f204d in ?? () from /usr/lib/libpangoft2-1.0.so.0 Here's the full backtrace: #0 0x00007f105d24f26c in ?? () from /usr/lib/libgobject-2.0.so.0 #1 0x00007f105c990e1f in g_hash_table_lookup () from /usr/lib/libglib-2.0.so.0 #2 0x00007f105d24f903 in ?? () from /usr/lib/libgobject-2.0.so.0 #3 0x00007f105d24fbd1 in g_param_spec_pool_lookup () from /usr/lib/libgobject-2.0.so.0 #4 0x00007f105e950b29 in IA__gtk_widget_style_get_valist (widget=0x2b1a170, first_property_name=0x0, var_args=0x7fff6b8ba080) at /build/buildd/gtk+2.0-2.16.1/gtk/gtkwidget.c:9094 #5 0x00007f105e950e24 in IA__gtk_widget_style_get (widget=0x2b1a170, first_property_name=0x7f105ea62b44 "slider-width") at /build/buildd/gtk+2.0-2.16.1/gtk/gtkwidget.c:9146 #6 0x00007f105e87e05d in gtk_range_get_props (range=0x7fff6b8b9ef0, slider_width=0x7fff6b8ba29c, stepper_size=0x7fff6b8ba298, focus_width=0x7fff6b8ba294, trough_border=0x7fff6b8ba290, stepper_spacing=0x7fff6b8ba28c, trough_under_steppers=0x0, arrow_displacement_x=0x0, arrow_displacement_y=0x0) at /build/buildd/gtk+2.0-2.16.1/gtk/gtkrange.c:2704 #7 0x00007f105e87e1c5 in gtk_range_size_request (widget=0x7fff6b8b9ef0, requisition=0x7fff6b8ba2c0) at /build/buildd/gtk+2.0-2.16.1/gtk/gtkrange.c:1248 #8 0x00007f1061a3175c in GetScrollbarWidth (widget=<value optimized out>, w=@0x7fff6b8ba314, h=@0x7fff6b8ba310) at ../src/gtk/window.cpp:338 #9 0x00007f1061a318cf in wxWindow::DoGetClientSize (this=0x2b22a00, width=0x7fff6b8ba37c, height=0x7fff6b8ba378) at ../src/gtk/window.cpp:2961 #10 0x00007f106312f1d4 in Window::GetClientPosition (this=<value optimized out>) at ../../../../include/wx/window.h:294 #11 0x00007f10631506ed in Editor::GetClientRectangle (this=<value optimized out>) at ../../../../contrib/src/stc/scintilla/src/Editor.cxx:508 #12 0x00007f106314b57e in Editor::GetTextRectangle (this=0x7fff6b8b9ef0) at ../../../../contrib/src/stc/scintilla/src/Editor.cxx:512 #13 0x00007f106314f9a8 in Editor::RectangleFromRange (this=0x2b269a0, start=<value optimized out>, end=935) at ../../../../contrib/src/stc/scintilla/src/Editor.cxx:926 #14 0x00007f106315040d in Editor::InvalidateRange (this=0x7fff6b8b9ef0, start=1587948346, end=117) at ../../../../contrib/src/stc/scintilla/src/Editor.cxx:942 #15 0x00007f1063158085 in Editor::SetSelection (this=0x2b269a0, currentPos_=934, anchor_=13) at ../../../../contrib/src/stc/scintilla/src/Editor.cxx:991 #16 0x00007f106315c9c8 in Editor::WndProc (this=0x2b269a0, iMessage=<value optimized out>, wParam=934, lParam=0) at ../../../../contrib/src/stc/scintilla/src/Editor.cxx:6114 #17 0x00007f10631da26e in ScintillaBase::WndProc (this=0x2b269a0, iMessage=1587948346, wParam=934, lParam=0) at ../../../../contrib/src/stc/scintilla/src/ScintillaBase.cxx:724 #18 0x00007f1063134e9f in ScintillaWX::WndProc (this=0x2b269a0, iMessage=1587948346, wParam=117, lParam=0) at ../../../../contrib/src/stc/ScintillaWX.cpp:737 #19 0x000000000048456b in ctlSQLBox::DoFind (this=0x2b22a00, find=@0x7fff6b8ba860, replace=@0x7fff6b8ba850, doReplace=true, wholeWord=false, matchCase=false, useRegexps=false, startAtTop=false, reverse=false) at ./ctl/ctlSQLBox.cpp:307 #20 0x0000000000484683 in ctlSQLBox::ReplaceAll (this=0x2b22a00, find=@0x7fff6b8ba860, replace=@0x7fff6b8ba850, wholeWord=false, matchCase=false, useRegexps=false) at ./ctl/ctlSQLBox.cpp:189 #21 0x00000000004ffcbd in dlgFindReplace::OnReplaceAll (this=0x29add00, ev=@0x7fff6b8ba990) at ./dlg/dlgFindReplace.cpp:277 #22 0x00007f106116a579 in wxEvtHandler::ProcessEventIfMatches (entry=<value optimized out>, handler=0x7f105ea62b3a, event=@0x7fff6b8ba990) at ../src/common/event.cpp:1231 #23 0x00007f106116bb67 in wxEventHashTable::HandleEvent (this=<value optimized out>, event=@0x7fff6b8ba990, self=0x29add00) at ../src/common/event.cpp:906 #24 0x00007f106116bca9 in wxEvtHandler::ProcessEvent (this=0x29add00, event=@0x7fff6b8ba990) at ../src/common/event.cpp:1293 #25 0x00007f1061b3b98b in wxWindowBase::TryParent (this=<value optimized out>, event=@0x7fff6b8ba990) at ../src/common/wincmn.cpp:2661 #26 0x00007f1061a6ec49 in gtk_button_clicked_callback (button=0x2d8a400) at ../src/gtk/button.cpp:53 #27 0x00007f105d24827d in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0 #28 0x00007f105d25e3bc in ?? () from /usr/lib/libgobject-2.0.so.0 #29 0x00007f105d25f432 in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0 #30 0x00007f105d25f953 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0 #31 0x00007f105e79c7dd in gtk_real_button_released (button=0x7fff6b8b9ef0) at /build/buildd/gtk+2.0-2.16.1/gtk/gtkbutton.c:1702 #32 0x00007f105d24827d in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0 #33 0x00007f105d25d723 in ?? () from /usr/lib/libgobject-2.0.so.0 #34 0x00007f105d25f432 in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0 #35 0x00007f105d25f953 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0 #36 0x00007f105e79b46d in gtk_button_button_release (widget=0x7fff6b8b9ef0, event=0x7f105ea62b3a) at /build/buildd/gtk+2.0-2.16.1/gtk/gtkbutton.c:1594 #37 0x00007f105e846df8 in _gtk_marshal_BOOLEAN__BOXED (closure=0x1ed19a0, return_value=0x7fff6b8bb3f0, n_param_values=<value optimized out>, param_values=0x2deeec0, invocation_hint=<value optimized out>, marshal_data=0x7f105e79b450) at /build/buildd/gtk+2.0-2.16.1/gtk/gtkmarshalers.c:84 #38 0x00007f105d24827d in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0 #39 0x00007f105d25db1e in ?? () from /usr/lib/libgobject-2.0.so.0 #40 0x00007f105d25f2bd in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0 #41 0x00007f105d25f953 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0 #42 0x00007f105e94f09e in gtk_widget_event_internal (widget=0x2c8d190, event=0x2d82170) at /build/buildd/gtk+2.0-2.16.1/gtk/gtkwidget.c:4761 #43 0x00007f105e83f693 in IA__gtk_propagate_event (widget=0x2c8d190, event=0x2d82170) at /build/buildd/gtk+2.0-2.16.1/gtk/gtkmain.c:2396 #44 0x00007f105e8407b3 in IA__gtk_main_do_event (event=0x2d82170) at /build/buildd/gtk+2.0-2.16.1/gtk/gtkmain.c:1601 #45 0x00007f105e4b9f3c in gdk_event_dispatch (source=<value optimized out>, callback=<value optimized out>, user_data=<value optimized out>) at /build/buildd/gtk+2.0-2.16.1/gdk/x11/gdkevents-x11.c:2364 #46 0x00007f105c99f20a in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0 #47 0x00007f105c9a28e0 in ?? () from /usr/lib/libglib-2.0.so.0 #48 0x00007f105c9a2dad in g_main_loop_run () from /usr/lib/libglib-2.0.so.0 #49 0x00007f105e840bc7 in IA__gtk_main () at /build/buildd/gtk+2.0-2.16.1/gtk/gtkmain.c:1205 #50 0x00007f1061a1f2a8 in wxEventLoop::Run (this=0x1ef6e10) at ../src/gtk/evtloop.cpp:76 #51 0x00007f1061ab3438 in wxAppBase::MainLoop (this=0x1e46c00) at ../src/common/appcmn.cpp:312 #52 0x00007f1061101ccd in wxEntry (argc=<value optimized out>, argv=<value optimized out>) at ../src/common/init.cpp:460 #53 0x0000000000457e02 in main (argc=1, argv=0x7fff6b8bba68) at ./pgAdmin3.cpp:113
On Tue, Jun 23, 2009 at 10:58 AM, David Blewett<david@dawninglight.net> wrote: > I have no idea how to debug this, but maybe some of the stuff at the > end might help. In helping me debug this, Andres Freund hit the same bug on the Karmic Koala Ubuntu beta. David
On 06/23/2009 06:02 PM, David Blewett wrote: > On Tue, Jun 23, 2009 at 10:58 AM, David Blewett<david@dawninglight.net> wrote: >> I have no idea how to debug this, but maybe some of the stuff at the >> end might help. > In helping me debug this, Andres Freund hit the same bug on the Karmic > Koala Ubuntu beta. I could reproduce it with ubuntu's 1.8.4 and with a self-compiled trunk r7940. Andres
<tt>Hi Andres,<br /><br /> I am not able to reproduce it on my end.<br /><br /> The </tt><tt>following details</tt><tt> mayhelp me reproduce on my end:<br /> 1. Is it 32 bit/64 bit linux?<br /> 2. What exactly are you using in Find & Replacetext-controls?<br /><br /> Andres Freund wrote:</tt><blockquote cite="mid:4A40FEA0.1010500@anarazel.de" type="cite"><tt>On06/23/2009 06:02 PM, David Blewett wrote: <br /></tt><blockquote type="cite"><tt>On Tue, Jun 23, 2009 at10:58 AM, David Blewett<a class="moz-txt-link-rfc2396E" href="mailto:david@dawninglight.net"><david@dawninglight.net></a> wrote: <br /></tt><blockquote type="cite"><tt>I haveno idea how to debug this, but maybe some of the stuff at the <br /> end might help. <br /></tt></blockquote><tt>In helpingme debug this, Andres Freund hit the same bug on the Karmic <br /> Koala Ubuntu beta. <br /></tt></blockquote><tt>Icould reproduce it with ubuntu's 1.8.4 and with a self-compiled trunk r7940. <br /><br /> Andres<br /></tt></blockquote><tt></tt><div class="moz-signature"><tt>-- <br /></tt><div class="moz-signature"><tt> <fontcolor="#666666">Thanks & Regards,<br /> Ashesh Vashi<br /><br /> EnterpriseDB INDIA: <a href="http://www.enterprisedb.com">http://www.enterprisedb.com</a></font></tt></div></div>
<tt>Hi Andres,<br /><br /> Andres Freund wrote:</tt><blockquote cite="mid:4A41082F.8000404@anarazel.de" type="cite"><tt>On06/23/2009 06:39 PM, Ashesh Vashi wrote: <br /></tt><blockquote type="cite"><tt>Hi Andres, <br /><br />I am not able to reproduce it on my end. <br /><br /> The following details may help me reproduce on my end: <br /> 1.Is it 32 bit/64 bit linux? <br /></tt></blockquote><tt>This is 64bit - I can create a 32bit chroot if you have suspicionsin that direction. <br /></tt></blockquote><tt>Can you please try to reproduce it on 32bit?<br /> Because, I triedto reproduce the same on CentOS 5.3 (32 bit)/Ubuntu 8.10/9.04 (32 bit) without any success.<br /></tt><tt><br /></tt><divclass="moz-signature"><tt>-- <br /></tt><div class="moz-signature"><tt> <font color="#666666">Thanks & Regards,<br/> Ashesh Vashi<br /><br /> EnterpriseDB INDIA: <a href="http://www.enterprisedb.com">http://www.enterprisedb.com</a></font> </tt></div></div>
On 06/23/2009 06:39 PM, Ashesh Vashi wrote: > Hi Andres, > > I am not able to reproduce it on my end. > > The following details may help me reproduce on my end: > 1. Is it 32 bit/64 bit linux? This is 64bit - I can create a 32bit chroot if you have suspicions in that direction. > 2. What exactly are you using in Find & Replace text-controls? "Whole Word" and "Match Case", "Regular Expressions" are not checked. Some string in "Find what" and "Replace with". Then I press "Replace All". Boom. Any further steps? Andres
On 06/23/2009 06:59 PM, Ashesh Vashi wrote: > Hi Andres, > > Andres Freund wrote: >> On 06/23/2009 06:39 PM, Ashesh Vashi wrote: >>> Hi Andres, >>> >>> I am not able to reproduce it on my end. >>> >>> The following details may help me reproduce on my end: >>> 1. Is it 32 bit/64 bit linux? >> This is 64bit - I can create a 32bit chroot if you have suspicions in >> that direction. > Can you please try to reproduce it on 32bit? > Because, I tried to reproduce the same on CentOS 5.3 (32 bit)/Ubuntu > 8.10/9.04 (32 bit) without any success. Ugh. I cant reproduce it on a 32 bit chroot so far. If I find the time (have to work for a bit ;-)) I will setup a 64bit chroot to insure that its really the only difference. Andres
On 06/23/2009 06:59 PM, Ashesh Vashi wrote: > Andres Freund wrote: >> On 06/23/2009 06:39 PM, Ashesh Vashi wrote: >>> Hi Andres, >>> >>> I am not able to reproduce it on my end. >>> >>> The following details may help me reproduce on my end: >>> 1. Is it 32 bit/64 bit linux? >> This is 64bit - I can create a 32bit chroot if you have suspicions in >> that direction. > Can you please try to reproduce it on 32bit? > Because, I tried to reproduce the same on CentOS 5.3 (32 bit)/Ubuntu > 8.10/9.04 (32 bit) without any success. I found the issue. The code compares '(unsigned int)(-1)' with '(size_t)(-1)' which works on 32bit but not on 64bit. Andres
Attachment
On Tue, Jun 23, 2009 at 3:23 PM, Andres Freund<andres@anarazel.de> wrote: > I found the issue. The code compares '(unsigned int)(-1)' with > '(size_t)(-1)' which works on 32bit but not on 64bit. The patch fixes the issue on my end. David Blewett
On Tue, Jun 23, 2009 at 8:23 PM, Andres Freund<andres@anarazel.de> wrote: > I found the issue. The code compares '(unsigned int)(-1)' with > '(size_t)(-1)' which works on 32bit but not on 64bit. > Thanks Andres - patch applied. -- Dave Page EnterpriseDB UK: http://www.enterprisedb.com
On Wed, Jun 24, 2009 at 10:07 AM, Andres Freund<andres@anarazel.de> wrote: > On 06/24/2009 10:35 AM, Dave Page wrote: >> >> On Tue, Jun 23, 2009 at 8:23 PM, Andres Freund<andres@anarazel.de> wrote: >> >>> I found the issue. The code compares '(unsigned int)(-1)' with >>> '(size_t)(-1)' which works on 32bit but not on 64bit. >> >> Thanks Andres - patch applied. > > I havent read very much of the code, but at a very quick glance a short > policing for issues of this kind looks sensible - unfortunately I cant do > this in due time (I think I have spotted some more comparisons of this kind > - I am not sure how big the influence of those is though). Yeah, that certainly wouldn't hurt. If you spot anything in passing, please point it out. We're not going to get a full review done before release now anyway... -- Dave Page EnterpriseDB UK: http://www.enterprisedb.com
On 06/24/2009 10:35 AM, Dave Page wrote: > On Tue, Jun 23, 2009 at 8:23 PM, Andres Freund<andres@anarazel.de> wrote: > >> I found the issue. The code compares '(unsigned int)(-1)' with >> '(size_t)(-1)' which works on 32bit but not on 64bit. > Thanks Andres - patch applied. I havent read very much of the code, but at a very quick glance a short policing for issues of this kind looks sensible - unfortunately I cant do this in due time (I think I have spotted some more comparisons of this kind - I am not sure how big the influence of those is though). Andres
On 06/24/2009 12:13 PM, Dave Page wrote: > On Wed, Jun 24, 2009 at 11:11 AM, Andres Freund<andres@anarazel.de> wrote: > >> For some fun I tried loading a 1GB+ file and it crashed earlier >> (wxUtfFile::Read) ;-) > > You have a strange definition of 'fun' sir! I got the idea from a client trying to restore a plain pg_dump file using pgadmin... Andres PS: But actually you probably are still right.
On Wed, Jun 24, 2009 at 11:11 AM, Andres Freund<andres@anarazel.de> wrote: > For some fun I tried loading a 1GB+ file and it crashed earlier > (wxUtfFile::Read) ;-) You have a strange definition of 'fun' sir! -- Dave Page EnterpriseDB UK: http://www.enterprisedb.com
On 06/24/2009 11:12 AM, Dave Page wrote: > On Wed, Jun 24, 2009 at 10:07 AM, Andres Freund<andres@anarazel.de> wrote: >> On 06/24/2009 10:35 AM, Dave Page wrote: >>> >>> On Tue, Jun 23, 2009 at 8:23 PM, Andres Freund<andres@anarazel.de> wrote: >>> >>>> I found the issue. The code compares '(unsigned int)(-1)' with >>>> '(size_t)(-1)' which works on 32bit but not on 64bit. >>> >>> Thanks Andres - patch applied. >> >> I havent read very much of the code, but at a very quick glance a short >> policing for issues of this kind looks sensible - unfortunately I cant do >> this in due time (I think I have spotted some more comparisons of this kind >> - I am not sure how big the influence of those is though). > > Yeah, that certainly wouldn't hurt. If you spot anything in passing, > please point it out. I have only looked at the source code of ctlSQLBox - but there is a wild mixature of unsigned int (32bit, unsigned), int(32bit signed), long(64bit signed), size_t(64bit signed unsigned) datatypes which are assigned in most of the possible combinations. If I have glanced correctly nothing triggers unless somebody gets the idea to edit a 1GB+ file... But then it probably would trigger on 32bit as well. But in my experience if no special care is payed on such issues there are more bugs hiding... > We're not going to get a full review done before release now anyway... Yea, its sounds a bit too invasive to do such a cleanup before release (it very well could uncover hidden bugs beside causing new ones). Andres
On 06/24/2009 11:45 AM, Andres Freund wrote: > On 06/24/2009 11:12 AM, Dave Page wrote: >> On Wed, Jun 24, 2009 at 10:07 AM, Andres Freund<andres@anarazel.de> >> wrote: >>> On 06/24/2009 10:35 AM, Dave Page wrote: >>>> >>>> On Tue, Jun 23, 2009 at 8:23 PM, Andres Freund<andres@anarazel.de> >>>> wrote: >>>> >>>>> I found the issue. The code compares '(unsigned int)(-1)' with >>>>> '(size_t)(-1)' which works on 32bit but not on 64bit. >>>> >>>> Thanks Andres - patch applied. >>> >>> I havent read very much of the code, but at a very quick glance a short >>> policing for issues of this kind looks sensible - unfortunately I >>> cant do >>> this in due time (I think I have spotted some more comparisons of >>> this kind >>> - I am not sure how big the influence of those is though). >> >> Yeah, that certainly wouldn't hurt. If you spot anything in passing, >> please point it out. > I have only looked at the source code of ctlSQLBox - but there is a wild > mixature of unsigned int (32bit, unsigned), int(32bit signed), > long(64bit signed), size_t(64bit signed unsigned) datatypes which are > assigned in most of the possible combinations. > If I have glanced correctly nothing triggers unless somebody gets the > idea to edit a 1GB+ file... But then it probably would trigger on 32bit > as well. For some fun I tried loading a 1GB+ file and it crashed earlier (wxUtfFile::Read) ;-) Andres