Panic on torrent connect when 32 bit arch (tested arm7 and linux 386):
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x80492fb]
goroutine 3934 [running]:
sync/atomic.LoadUint64(0x1aba219c, 0x0, 0x0)
/usr/local/go/src/sync/atomic/asm_386.s:159 +0xb
github.com/anacrolix/torrent.(*Count).Int64(0x1aba219c, 0x0, 0x0)
/home/yourok/Space/Projects/Android/TorrServe/TorrServer/src/github.com/anacrolix/torrent/conn_stats.go:60 +0x23
github.com/anacrolix/torrent.(*Torrent).announceRequest(0x1aba2000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/home/yourok/Space/Projects/Android/TorrServe/TorrServer/src/github.com/anacrolix/torrent/torrent.go:1346 +0xd6
github.com/anacrolix/torrent.(*trackerScraper).announce(0x1a8c8c80, 0x0, 0x0, 0x0, 0xd964b800, 0x45, 0x38d5892a, 0xbec3746c, 0xd5f4e2eb, 0x2, ...)
/home/yourok/Space/Projects/Android/TorrServe/TorrServer/src/github.com/anacrolix/torrent/tracker_scraper.go:111 +0x151
github.com/anacrolix/torrent.(*trackerScraper).Run(0x1a8c8c80)
/home/yourok/Space/Projects/Android/TorrServe/TorrServer/src/github.com/anacrolix/torrent/tracker_scraper.go:143 +0x1b5
created by github.com/anacrolix/torrent.(*Torrent).startScrapingTracker
/home/yourok/Space/Projects/Android/TorrServe/TorrServer/src/github.com/anacrolix/torrent/torrent.go:1311 +0x295
Reproduce:
Compile with GOARCH=386
In bash: "GOARCH=386 go build main"
func main() {
config := torrent.NewDefaultClientConfig()
config.EstablishedConnsPerTorrent = 150
config.HalfOpenConnsPerTorrent = 97
config.DisableIPv6 = true
config.NoDHT = true
client, err := torrent.NewClient(config)
if err != nil {
log.Fatal(err)
}
//Ubuntu
t, err := client.AddMagnet("magnet:?xt=urn:btih:e4be9e4db876e3e3179778b03e906297be5c8dbe&dn=ubuntu-18.04-desktop-amd64.iso&tr=http%3a%2f%2ftorrent.ubuntu.com%3a6969%2fannounce&tr=http%3a%2f%2fipv6.torrent.ubuntu.com%3a6969%2fannounce")
if err != nil {
log.Fatal(err)
}
<-t.GotInfo()
file := t.Files()[0]
reader := file.NewReader()
var wa sync.WaitGroup
wa.Add(1)
go func() {
buf := make([]byte, 4*1024*1024)
for {
_, err := reader.Read(buf)
if err != nil {
break
}
}
wa.Done()
}()
go func() {
cl := t.Closed()
for {
select {
case <-cl:
return
default:
client.WriteStatus(os.Stdout)
}
time.Sleep(time.Second)
}
}()
wa.Wait()
}
This is a bug sync/atomic:
https://golang.org/pkg/sync/atomic/#pkg-note-BUG
I tried to fix it on my own, but I did not succeed
Panic on torrent connect when 32 bit arch (tested arm7 and linux 386):
Reproduce:
Compile with GOARCH=386
In bash: "GOARCH=386 go build main"
This is a bug sync/atomic:
https://golang.org/pkg/sync/atomic/#pkg-note-BUG
I tried to fix it on my own, but I did not succeed