-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
Clarify double-response exception #124706
Clarify double-response exception #124706
Conversation
It is confusing to readers to report `Channel is already closed` in reaction to a double-response bug, and this may be interpreted as a networking issue. We're not really closing anything here, and it's a definite logic bug to call `sendResponse()` twice, so this commit clarifies the actual problem in the exception message.
Pinging @elastic/es-distributed-coordination (Team:Distributed Coordination) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
close(); | ||
// protect against double-response bugs | ||
if (responseSent.compareAndSet(false, true) == false) { | ||
final var message = "have already sent a response to this request, cannot send another"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cannot send another
we can but we wont
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's an implicit "without violating the HTTP spec" here I guess ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HTTP Spec:
First shalt thou create the HTTP Response. Then shalt thou count to one, no more, no less. One shall be the number thou shalt count, and the number of the counting shall be one. Two shalt thou not count, neither count thou three, excepting that thou then proceed to one. Five is right out. Once the number one, being the first number, be reached, then lobbest thou thy HTTP Response towards thy foe, who, being naughty in My sight, shall snuff it.
💔 Backport failed
You can use sqren/backport to manually backport by running |
It is confusing to readers to report `Channel is already closed` in reaction to a double-response bug, and this may be interpreted as a networking issue. We're not really closing anything here, and it's a definite logic bug to call `sendResponse()` twice, so this commit clarifies the actual problem in the exception message. Relates ES-10996
It is confusing to readers to report `Channel is already closed` in reaction to a double-response bug, and this may be interpreted as a networking issue. We're not really closing anything here, and it's a definite logic bug to call `sendResponse()` twice, so this commit clarifies the actual problem in the exception message. Relates ES-10996 Backport of elastic#124706 to `8.x`
Backport is #124809 |
It is confusing to readers to report `Channel is already closed` in reaction to a double-response bug, and this may be interpreted as a networking issue. We're not really closing anything here, and it's a definite logic bug to call `sendResponse()` twice, so this commit clarifies the actual problem in the exception message. Relates ES-10996 Backport of #124706 to `8.x`
It is confusing to readers to report
Channel is already closed
inreaction to a double-response bug, and this may be interpreted as a
networking issue. We're not really closing anything here, and it's a
definite logic bug to call
sendResponse()
twice, so this commitclarifies the actual problem in the exception message.
Relates ES-10996