Go: cmd/trace: trace shows blank page on chrome

Created on 28 Apr 2018  路  31Comments  路  Source: golang/go

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

1.10

Does this issue reproduce with the latest release?

no

What operating system and processor architecture are you using (go env)?

ubuntu / amd64

What did you do?

run 'go tool trace m.trace'

What did you expect to see?

full view on the browser of trace

What did you see instead?

empty page on google chrome and firefox and got this error in the console Uncaught ReferenceError: tr is not defined

NeedsInvestigation WaitingForInfo

Most helpful comment

I got this problem recently.
What version of Go are you using (go version)?
1.13.8 (brew install go)

Does this issue reproduce with the latest release?
yes

What operating system and processor architecture are you using (go env)?
darwin / amd64

What did you do?
run 'go tool trace trace.out'

What did you expect to see?
full view on the browser after clicking "View trace"

What did you see instead?
empty page on google chrome(v80.0.3987.100 64 bit) and got this error in the console:
Uncaught ReferenceError: tr is not defined
at onResult (trace?start=0&end=1009904:59)
at trace?start=0&end=1009904:43

output of 'ls $GOROOT/misc/trace' is:
README.md
trace_viewer_full.html
(GOROOT="/usr/local/Cellar/go/1.13.8/libexec")
@ALTree
@hyangah

All 31 comments

This error typically comes from the incompatible browser; only Chrome is supported. Can you confirm this issue with the latest stable version of Chrome? What version do you use?

The fact that firefox doesn't work is explicitly documented:

Note that while the various profiles available when launching 'go tool
trace' work on every browser, the trace viewer itself (the 'view trace'
page) comes from the Chrome/Chromium project and is only actively tested on
that browser.

Chrome, on the other hand, should work.

We could check if tracing tool is available in the browser, and give an explicit error message to the user if it is not. That blank page was very confusing for me too the first time I tried to use it.

my chrome version
Version 66.0.3359.139 (Official Build) (64-bit)
it's the latest

@AlekSi
cc @ALTree

It works for me. Can you please provide a small self-contained example demonstrating the problem?

Are you sure the m.trace file is not empty? Can you attach it?

i recently run a windows 10 vm and setup golang,google chrome and the file works well ,
it can help me for now , but i need it to run on my ubuntu machine

CC: @hyangah @heschik

@tarekbadrshalaan
Can you check if trace_viewer_lean.html is available from your $GOROOT/misc/trace directory?

$ ls go env GOROOT/misc/trace

@hyangah
i have no directory $GOROOT/misc/trace
and no directory $GOROOT/misc

@tarekbadrshalaan I don't see how that's possible... please post here the output of go env.

~$go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/tarek/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/tarek/Program/GO_Lang/GOPATH"
GORACE=""
GOROOT="/usr/lib/go-1.10"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.10/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build795570521=/tmp/go-build -gno-record-gcc-switches"

What does ls /usr/lib/go-1.10 print?

Did you install Go from your OS package manager?

output of ls /usr/lib/go-1.10
bin doc favicon.ico.gz pkg src test VERSION

here how i installed go on Ubuntu
sudo add-apt-repository ppa:longsleep/golang-backports
sudo apt-get update
sudo apt-get install golang-go
echo "export GOPATH=/home/tarek/Program/GO_Lang/GOPATH" >> .bashrc
echo "export PATH=$GOPATH/bin:$PATH" >> .bashrc

Please try installing the official distribution per the instructions at https://golang.org/doc/install and see if you can still reproduce the problem.

ok it's working now with go installation from the official distribution on ubuntu/chrome
thank you
@bcmills
@ALTree
@hyangah
@AlekSi

fedora 29 has a separate rpm for "misc":
dnf install golang-misc

I got this problem recently.
What version of Go are you using (go version)?
1.13.8 (brew install go)

Does this issue reproduce with the latest release?
yes

What operating system and processor architecture are you using (go env)?
darwin / amd64

What did you do?
run 'go tool trace trace.out'

What did you expect to see?
full view on the browser after clicking "View trace"

What did you see instead?
empty page on google chrome(v80.0.3987.100 64 bit) and got this error in the console:
Uncaught ReferenceError: tr is not defined
at onResult (trace?start=0&end=1009904:59)
at trace?start=0&end=1009904:43

output of 'ls $GOROOT/misc/trace' is:
README.md
trace_viewer_full.html
(GOROOT="/usr/local/Cellar/go/1.13.8/libexec")
@ALTree
@hyangah

Hello. I also got this problem.

What version of Go are you using (go version)?
1.13.6 (dnf install golang)

$ dnf info golang
Last metadata expiration check: 1:54:47 ago on Fri 21 Feb 2020 06:41:40 AM CET.
Installed Packages
Name         : golang
Version      : 1.13.6
Release      : 1.fc31
Architecture : x86_64
Size         : 7.8 M
Source       : golang-1.13.6-1.fc31.src.rpm
Repository   : @System
From repo    : updates
Summary      : The Go Programming Language
URL          : http://golang.org/
License      : BSD and Public Domain
Description  : The Go Programming Language.

Does this issue reproduce with the latest release?
yes (from fedora repos that is)

