-
Notifications
You must be signed in to change notification settings - Fork 874
Resetting oversize buffer might lead to lost messages and protocol desync #5218
Copy link
Copy link
Closed
Copy link
Milestone
Description
npgsql/src/Npgsql/Internal/NpgsqlConnector.cs
Lines 2321 to 2329 in 251220d
| 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.
Reactions are currently unavailable