Philippe Elie wrote:
> Will Cohen wrote:
>> On some occasions I have noticed empty sample files. The documentation
>> for msync on linux says the following:
> have you a typical way to reproduce it, or it occurs from
> time to time only ?
Unfortunately, I don't have a consistent way of reproducing the problem.
I have just ocassionally noticed sample files of length zero. Honestly,
I don't know if what I suggested is guaranteed to fix the problem.
I noticed this on a sample session when starting up oprofile in
rc.sysinit with "--verbose" and shutting it down in "rc.local". It
doesn't happen everytime. Because I had "--verbose" I saw the end of
oprofile.log (the stats were right after this, no additional samples
listed in the oprofile.log):
Opening image "/lib/ld-2.3.2.so" for app "/usr/bin/oprofiled"
COOKIE_SWITCH to cookie 4279268 (/lib/ld-2.3.2.so)
Putting image sample (/lib/ld-2.3.2.so) offset 0x154fe, counter 0
This was oprofile 0.5.4 and op_time doesn't handle zero length sample files.
> as I can read the man page imply you must msync if you want the
> change written back *before* munmap, this imply munmap sync the
> The mmap manpage says about munmap and MAP_SHARED use:
> MAP_SHARED Share this mapping with all other processes
> that map this object. Storing to the region is
> equivalent to writing to the file. The file
> may not actually be updated until msync(2) or
> munmap(2) are called
fair enough, munmap implies msync. However, it still looks like there
some kind of race condition causing zero length sample files.