What operating system and processor architecture are you using (go env)?
linux / amd64 (fedora 31)

What did you do?
run a unittest writing trace to file, then running go tool trace trace.out and firefox automatically opens. I clicked on "View Trace".

What did you expect to see?
the contents of "view trace" for my unittest.

What did you see instead?
nothing, an empty, white page in firefox (Mozilla Firefox 71.0)
In the firefox console I get:

ReferenceError: tr is not definedtrace:59:5
    onResult http://127.0.0.1:33971/trace:59
    onreadystatechange http://127.0.0.1:33971/trace:43

It seems I am also missing the misc folder:

$ go env GOROOT
/usr/lib/golang

$ stat /usr/lib/golang/misc
stat: cannot stat '/usr/lib/golang/misc': No such file or directory

I removed the golang package dnf remove -y golang and installed it from https://golang.org/doc/install using go1.13.8.linux-amd64.tar.gz. Now I have the misc folder:

$ go env GOROOT  
/usr/local/go

$聽stat `go env GOROOT`/misc
  File: /usr/local/go/misc
...

However, this doesn't fix the problem with an empty page in Firefox. When I launch the trace I get the same empty page with the same error message in the console. I see from #34374 and _@hyangah in https://github.com/golang/go/issues/34374#issuecomment-589261866_ that it is not yet fixed in any stable download.

Updated
The workaround from _@jpvillaseca in https://github.com/golang/go/issues/34374#issuecomment-589022051_ works on my go1.13.8 manual install.

I get this too with:

Ubuntu 16.04 LTS (64-bit)
Chrome version 80.0.3987.122 (Official Build) (64-bit)
Go v1.14

The fix is in the tip and waiting for feedback so it can be included in the patch release of go1.14. Please try the version (the easiest is https://godoc.org/golang.org/dl/gotip and gotip tool trace ...

Tested gotip tool trace with chrome 80.0.3987.87 and firefox 73 on ubuntu focal (which will be ubuntu 20.04) and I confirm that the UI is now correctly loading.

I'm using go1.14 linux/amd64 and the issue is still there.

Tested gotip tool trace with chrome 80.0.3987.87 and firefox 73 on ubuntu focal (which will be ubuntu 20.04) and I confirm that the UI is now correctly loading.
@didrocks What's your golang version?

Tested gotip tool trace with chrome 80.0.3987.87 and firefox 73 on ubuntu focal (which will be ubuntu 20.04) and I confirm that the UI is now correctly loading.
@didrocks What's your golang version?

go version devel +b8f54e5 Fri Feb 28 09:29:22 2020 +0000 linux/amd64

Tested gotip tool trace with chrome 80.0.3987.87 and firefox 73 on ubuntu focal (which will be ubuntu 20.04) and I confirm that the UI is now correctly loading.
@didrocks What's your golang version?

go version devel +b8f54e5 Fri Feb 28 09:29:22 2020 +0000 linux/amd64

Thank you very much.
I tried gotip on Macos and Centos. gotip works on Macos, but failed on Centos when I called gotip download.

It complains:

Updating the go development tree...
HEAD is now at 26154f3... cmd/compile: use NEG/NEGW pseudo-instructions on riscv64
error: unknown switch `i'
usage: git clean [-d] [-f] [-n] [-q] [-e ] [-x | -X] [--] ...

-q, --quiet do not print names of files removed
-n, --dry-run dry run
-f, --force force
-d remove whole directories
-e, --exclude
add to ignore rules
-x remove ignored files, too
-X remove only ignored files

gotip: failed to cleanup git repository: exit status 129

Do you hava any suggestion?

The fix is in the tip and waiting for feedback so it can be included in the patch release of go1.14. Please try the version (the easiest is https://godoc.org/golang.org/dl/gotip and gotip tool trace ...

I tried gotip on centos. There is something wrong with gotip download:

Updating the go development tree...
HEAD is now at 26154f3... cmd/compile: use NEG/NEGW pseudo-instructions on riscv64
error: unknown switch `i'
usage: git clean [-d] [-f] [-n] [-q] [-e ] [-x | -X] [--] ...

-q, --quiet do not print names of files removed
-n, --dry-run dry run
-f, --force force
-d remove whole directories
-e, --exclude
add to ignore rules
-x remove ignored files, too
-X remove only ignored files

gotip: failed to cleanup git repository: exit status 129

Do you have any solution about how to fix this?

Please file a separate bug to track the gotip issue. cc @FiloSottile

If gotip doesn't work, an alternative is to build from the source. The instruction is https://golang.org/doc/install/source

I think the minor version release will be available soon and include the fix. But I don't know the concrete timeline yet cc @andybons

It is OK on Macos:
go 1.14.4
firefox 77.0.1 (64 bit)

Marking as resolved based on https://github.com/golang/go/issues/25151#issuecomment-592598214

Was this page helpful?
0 / 5 - 0 ratings

Related issues

enoodle picture enoodle  路  3Comments

longzhizhi picture longzhizhi  路  3Comments

jayhuang75 picture jayhuang75  路  3Comments

rakyll picture rakyll  路  3Comments

stub42 picture stub42  路  3Comments