anacrolix / torrent

Full-featured BitTorrent client package and utilities
Mozilla Public License 2.0
5.58k stars 630 forks source link

error running torrent@v1.57.0 #973

Closed tsynik closed 1 month ago

tsynik commented 2 months ago

We use it as a library in TorrServer and have this error after upgrading to v1.57.0 compiled with go version go1.23.1:

./TorrServer-darwin-amd64
panic: pattern "/debug/perf" (registered at github.com/anacrolix/missinggo/v2@v2.7.4/perf/events.go:18) conflicts with pattern "/debug/perf" (registered at github.com/anacrolix/missinggo/perf@v1.0.0/events.go:18):
    /debug/perf matches the same requests as /debug/perf

goroutine 1 [running]:
net/http.(*ServeMux).register(...)
    net/http/server.go:2797
net/http.HandleFunc({0x10f7ea122?, 0xc000187e10?}, 0x10f1e9f2f?)
    net/http/server.go:2791 +0x86
github.com/anacrolix/missinggo/v2/perf.init.0()
    github.com/anacrolix/missinggo/v2@v2.7.4/perf/events.go:18 +0x26

Is there a way to fix this?

anacrolix commented 2 months ago

Have you run go get -u somewhere?

Could you provide the output of go list -m github.com/anacrolix/... ?

tsynik commented 2 months ago

Have you run go get -u somewhere?

Could you provide the output of go list -m github.com/anacrolix/... ?

Yup I updated to latest, but tried to revert to missinggo versions bundled with v1.57.0 with the same result.

go list -m github.com/anacrolix/...
github.com/anacrolix/args v0.5.1-0.20220509024600-c3b77d0b61ac
github.com/anacrolix/backtrace v0.0.0-20221205112523-22a61db8f82e
github.com/anacrolix/bargle v0.0.0-20221014000746-4f2739072e9d
github.com/anacrolix/bargle/v2 v2.0.0-20240804050250-9655b61917bc
github.com/anacrolix/chansync v0.6.0
github.com/anacrolix/dht/v2 v2.21.2
github.com/anacrolix/dms v1.7.1
github.com/anacrolix/envpprof v1.3.0
github.com/anacrolix/ffprobe v1.1.0
github.com/anacrolix/fuse v0.2.0
github.com/anacrolix/generics v0.0.2
github.com/anacrolix/go-libutp v1.3.1
github.com/anacrolix/gostdapp v0.1.0
github.com/anacrolix/log v0.15.3-0.20240627045001-cd912c641d83
github.com/anacrolix/lsan v0.0.0-20211126052245-807000409a62
github.com/anacrolix/missinggo v1.3.0
github.com/anacrolix/missinggo/perf v1.0.0
github.com/anacrolix/missinggo/v2 v2.7.4
github.com/anacrolix/mmsg v1.1.1
github.com/anacrolix/multiless v0.3.1-0.20221221005021-2d12701f83f7
github.com/anacrolix/possum/go v0.1.1-0.20240321122240-a01f3a22f2d1
github.com/anacrolix/publicip v0.3.1
github.com/anacrolix/squirrel v0.6.4
github.com/anacrolix/stm v0.5.0
github.com/anacrolix/sync v0.5.2
github.com/anacrolix/tagflag v1.3.0
github.com/anacrolix/torrent v1.57.0
github.com/anacrolix/upnp v0.1.4
github.com/anacrolix/utp v0.2.0
anacrolix commented 2 months ago

What I mean is don't run go get -u, it's an anti pattern. The fix should be easy I'll take a look when I have a moment.

tsynik commented 2 months ago

What I mean is don't run go get -u, it's an anti pattern. The fix should be easy I'll take a look when I have a moment.

Ok, I reverted this commit (https://github.com/YouROK/TorrServer/commit/d6c4a5f156f11ceef0bbc878add1d4cd78370445) to previously working set with torrent v1.56.0 and run only go get -u github.com/anacrolix/torrent@v1.57.0 and go get -u github.com/anacrolix/dms@v1.7.1, and have same result with error on TorrServer load.

anacrolix commented 2 months ago

Sorry I haven't looked yet. Will do soon

anacrolix commented 2 months ago

Could you try the submitted PR?

notCuteSocks commented 2 months ago

That PR is only a temporary fix, btw.

currently, It can’t pass the Go test in this torrent repo because github.com/anacrolix/missinggo/v2 imports github.com/anacrolix/missinggo by itself. Additionally, github.com/anacrolix/sync, github.com/anacrolix/generics, and github.com/anacrolix/log all depend on github.com/anacrolix/missinggo/v2. As a result, it will always import version 1, causing multiple handlers to be registered for the same pattern at /debug/perf.

So, maybe you need to update all those package dependencies to the newer version of a fixed missinggo/v2

anacrolix commented 1 month ago

@tsynik I checked out TorrServer, and got ./server to build (it was quite difficult, there were missing web deps and stuff). I was then able to reproduce the issue running the tests in ./server.

I removed the use of perf entirely in https://github.com/anacrolix/torrent/tree/remove-perf, could you try that branch yourself and confirm it fixes the problem in its entirety?

tsynik commented 1 month ago

I removed the use of perf entirely in https://github.com/anacrolix/torrent/tree/remove-perf, could you try that branch yourself and confirm it fixes the problem in its entirety?

Anactolix, I synced TorrServer with torrent@master v1.57.1-0.20240918090318-144b57016ca9 and there is no more such errors. Thanks! After go get -u github.com/anacrolix/torrent@remove-perf and with torrent v1.57.1-0.20240928120216-37eff7507e04 there is no errors also.

anacrolix commented 1 month ago

Thanks. Just remember not to use go get -u 😅. Just go get is fine.