-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
fix: make clear that error is configuration issue not server error #2628
Conversation
Fixes IBM#1225 Signed-off-by: Mark Hindess <mark.hindess@gmail.com>
FWIW this change broke some of our running code. We had code that would: if err == sarama.ErrMessageSizeTooLarge {
// log a message, bump a metric, but don't retry
} ie for our use-case, we want to ignore messages related to a message being too large. It's OK for us to throw these out. We used to check a size before sending into Sarama, but then we had some cases where our payload was under the limit, but once headers etc were added, it was over, so we switched to checking this error code. Noting that #543 reports that previous error code has been returned for at least 8 years, this seems a reasonably significant change... (and a good example of Hyrum's Law ) It's now not clear to me how I should check for size related issues. |
Interestingly the last PR which touched that line of code was 4 years ago in 2019 where #1262 reverts a change a few days earlier (#1218) that renamed a bunch of error variables because:
(that change is arguably less impactful than this one because it could be detected/corrected at compile time whereas we only caught this at runtime) |
This change also caused a critical at my company. We were originally skipping messages on the As mentioned the new error is also extremely error prone to check for. We’ve had to resort to:
This code is inherently fragile, and could break if the error text changes in any way. With this sort of behavior change, it really should have involved a breaking change removing the |
For most of this library's existence it has returned ErrMessageSizeTooLarge when the message exceeded the configured size. For a short period in 2019 this error was renamed (IBM#1218) but shortly revered back (IBM#1262). Later in 2023 this error was changed to a ConfigurationError (IBM#2628) to fix IBM#2137, however this has caused issues with clients who rely on the previous error code being distinct from other ConfigurationError conditions (IBM#2655). This commit reverts to previous behaviour, and adds a test to pickup if this changes again in the future. Signed-off-by: Adam Eijdenberg <adam.eijdenberg@defence.gov.au>
Since we already return a
ConfigurationError
on line 449 it should be reasonable to return one here rather than returning an error that suggests that the server has rejected the message.Fixes #2137