Skip to content

Commit

Permalink
downloader: race at startup (#12423)
Browse files Browse the repository at this point in the history
```
==================
WARNING: DATA RACE
Read at 0x00c0266a01e0 by goroutine 24836:
  github.com/erigontech/erigon-lib/downloader.(*Downloader).notifyCompleted()
      github.com/erigontech/[email protected]/downloader/downloader.go:2957 +0x665
  github.com/erigontech/erigon-lib/downloader.(*Downloader).torrentCompleted()
      github.com/erigontech/[email protected]/downloader/downloader.go:2946 +0x65d
  github.com/erigontech/erigon-lib/downloader.(*Downloader).mainLoop.func2()
      github.com/erigontech/[email protected]/downloader/downloader.go:956 +0x1f84

Previous write at 0x00c0266a01e0 by main goroutine:
  github.com/erigontech/erigon-lib/downloader.NewGrpcServer()
      github.com/erigontech/[email protected]/downloader/downloader_grpc_server.go:47 +0x44d
  github.com/erigontech/erigon/eth.(*Ethereum).setUpSnapDownloader()
      github.com/erigontech/erigon/eth/backend.go:1398 +0x325
  github.com/erigontech/erigon/eth.New()
      github.com/erigontech/erigon/eth/backend.go:351 +0x1b45
  github.com/erigontech/erigon/turbo/node.New()
      github.com/erigontech/erigon/turbo/node/node.go:139 +0x124
  main.runErigon()
      github.com/erigontech/erigon/cmd/erigon/main.go:98 +0x53b
  github.com/erigontech/erigon/turbo/app.MakeApp.func1()
```
  • Loading branch information
AskAlexSharov authored Oct 23, 2024
1 parent 4837639 commit 18bf69a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cmd/downloader/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,12 @@ func Downloader(ctx context.Context, logger log.Logger) error {
}
}

d.MainLoopInBackground(false)

bittorrentServer, err := downloader.NewGrpcServer(d)
if err != nil {
return fmt.Errorf("new server: %w", err)
}

d.MainLoopInBackground(false)
if seedbox {
var downloadItems []*proto_downloader.AddItem
for _, it := range snapcfg.KnownCfg(chain).Preverified {
Expand Down
2 changes: 1 addition & 1 deletion eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -1394,11 +1394,11 @@ func (s *Ethereum) setUpSnapDownloader(ctx context.Context, downloaderCfg *downl
if err != nil {
return err
}
s.downloader.MainLoopInBackground(true)
bittorrentServer, err := downloader.NewGrpcServer(s.downloader)
if err != nil {
return fmt.Errorf("new server: %w", err)
}
s.downloader.MainLoopInBackground(true)

s.downloaderClient = direct.NewDownloaderClient(bittorrentServer)
}
Expand Down

0 comments on commit 18bf69a

Please sign in to comment.