Subject: Re: netscape7 crashes all the time
To: Jukka Marin <jmarin@embedtronics.fi>
From: Greg A. Woods <woods@weird.com>
List: port-i386
Date: 07/30/2003 15:38:25
[ On Wednesday, July 30, 2003 at 21:50:50 (+0300), Jukka Marin wrote: ]
> Subject: netscape7 crashes all the time
>
> I have installed Netscape 7.1 from pkgsrc.  When I enter some web pages,
> Netscape crashes and prints
> 
> Gdk-ERROR **: BadAlloc (insufficient resources for operation)
>   serial 14186 error_code 11 request_code 53 minor_code 0
> Gdk-ERROR **: BadDrawable (invalid Pixmap or Window parameter)
>   serial 14189 error_code 9 request_code 70 minor_code 0
> 
> I tried updateing Netscape and some suse library packages, but the
> problem is still there.

That looks very much like the same kind of error I've seen for literally
years now with all versions of Netscape, mozilla, and other Gecko based
browsers when I'm using my NCD X terminals.

The problem I see is triggered by viewing any images directly,
i.e. those not embedded in an HTML document, including with the
right-click menu "view image" selection.  The "memory use" graph on the
terminal shows it slowly running out of memory until I kill and re-start
the browser.  You may be able to see the same growth in the virtual size
of your Xserver process on any full-OS workstation.

If memory availability in the terminal does get critical then any
application can encounter an error, though of course it's usually the
browser which does so first.

I've no doubt the same problem can occur with any Xserver, but with a
real X terminal there's usually a very limited amount of physical memory
and no virtual memory to play with so the problem shows up one heck of a
lot sooner in such an environment.

So, if what you're seeing is the same then the problem has something to
do with the way the browser does something that makes the Xserver
allocate memory and not let it go until the browser disconnects from the
Xserver.

I suspect the bug is actually in the gdk-pixbuf library and/or in the
way gecko makes use of that library.  gdk-pixbuf is a rather ugly pile
of goo though and I've not dared venture in to try changing anything.

I'm also not enough of an X11 expert to try tracing the X11 calls and
see what might be causing the server to "leak" memory.  A more recent
version of gdk-pixbuf (0.17.0) seemed to help make the browsers
significantly more stable, but even reading the TODO file reveals why
people should stay far away from 0.x releases of (especially free)
software if at all possible.  I haven't tried 0.22.0 yet.

The curious thing of course is that if the image is embedded in an HTML
document then all the memory if freed properly.  This suggests to me
that gecko is missing some critical call in the cleanup part of whatever
code it uses to display a bare image.  This sort of makes sense because
if the same call were missing from whatever cleans up after a web page
is no longer displayed then the same memory would become blatantly
obvious in very short order.  This also makes sense because I think the
bug was there back when Mozilla used imlib too.  Whatever it is it seems
to happen regardless of the type of image, so it's relatively close to
the X11 side of things.

It's also not i386 specific -- the sparc mozilla has the same problem.

Can you tell if the linux Netscape-7 binary you're apparently running is
using gdk-pixbuf, and if so which version?

-- 
						Greg A. Woods

+1 416 218-0098                  VE3TCP            RoboHack <woods@robohack.ca>
Planix, Inc. <woods@planix.com>          Secrets of the Weird <woods@weird.com>