Skip to content

cmd/trace: "failed to parse trace: no consistent ordering of events possible" #29707

Closed

Description

@256dpi

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

$ go version
go version go1.11.4 darwin/amd64

Does this issue reproduce with the latest release?

Yes

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

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/256dpi/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/256dpi/Development/Go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.11.4/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.11.4/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/mj/lp3r462x6tqfd4v_93bvh65h0000gn/T/go-build000614795=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I ran a network intensive go program (closed source) with a fairly light workload.

What did you expect to see?

I expect to be able to obtain a trace profile and explore it with the viewer program.

What did you see instead?

After obtaining the profile with wget -O trace.out "http://localhost:6060/debug/pprof/trace?seconds=10". When running go tool trace trace.out I received:

2019/01/12 12:37:26 Parsing trace...
failed to parse trace: no consistent ordering of events possible

Activity

  1. 256dpi commented on Jan 15, 2019

    @256dpi
    Author

    I have to add, I was testing a binary that was linked with C code (CGO). Is it possible that tracing does not work properly in CGO builds?

  2. changed the title [-]failed to parse trace: no consistent ordering of events possible[/-] [+]net/http/pprof: "failed to parse trace: no consistent ordering of events possible"[/+] on Jan 30, 2019
  3. bcmills commented on Jan 30, 2019

    @bcmills
    Contributor

    CC @rsc @hyangah @matloob @dvyukov for pprof and trace

  4. added
    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
    on Jan 30, 2019
  5. added this to the Go1.13 milestone on Jan 30, 2019
  6. changed the title [-]net/http/pprof: "failed to parse trace: no consistent ordering of events possible"[/-] [+]cmd/trace: "failed to parse trace: no consistent ordering of events possible"[/+] on Jan 30, 2019
  7. hyangah commented on Jan 30, 2019

    @hyangah
    Contributor

    #16755 was the first one that came to my mind, but I've never seen the issue with darwin/amd64, so I am not sure. I am not aware of cmd/trace issues involving cgo.

    @256dpi is it possible to share the captured trace with me?

  8. AlexRouSg commented on May 4, 2019

    @AlexRouSg
    Contributor

    @hyangah I just ran into this and made a repo.

    Basically it happens when you export a Go function to C and then call that function inside a C created thread.

    package test
    
    /*
    	#include <pthread.h>
    
    	extern void* callback(void*);
    	typedef void* (*cb)(void*);
    
    	static void testCallback(cb cb) {
    		pthread_t thread_id;
    		pthread_create(&thread_id, NULL, cb, NULL);
        	        pthread_join(thread_id, NULL);
    	}
    */
    import "C"
    import (
    	"context"
    	"runtime/trace"
    	"time"
    	"unsafe"
    )
    
    var traceCtx, traceTask = trace.NewTask(context.Background(), "Debug")
    
    func test() {
    	C.testCallback(C.cb(C.callback))
    }
    
    //export callback
    func callback(unsafe.Pointer) unsafe.Pointer {
    	defer trace.StartRegion(traceCtx, "callback").End()
    	time.Sleep(time.Millisecond)
    
    	return nil
    }
    
  9. bcmills commented on Jun 26, 2019

    @bcmills
    Contributor

    Here's a related flake in runtime/trace.TestTraceStressStartStop on the freebsd-amd64-12_0 builder:
    https://build.golang.org/log/65ddd079bfd87715555a97b296b41dfa64ff12b6

    --- FAIL: TestTraceStressStartStop (1.14s)
        trace_test.go:147: failed to parse trace: no consistent ordering of events possible
    FAIL
    FAIL	runtime/trace	1.574s
    
  10. modified the milestones: Go1.13, Go1.14 on Jul 8, 2019
  11. modified the milestones: Go1.14, Backlog on Oct 9, 2019
  12. let4be commented on Feb 17, 2020

    @let4be

    Any update? I cannot parse trace created on arm64 from x86 machine

  13. 21 remaining items

  14. yalon commented on Jul 11, 2022

    @yalon

    Have the same issue on Go 1.18.3 linux/amd64, in my case Python's the main, calling Go via CFFI (C basically). While Python/C creates its own threads, the problem happens when there's high concurrency. Unfortunately in my case I can't control the Python side so any idea on how to work around this would be great.

  15. Repository owner moved this from Triage Backlog to Done in Go Compiler / Runtime / Commandon Aug 12, 2022
  16. prattmic commented on Aug 15, 2022

    @prattmic
    Member

    Temporarily reverted in https://go.dev/cl/423437.

  17. Repository owner moved this from Done to In Progress in Go Compiler / Runtime / Commandon Aug 15, 2022
  18. gopherbot commented on Sep 10, 2022

    @gopherbot
    Contributor

    Change https://go.dev/cl/429858 mentions this issue: runtime/trace: add missing events for the locked g in extra M.

  19. Repository owner moved this from In Progress to Done in Go Compiler / Runtime / Commandon Sep 27, 2022
  20. locked and limited conversation to collaborators on Sep 27, 2023
  21. added a commit that references this issue on Feb 10, 2024
    ea9c3fd
  22. added a commit that references this issue on Feb 20, 2024
    fb6c210
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions