Giter Site home page Giter Site logo

Reasoning behind this panic about utp HOT 6 CLOSED

anacrolix avatar anacrolix commented on May 28, 2024
Reasoning behind this panic

from utp.

Comments (6)

anacrolix avatar anacrolix commented on May 28, 2024

Thanks for the report. Good to hear you're having luck with the client. Are you loading 10k+ torrents into a single Client? Could you estimate how many simultaneous UTP connections you have?

At a quick glance, I think this panic would occur if you received a SYN packet, that would result in a connection with a receive ID that matches the connection the initiator is trying to establish, but was initiated locally, and accepted locally. If you put log.Println(c.send_id, syn.conn_id) before the panic, you should find that send_id is 2 higher than conn_id if my theory is correct. It's probable that you're initiating an awful lot of connections between 2 clients to trigger this condition. Let me know the results of this, if it's not too much hassle to try and trigger it. I'll go into more detail if the data fits my prediction.

The other message you refer to is related, assuming the aforementioned theory. A fix for this will kill both birds.

from utp.

Emyrk avatar Emyrk commented on May 28, 2024

Currently the largest test I have loads up to 25k torrents into a single client (should I launch more than 1 client to handle this load?). The number I am at when I get the panic is anywhere from 14-25K. As for simultaneous UTP connections, I am unsure. Is there a way I could estimate that, or see the current number of connections?

My test network setup is a docker network over weave, and I control the torrent tracker and all nodes, so everything is internal with no external nodes. I create the torrents internally too. I usually run 3-4 nodes with 1 having all the torrents initially. If that helps with any estimates, but I am unsure how I would be able to make that guess.

To your statement on launching a lot of connections between 2 clients, that is true. I have 25,000 torrents, and only 4 nodes, and most of the time only 1 node has the given torrent.

I'll put in the log statement and report back when I reproduce and get the log printout.

from utp.

Emyrk avatar Emyrk commented on May 28, 2024

As you suspected:
log.Println(c.send_id, syn.conn_id)
Produces:
43150 43148

43150 43148
panic: :|
	panic: sync: Unlock of unlocked RWMutex

goroutine 28 [running]:
panic(0xbdc980, 0xc44a519eb0)
	/usr/local/go/src/runtime/panic.go:500 +0x1a1
sync.(*RWMutex).Unlock(0xc42020ef30)
	/usr/local/go/src/sync/rwmutex.go:118 +0xef
github.com/FactomProject/factomd-torrent/vendor/github.com/anacrolix/sync.(*RWMutex).Unlock(0xc42020ee00)
	/home/steven/go/src/github.com/FactomProject/factomd-torrent/vendor/github.com/anacrolix/sync/rwmutex.go:26 +0x59
panic(0xbdc980, 0xc44a519ea0)
	/usr/local/go/src/runtime/panic.go:458 +0x243
github.com/FactomProject/factomd-torrent/vendor/github.com/anacrolix/utp.(*Socket).ackSyn(0xc42019a540, 0xa88c0001, 0xc4a4767200, 0x10, 0x0, 0x0)
	/home/steven/go/src/github.com/FactomProject/factomd-torrent/vendor/github.com/anacrolix/utp/socket.go:485 +0x38f
github.com/FactomProject/factomd-torrent/vendor/github.com/anacrolix/utp.(*Socket).Accept(0xc42019a540, 0x0, 0x0, 0x0, 0x0)
	/home/steven/go/src/github.com/FactomProject/factomd-torrent/vendor/github.com/anacrolix/utp/socket.go:507 +0xd8
github.com/FactomProject/factomd-torrent/vendor/github.com/Anacrolix/torrent.(*Client).acceptConnections(0xc42020ee00, 0x13e4e40, 0xc42019a540, 0x13e5401)
	/home/steven/go/src/github.com/FactomProject/factomd-torrent/vendor/github.com/Anacrolix/torrent/client.go:383 +0xb8
created by github.com/FactomProject/factomd-torrent/vendor/github.com/Anacrolix/torrent.NewClient
	/home/steven/go/src/github.com/FactomProject/factomd-torrent/vendor/github.com/Anacrolix/torrent/client.go:290 +0x67d

from utp.

anacrolix avatar anacrolix commented on May 28, 2024

Thanks for the feedback. I'll write a unit test and a fix when I get time. In the meanwhile, you can just comment out that panic on your servers, it will behave correctly.

from utp.

Emyrk avatar Emyrk commented on May 28, 2024

Thanks!

from utp.

anacrolix avatar anacrolix commented on May 28, 2024

Oops, I think this was fixed in 78c7e0d.

from utp.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.