Bug 110616 - log-file option not working correctly when program forks some children
Summary: log-file option not working correctly when program forks some children
Status: RESOLVED DUPLICATE of bug 162848
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: 3.0.0
Platform: Unlisted Binaries Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-12 08:53 UTC by Joachim Bauernberger
Modified: 2009-07-01 09:31 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
fork a cople of processes to demonstrate valgrind behaviour (659 bytes, text/plain)
2005-08-17 17:46 UTC, Joachim Bauernberger
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Hughes 2005-08-12 21:18:55 UTC
No details provided.
Comment 1 Joachim Bauernberger 2005-08-17 17:08:49 UTC
I have posted this to the valgrind-users mailing list along with a sample program which demonstrates the problem. this bug tracking system does not allow uploads so which details would you like?
Comment 2 Tom Hughes 2005-08-17 17:16:50 UTC
You certainly can upload things - use the "Create a New Attachment" link.

What we really need is not a test case though (although that may help) but a description of what you think is wrong - what you are doing, what is happening and what you think should happen.

The fact that you may have posted those details on the mailing list at some point is helpful, but it will be far easier if they are here than if we have to go searching the mailing list to find them.
Comment 3 Joachim Bauernberger 2005-08-17 17:46:35 UTC
Created attachment 12250 [details]
fork a cople of processes to demonstrate valgrind behaviour
Comment 4 Joachim Bauernberger 2005-08-17 17:47:25 UTC
Hi,

we have some very large apps which load massive amount of shared libs. After trying valgrind on one of them (app has around 10-20 child processes) I noticed that the logfile for the child does not get written. Instead I have all messages appear in the parents log (the PID does get appended to the file). 

Also I just tried running some sample code that forks 5 children does some stuff and exits (see attached file).
I ran this then using:
valgrind --trace-children=yes --log-file=foo ./fork

I would have expected valgrind to make an individual logfile for every child.

I checked the NEWS file (and archives) on that. 

The NEWS file says
- Small changes in control log file naming which make it easier to
  use valgrind for debugging MPI-based programs.  The relevant
  new flags are --log-file-exactly= and --log-file-qualifier=.

what are those 2 new flags for?


The man page says to the --log-file= option:
... the file name used is created  by  concatenating  the  text filename, ".pid" and the process ID, so as
to create a file per process. 

should this still apply?


thanks & best regards,
joachim
Comment 5 Tom Hughes 2005-08-17 18:15:48 UTC
Sections 2.3 and 2.6.2 of the valgrind manual describe what --log-file-exactly and --log-file-qualifier do.

As far as your other problem goes, the logging stream for a single instance of valgrind always goes to a single place established when that instance starts, and forking does not create a new instance of valgrind. If one of those children were to exec a new process (and --trace-children was set) then the command line arguments would be re-evaluated and new log file would be opened based on the new PID value.

It would certainly be possible to establish a new logging stream on fork, but it is a non-trivial change.
Comment 6 Nicholas Nethercote 2009-07-01 09:31:06 UTC

*** This bug has been marked as a duplicate of bug 162848 ***