Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request messages sequence violation #585

Open
Avdeev87 opened this issue Dec 26, 2022 · 0 comments
Open

Request messages sequence violation #585

Avdeev87 opened this issue Dec 26, 2022 · 0 comments

Comments

@Avdeev87
Copy link

The following occurs quite often

System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'to')
	at System.Net.Http.Headers.RangeItemHeaderValue..ctor(Nullable'1 from, Nullable'1 to)
	at System.Net.Http.Headers.RangeHeaderValue..ctor(Nullable'1 from, Nullable'1 to)
	at MonoTorrent.Connections.Peer.HttpPeerConnection.ReceiveAsync(Memory'1 socketBuffer) in MonoTorrent.Client\MonoTorrent.Connections\HttpPeerConnection:cs
	...

This is a consequence of the fact that HttpPeerConnection.SendAsync(Memory<byte> socketBuffer) receives non-sequential data.
photo_2022-12-26_14-48-34

In ConnectionManager.TryProcessQueue(TorrentManager manager, peerID id), messages from the queue are dequeuing sequentially, but when several threads exist in parallel, this data can be transferred to PeerIO.SendMessageAsync() with an order violation.

SocketPeerConnection has similar issues

This problem can be fixed by prohibiting asynchronous retrieval from the message queue, but this will slightly affect performance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant