Codebase list golang-golang-x-mod / 73a89136-b5d4-4ec1-845e-f4296d2f5787/v0.11.0
sumdb: handle panic from c.ReadRemote during ReadTiles The go command tests use a network stack that sometimes panics during read. This code was assuming a network stack that returns errors instead. If a tile-reading goroutine panicked, ReadTiles considered it done with data, err = nil, nil, and then there was a race between ReadTiles failing with an error about a suspiciously short tile and the panicking goroutine getting to run and bring down the entire program. Remove the race by converting the panic into an error during ReadTiles. For a test in golang/go#57001. Change-Id: I9b18a244238e67c27a15b93f8397bf3ab44b06e6 Reviewed-on: https://go-review.googlesource.com/c/mod/+/501035 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Matloob <matloob@golang.org> Russ Cox 11 months ago
1 changed file(s) with 5 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
552552 wg.Add(1)
553553 go func(i int, tile tlog.Tile) {
554554 defer wg.Done()
555 defer func() {
556 if e := recover(); e != nil {
557 errs[i] = fmt.Errorf("panic: %v", e)
558 }
559 }()
555560 data[i], errs[i] = r.c.readTile(tile)
556561 }(i, tile)
557562 }