Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5484689

Browse files
committedMay 18, 2017
cmd/coordinator: don't run racecompile builder on old commits
We still run some of it (at least for now, it's harmless, and in its own goroutine), but not the -c part. Fixes golang/go#20222 Change-Id: I37a39a41c8a5f2ebaee70aeba390c58b22399d3d Reviewed-on: https://go-review.googlesource.com/43619 Reviewed-by: Josh Bleecher Snyder <[email protected]>
1 parent c303191 commit 5484689

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed
 

‎cmd/coordinator/Dockerfile.0

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ RUN go get -d gopkg.in/inf.v0 && \
5252
RUN cd /go/src/google.golang.org/grpc && \
5353
git reset --hard 50955793b0183f9de69bd78e2ec251cf20aab121
5454

55+
RUN go get go4.org/grpc && \
56+
cd /go/src/go4.org/grpc && git reset --hard 32ab3eb96f50a8c0f4103aa8d149cd1f15576636
57+
5558
# Makefile passes a string with --build-arg version
5659
# This becomes part of the cache key for all subsequent instructions,
5760
# so it must not be placed above the "go get" commands above.

‎cmd/coordinator/coordinator.go

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import (
4343
"sync/atomic"
4444
"time"
4545

46+
"go4.org/grpc"
4647
"go4.org/syncutil"
4748

4849
"cloud.google.com/go/storage"
@@ -55,6 +56,7 @@ import (
5556
"golang.org/x/build/internal/lru"
5657
"golang.org/x/build/internal/singleflight"
5758
"golang.org/x/build/livelog"
59+
"golang.org/x/build/maintner/maintnerd/apipb"
5860
"golang.org/x/build/types"
5961
"golang.org/x/crypto/acme/autocert"
6062
perfstorage "golang.org/x/perf/storage"
@@ -113,6 +115,8 @@ var (
113115
subTryBuilders []dashboard.BuildConfig // for testing sub-repos
114116
)
115117

118+
var maintnerClient apipb.MaintnerServiceClient
119+
116120
func initTryBuilders() {
117121
for _, name := range dashboard.TrybotBuilderNames() {
118122
conf := dashboard.Builders[name]
@@ -261,6 +265,12 @@ func main() {
261265
log.Fatalf("Unknown mode: %q", *mode)
262266
}
263267

268+
cc, err := grpc.NewClient(http.DefaultClient, "https://maintner.golang.org")
269+
if err != nil {
270+
log.Fatal(err)
271+
}
272+
maintnerClient = apipb.NewMaintnerServiceClient(cc)
273+
264274
http.HandleFunc("/", handleStatus)
265275
http.HandleFunc("/debug/goroutines", handleDebugGoroutines)
266276
http.HandleFunc("/debug/watcher/", handleDebugWatcher)
@@ -1843,6 +1853,39 @@ func (st *buildStatus) runMake(bc *buildlet.Client, goroot string, w io.Writer)
18431853
// caller, runMake, per builder config).
18441854
// The idea is that this might find data races in cmd/compile.
18451855
func (st *buildStatus) runConcurrentGoBuildStdCmd(bc *buildlet.Client) (remoteErr, err error) {
1856+
// Only run this step if this rev has the cmd/compile -c flag.
1857+
// See Issue 20222.
1858+
qctx, cancel := context.WithTimeout(st.ctx, 30*time.Second)
1859+
defer cancel()
1860+
spanha := st.createSpan("ask_maintner_has_ancestor")
1861+
for {
1862+
const dashCRev = "22f1b56dab29d397d2bdbdd603d85e60fb678089"
1863+
res, err := maintnerClient.HasAncestor(qctx, &apipb.HasAncestorRequest{
1864+
Commit: st.rev,
1865+
Ancestor: dashCRev,
1866+
})
1867+
if err != nil {
1868+
log.Printf("HasAncestor(%q, %q) error: %v", st.rev, dashCRev, err)
1869+
spanha.done(err)
1870+
return nil, err
1871+
}
1872+
if res.UnknownCommit {
1873+
select {
1874+
case <-qctx.Done():
1875+
return qctx.Err(), nil
1876+
case <-time.After(1 * time.Second):
1877+
}
1878+
continue
1879+
}
1880+
spanha.done(nil)
1881+
if !res.HasAncestor {
1882+
// Old commit (e.g. 1.8 branch). Don't test.
1883+
return nil, nil
1884+
}
1885+
// Recent commit. Break & test.
1886+
break
1887+
}
1888+
18461889
span := st.createSpan("go_build_c128_std_cmd")
18471890
remoteErr, err = bc.Exec("go/bin/go", buildlet.ExecOpts{
18481891
Output: st,

0 commit comments

Comments
 (0)
Please sign in to comment.