-
Notifications
You must be signed in to change notification settings - Fork 1.5k
AMQ-6494 Process SHUTDOWN_INFO and REMOVE_INFO to avoid timeouts #208
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
Conversation
| if (!brokerService.isStopping() || Arrays.asList(processDuringShutdown).contains(command.getDataStructureType())) { | ||
| Response response = service(command); | ||
| if (response != null && !brokerService.isStopping()) { | ||
| if (response != null && Arrays.asList(processDuringShutdown).contains(command.getDataStructureType())) { |
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.
This bit looks to filter any response that isn't a ShutdownInfo or a RemoveInfo response which I don't think you would want to do.
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.
@tabish121 of course you're right. I missed something in the commit, it was an incomplete optimization to avoid multiple conditions in the 'if'. Full tests now on the complete fix, coming up shortly.
That said, do you see any problem with the approach?
|
So the question I'd have is what is really being solved here? From the context it looks like the hangs you are trying to fix relate to a client sending a command that requires a response at its root, even though the one you are targeting is RemoveInfo (ShutdownInfo never requires a response so a client would never hang on that). However RemoveInfo isn't the only command that expects a response and so a client might still hang due to the code in question if for some reason the act of the broker eventually breaking the socket on close didn't kick it out of whatever stall it is in. It seems like a better strategy might be to just formulate a response to any incoming command that needs one if the state of the broker is stopping when the command arrives, and pass only responses when one is generated even if the broker isStopping is true. Whether or not you returned an ErrorResponse for everything when isStopping is true is one thing to think about, do you want the client to just assume things worked or do you want it to be able to report an error indicating that the broker is stopping. As for the change you've made so far, if you were to go with that I don't know if the array based search approach is necessary vs just adding a 'isRemoveInfo' to Command to go along with 'isShutdownInfo' and just doing an plain old 'if (command.isRemoveInfo() || command.isShutdownInfo()) to that code path. |
|
@tabish121 good questions, I'll try to answer one by one.
I'll take a shot at the better strategy you suggested. More elegant and correct. |
|
@tabish121 I created a new patch based on your suggestions. It simpler and cleaner. I'll give it another day before pushing, just in case there are other comments. Thanks! |
|
Looks good, much simpler now |
More details regarding this bug in jira.
https://issues.apache.org/jira/browse/AMQ-6494