Skip to content

[BUG] Errors with orchestrion go build when profile guided optimizations are enabled #653

@jprobinson

Description

@jprobinson

Version of orchestrion

github.com/DataDog/orchestrion v1.4.0

Describe what happened:

When combining orchestrion go build with profile guided optimizations we're noticing compilation errors.

We've added orchestrion via go get -tool so we're executing the build with go tool orchestrion at build time. If we fetch a profile and set it to the default path, we encounter an error:

$ /go/bin/datadog-pgo service:hello-go env:prod apps/hello-go/default.pgo"

$ /usr/local/go/bin/go tool orchestrion go build -o /go/src/github.com/DataDog/my-repo/bin/hello-go github.com/DataDog/my-repo/apps/hello-go"
...
go: downloading github.com/DataDog/orchestrion v1.4.0
go: downloading github.com/rs/zerolog v1.34.0
go: downloading github.com/urfave/cli/v2 v2.27.6
go: downloading github.com/goccy/go-yaml v1.17.1
go: downloading github.com/nats-io/nats.go v1.41.1
go: downloading github.com/xeipuuv/gojsonschema v1.2.0
go: downloading github.com/nats-io/nats-server/v2 v2.11.1
go: downloading github.com/charmbracelet/lipgloss v1.1.0
go: downloading github.com/dave/dst v0.27.3
go: downloading golang.org/x/term v0.32.0
go: downloading github.com/cpuguy83/go-md2man/v2 v2.0.6
go: downloading github.com/xrash/smetrics v0.0.0-202405
go: downloading github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415
go: downloading github.com/nats-io/nkeys v0.4.10
go: downloading github.com/nats-io/nuid v1.0.1
go: downloading github.com/charmbracelet/x/ansi v0.8.0
go: downloading github.com/charmbracelet/x/cellbuf v0.0.13
go: downloading github.com/muesli/termenv v0.16.0
go: downloading github.com/russross/blackfriday/v2 v2.1.0
go: downloading github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb
go: downloading github.com/lucasb-eyer/go-colorful v1.2.0
go: downloading github.com/charmbracelet/colorprofile v0.3.0
go: downloading github.com/charmbracelet/x/term v0.2.1
go: downloading github.com/minio/highwayhash v1.0.3
go: downloading github.com/nats-io/jwt/v2 v2.7.3
go: downloading github.com/aymanbagabas/go-osc52/v2 v2.0.1
go: downloading github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e
# os
resolving woven dependency on github.com/DataDog/dd-trace-go/v2/instrumentation/appsec/dyngo: -: # internal/goarch
sending never-build-twice request: mismatched build ID for "internal/goarch": "EwsamiwAeFqAEeLyAWx8/EwsamiwAeFqAEeLyAWx8" != "f-W5Qj0Px34zqDbrH1WK/f-W5Qj0Px34zqDbrH1WK"
-: # internal/goarch
sending never-build-twice request: mismatched build ID for "internal/goarch": "EwsamiwAeFqAEeLyAWx8/EwsamiwAeFqAEeLyAWx8" != "f-W5Qj0Px34zqDbrH1WK/f-W5Qj0Px34zqDbrH1WK"
-: # internal/goarch
sending never-build-twice request: mismatched build ID for "internal/goarch": "EwsamiwAeFqAEeLyAWx8/EwsamiwAeFqAEeLyAWx8" != "f-W5Qj0Px34zqDbrH1WK/f-W5Qj0Px34zqDbrH1WK"
...
// this continues for a few hundred lines
...
exit status 1

The "woven" dependency in the error message does not appear to be consistent across attempts.

Describe what you expected:

The compilation completes without error. When a default.pgo file is not included, we see no error.

Steps to reproduce the issue:
At the root of the repository:

import (
        // Ensures `orchestrion` is present in `go.mod` so that builds are repeatable.
        // Do not remove.
        _ "github.com/DataDog/orchestrion" // integration

        _ "gopkg.in/DataDog/dd-trace-go.v1" // integration
)

The main package:

package main

import (
	"fmt"
	"os"
	"os/signal"
	"syscall"
	"time"

	"gopkg.in/DataDog/dd-trace-go.v1/profiler"
)

func main() {
	opts := []profiler.Option{
		profiler.WithAgentAddr(os.Getenv("TRACE_AGENT_URL")),
	}
	if err := profiler.Start(opts...); err != nil {
		fmt.Printf("Error starting profiler: %s", err)
		os.Exit(1)
	}
	defer profiler.Stop()

	exit := make(chan os.Signal, 1)
	signal.Notify(exit, syscall.SIGINT, syscall.SIGTERM)
	for {
		select {
		case <-time.After(10 * time.Second):
			fmt.Println("Hello, Gophers!")
		case <-exit:
			fmt.Println("Exiting...")
			return
		}
	}
}

Additional environment details (Version of Go, Operating System, etc.):

go version go1.24.2 linux/amd64

DataDog/datadog-pgo@68da179

gopkg.in/DataDog/dd-trace-go.v1 v1.74.2

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions