Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/pprof: unable to generate output file for some formats #16179

dsnet opened this issue Jun 25, 2016 · 2 comments

cmd/pprof: unable to generate output file for some formats #16179

dsnet opened this issue Jun 25, 2016 · 2 comments


Copy link

@dsnet dsnet commented Jun 25, 2016

Using go1.7beta2

The pprof tools claims:

Output file parameters (for file-based output formats):
-output=f Generate output on file f (stdout by default)

Intuitively, a user would expect a output file to be generated that contains the specified format. However, that is not what always happens. The logic that pprof follows is somewhat convoluted and sometimes it will output the file, sometimes it will still invoke the visualizer, and sometimes it does both, and maybe it does neither in some code paths (it's hard to follow the logic)?

For example, consider the following command:

$ go  tool  pprof  -weblist=.  -output=weblist.html  foo.test  /tmp/cpu.profile
Generating report in weblist.html

One would expect that this outputs the weblist output as the weblist.html file. However, this is not what happens. Running the command invokes the web browser (which fails over SSH). Even worse, it claims to have written the file, when it simply outputs an empty file with nothing in it.

The current logic follows a non-trivial path that is dependent on whether a visualizer is available, whether a post process function is available, and other non-obvious code paths.

Whether the pprof tools outputs a file should be simple:

If there is an output file specified, always write the output to that file. Otherwise, try to invoke the associated visualizer (svg, chrome, stdout, etc...).

@dsnet dsnet added this to the Unplanned milestone Jun 27, 2016
@dsnet dsnet modified the milestones: Go1.9, Unplanned Feb 10, 2017
@dsnet dsnet self-assigned this Feb 10, 2017
Copy link

@gopherbot gopherbot commented Feb 10, 2017

CL mentions this issue.

Copy link
Member Author

@dsnet dsnet commented May 24, 2017

This is fixed upstream in the google/pprof repo.

@dsnet dsnet closed this May 24, 2017
@golang golang locked and limited conversation to collaborators May 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.