这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@MauriceVanVeen
Copy link
Member

The calculation of getSizeInBytes() was off, when looking at the usage in NatsConnectionWriter.sendMessageBatch(...).

The following would happen:

Message Previously Comment
only subject calculation off by -2 When accumulate was called on the MessageQueue it would return more messages. sendMessageBatch(...) would write more bytes than was indicated by the msg size, so it would more easily trigger re-sizing of the sendBuffer. (Which I believe is the root cause of: #644)
subject+headers correct calculation
subject+data correct calculation
subject+headers+data calculation off by +2 MessageQueue.accumulate would return less messages than would fit in the sendBuffer. Shouldn't be as much of an issue for the NatsConnectionWriter to handle, nonetheless the sizes aren't the same.

This PR corrects these by ensuring the calculation of the getSizeInBytes() matches with the construction of the sendBuffer in NatsConnectionWriter.sendMessageBatch(...).

@scottf, mentioning you since you've also reviewed my previous PR (#746) and I believe it's related to #644 as well.

@scottf scottf merged commit 56152a1 into nats-io:main Sep 30, 2022
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

Successfully merging this pull request may close these issues.

2 participants