Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
4002014c
Commit
4002014c
authored
May 02, 2011
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
http/pprof: fix POST reading bug
R=bradfitz CC=golang-dev
https://golang.org/cl/4430075
parent
12cf1699
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
6 deletions
+17
-6
src/cmd/prof/gopprof
src/cmd/prof/gopprof
+5
-4
src/pkg/http/pprof/pprof.go
src/pkg/http/pprof/pprof.go
+12
-2
No files found.
src/cmd/prof/gopprof
View file @
4002014c
...
...
@@ -2880,17 +2880,18 @@ sub FetchSymbols {
my @toask = @pcs;
while (@toask > 0) {
my $n = @toask;
if ($n > 49) { $n = 49; }
# NOTE(rsc): Limiting the number of PCs requested per round
# used to be necessary, but I think it was a bug in
# debug/pprof/symbol's implementation. Leaving here
# in case I am wrong.
# if ($n > 49) { $n = 49; }
my @thisround = @toask[0..$n];
my $t = @toask;
print STDERR "$n $t\n";
@toask = @toask[($n+1)..(@toask-1)];
my $post_data = join("+", sort((map {"0x" . "$_"} @thisround)));
open(POSTFILE, ">$main::tmpfile_sym");
print POSTFILE $post_data;
close(POSTFILE);
print STDERR "SYMBL!\n";
my $url = SymbolPageURL();
$url = ResolveRedirectionForCurl($url);
my $command_line = "$CURL -sd '\@$main::tmpfile_sym' '$url'";
...
...
src/pkg/http/pprof/pprof.go
View file @
4002014c
...
...
@@ -26,6 +26,7 @@ package pprof
import
(
"bufio"
"bytes"
"fmt"
"http"
"os"
...
...
@@ -88,10 +89,14 @@ func Profile(w http.ResponseWriter, r *http.Request) {
func
Symbol
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
w
.
Header
()
.
Set
(
"Content-Type"
,
"text/plain; charset=utf-8"
)
// We have to read the whole POST body before
// writing any output. Buffer the output here.
var
buf
bytes
.
Buffer
// We don't know how many symbols we have, but we
// do have symbol information. Pprof only cares whether
// this number is 0 (no symbols available) or > 0.
fmt
.
Fprintf
(
w
,
"num_symbols: 1
\n
"
)
fmt
.
Fprintf
(
&
buf
,
"num_symbols: 1
\n
"
)
var
b
*
bufio
.
Reader
if
r
.
Method
==
"POST"
{
...
...
@@ -109,14 +114,19 @@ func Symbol(w http.ResponseWriter, r *http.Request) {
if
pc
!=
0
{
f
:=
runtime
.
FuncForPC
(
uintptr
(
pc
))
if
f
!=
nil
{
fmt
.
Fprintf
(
w
,
"%#x %s
\n
"
,
pc
,
f
.
Name
())
fmt
.
Fprintf
(
&
buf
,
"%#x %s
\n
"
,
pc
,
f
.
Name
())
}
}
// Wait until here to check for err; the last
// symbol will have an err because it doesn't end in +.
if
err
!=
nil
{
if
err
!=
os
.
EOF
{
fmt
.
Fprintf
(
&
buf
,
"reading request: %v
\n
"
,
err
)
}
break
}
}
w
.
Write
(
buf
.
Bytes
())
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment