Skip to content

Resetting oversize buffer might lead to lost messages and protocol desync #5218

@vonzshik

Description

@vonzshik

void ResetReadBuffer()
{
if (_origReadBuffer != null)
{
ReadBuffer.Dispose();
ReadBuffer = _origReadBuffer;
_origReadBuffer = null;
}
}

Whenever we reset the oversize buffer we do not check whether it actually has something left to read (which might happen for async messages, like notifications and parameter statuses). What we should do instead is to copy the data left to the original buffer, and in case we can't (because the amount of data left in oversize buffer exceeds original buffer's size), we should just leave oversize buffer as is.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions