Closed Bug 432894 Opened 16 years ago Closed 16 years ago

X related valgrind | jemalloc - startup errors

Categories

(Core :: Memory Allocator, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: bc, Unassigned)

Details

(Keywords: valgrind)

Attachments

(3 files, 1 obsolete file)

Attached file stderr+valgrind log
There are several Invalid writes in X during startup with a fresh profile on Linux with jemalloc enabled. These do not appear in normal malloc builds.

To reproduce:

build with the mozconfig options:

--enable-jemalloc
--with-valgrind

open and close firefox.

Not sure how we handle these upstream issues.
Were you running with --sync ?  You need to to get useful stacks for these.

As far as the warnings about write() with uninitialized data:  I got some fixes for using uninitialized memory upstreamed into GDK and libX11 not too long ago -- it could be that you have a version without those fixes, although I think they are in the newest Linux distro versions.

http://bugzilla.gnome.org/show_bug.cgi?id=349382
http://bugzilla.gnome.org/show_bug.cgi?id=349385
https://bugs.freedesktop.org/show_bug.cgi?id=7703
https://bugs.freedesktop.org/show_bug.cgi?id=7713
Also, you'll get much more useful stacks inside the system libraries if you install the necessary debug packages.  (For Ubuntu, they're *-dbg packages; for Fedora, they're *-debuginfo packages and you have to enable the debuginfo repository.  I can give you significantly more detailed instructions for either.)
There is a write error in the valgrind log that looks like it may be caused by a bug in one of jemalloc's valgrind macro calls.  The attached patch adds missing parentheses.
(In reply to comment #1)
> Were you running with --sync ?  You need to to get useful stacks for these.
> 

No. Is that an argument to valgrind or firefox? I'm using the default valgrind at the moment on CentOS5 and a custom build 3.2.3 on Fedora 6.

> As far as the warnings about write() with uninitialized data:  I got some fixes
> for using uninitialized memory upstreamed into GDK and libX11 not too long ago
> -- it could be that you have a version without those fixes, although I think
> they are in the newest Linux distro versions.

I got similar results for CentOS5 x86_64 (which is kind of old) and Fedora 6 (which is really old). I have Fedora 8 available and should go ahead and create another VM from a newer distro.  In the past, I've had bad experiences with building Firefox with newer distros. Which would you recommend?

> 
> http://bugzilla.gnome.org/show_bug.cgi?id=349382
> http://bugzilla.gnome.org/show_bug.cgi?id=349385
> https://bugs.freedesktop.org/show_bug.cgi?id=7703
> https://bugs.freedesktop.org/show_bug.cgi?id=7713
> 

(In reply to comment #2)
> Also, you'll get much more useful stacks inside the system libraries if you
> install the necessary debug packages.  (For Ubuntu, they're *-dbg packages; for
> Fedora, they're *-debuginfo packages and you have to enable the debuginfo
> repository.  I can give you significantly more detailed instructions for
> either.)
> 

I've done that for Fedora at least in the past. I recently tried to get good debuginfo packages for Centos5 x86_64 and had some trouble getting current packages or packages that were properly signed. I could use some help there.

(In reply to comment #4)
> (In reply to comment #1)
> > Were you running with --sync ?  You need to to get useful stacks for these.
> > 
> 

found it. Firefox option: --sync Make X calls synchronous

Is that something I should do in general or just for valgrind testing?
It's something you should do whenever you're debugging something X-related that requires stack traces.  Otherwise X calls will buffer up things to do so your stack trace will be for some later X call that needs to flush the buffer.


The way I've gotten debuginfo packages on Fedora (not sure how different CentOS is) is to enable the debuginfo repository (I just edit /etc/yum.repos.d/fedora.repo and fedora-updates.repo, although there's probably a better way to do it -- although you want to do it in a way that you'll get debuginfo updates when you get package updates) and the install the debuginfo RPMs.  The ones I have installed for Mozilla debugging are in bug 384035 comment 10 and bug 304035 comment 12.  Once you edit the files in yum.repos.d you can just "yum install foo-debuginfo bar-debuginfo foo2-debuginfo ...".
Comment on attachment 320066 [details] [diff] [review]
Fix valgrind-related bug in jemalloc

Does this patch, plus the patch in bug 431743, fix the X errors?  If not, I will create a separate bug to track this patch.
Attachment #320066 - Flags: review?(bclary)
(In reply to comment #7)
> (From update of attachment 320066 [details] [diff] [review])
> Does this patch, plus the patch in bug 431743, fix the X errors?  If not, I
> will create a separate bug to track this patch.
> 

Tested on mozilla-central. (attachment 320066 [details] [diff] [review] doesn't apply to 1.9.0)

Its a bit better but there are still a few invalid writes of 1 byte
This updated patch should fix the remaining errors shown in attachment 324488 [details].
Attachment #320066 - Attachment is obsolete: true
Attachment #324496 - Flags: review?(bclary)
Attachment #320066 - Flags: review?(bclary)
Comment on attachment 324496 [details] [diff] [review]
Fix valgrind-related bugs in jemalloc (v2)

no Invalid writes with this patch during startup/shutdown. r+ for that, but someone else should do the code review as I'm not qualified.
Attachment #324496 - Flags: review?(bclary) → review+
Attachment #324496 - Flags: review?(benjamin)
Attachment #324496 - Flags: review?(benjamin) → review+
changeset:   15457:082914aa4372
user:        Jason Evans <jasone@canonware.com>
date:        Fri Jun 20 10:34:41 2008 -0700
summary:     Bug 432894: X related valgrind | jemalloc - startup errors, r=bclary,r=benjamin
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Group: core-security
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: