Closed
Bug 759417
Opened 13 years ago
Closed 13 years ago
MapsMemoryReporter asserts with device #s > 100
Categories
(Core :: XPCOM, defect)
Tracking
()
RESOLVED
FIXED
mozilla15
People
(Reporter: froydnj, Assigned: froydnj)
Details
Attachments
(1 file, 1 obsolete file)
1.95 KB,
patch
|
justin.lebar+bug
:
review+
|
Details | Diff | Splinter Review |
My xpcshell test runs are failing locally with the error:
###!!! ASSERTION: Didn't create a vsize node?: 'categoriesSeen.mSeenVsize', file /home/froydnj/src/m-c.git/xpcom/base/MapsMemoryReporter.cpp, line 237
Poking around with GDB reveals that /proc/self/smaps has an unusual header:
00400000-0044e000 r-xp 00000000 103:00 27190725 <other stuff that FILE's members didn't have>
Note the 3-digit major device number, which MapsMemoryReporter is unprepared to handle.
Apparently it's not terribly uncommon:
@nightcrawler:/opt/build/m-c-git-build$ egrep -c '[0-9]{3}:' /proc/*/maps 2>/dev/null | cut -f 2 -d ':' | addup
111
out of some 4k+ map entries. This an Ubuntu 11.04 box.
The attached patch appears to solve the problem (only gets xpcshell running properly, haven't looked at about:memory or anything). The *scanf %[ construct scans a range of characters until the field width is hit or a character not in the range is found. I chose to keep a field width for safety's sake; perhaps there are four-digit device numbers lurking somewhere...
Attachment #628025 -
Flags: review?(n.nethercote)
Comment 1•13 years ago
|
||
Comment on attachment 628025 [details] [diff] [review]
patch to handle 3-digit device numbers
r=me.
Do we have any reason to believe 3 digits is the right length? 2 digits was a complete guess...
Attachment #628025 -
Flags: review?(n.nethercote) → review+
![]() |
||
Comment 2•13 years ago
|
||
Wait! The numbers are hex, not decimal. From the example in "man 5 proc":
08048000-08056000 r-xp 00000000 03:0c 64593 /usr/sbin/gpm
Please fix that! And the example uses lower-case letters but I'd use [0-9A-Fa-f] as the pattern just to be safe.
I looked at Valgrind's code for parsing these files. It just looks for an arbitrary length hex number. How about we allow 4 or even 5 digits, just in case?
![]() |
Assignee | |
Comment 3•13 years ago
|
||
(In reply to Nicholas Nethercote [:njn] from comment #2)
> Wait! The numbers are hex, not decimal. From the example in "man 5 proc":
Aha! That squares with what I see; the major device number of my raid array is 259.
> Please fix that! And the example uses lower-case letters but I'd use
> [0-9A-Fa-f] as the pattern just to be safe.
Will do.
> I looked at Valgrind's code for parsing these files. It just looks for an
> arbitrary length hex number. How about we allow 4 or even 5 digits, just in
> case?
_Linux Device Drivers_ indicates that the 2.6 kernel allocates 12 bits to the major device number and 20 bits to the minor device number, so I'll use that as a guideline for field widths.
Comment 4•13 years ago
|
||
> Wait!
I guess I shouldn't review patches during MemShrink meetings, huh?
Updated•13 years ago
|
Attachment #628025 -
Flags: review+ → review-
![]() |
Assignee | |
Comment 5•13 years ago
|
||
New patch!
Attachment #628025 -
Attachment is obsolete: true
Attachment #628420 -
Flags: review?(justin.lebar+bug)
Comment 6•13 years ago
|
||
Comment on attachment 628420 [details] [diff] [review]
revised patch
I'd be OK if you wanted to make these |char dev[32]| just so we don't have to worry about relying on an internal kernel data structure -- we don't even use the dev major/minor values for anything in about:memory. But I'm happy to do this too.
Attachment #628420 -
Flags: review?(justin.lebar+bug) → review+
![]() |
Assignee | |
Comment 7•13 years ago
|
||
(In reply to Justin Lebar [:jlebar] from comment #6)
> I'd be OK if you wanted to make these |char dev[32]| just so we don't have
> to worry about relying on an internal kernel data structure -- we don't even
> use the dev major/minor values for anything in about:memory. But I'm happy
> to do this too.
More conservative values would be good. I'll just use |char dev[17]|; 64 bits should be enough for anybody.
![]() |
Assignee | |
Comment 8•13 years ago
|
||
Assignee: nobody → nfroyd
Status: NEW → ASSIGNED
Hardware: x86_64 → All
Comment 9•13 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla15
You need to log in
before you can comment on or make changes to this bug.
Description
•