Skip to content
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

ARTEMIS-2057 Fix runaway credit grants #2272

Merged
merged 1 commit into from Aug 28, 2018
Merged

Conversation

tabish121
Copy link
Contributor

Ensure the broker looks at local receiver credit when checking for
credit top off threshold and then do a proper top off back to the high
water mark to sync with how client receivers manage their credit.

if (receiver.getRemoteCredit() <= threshold) {
receiver.flow(credits);
if (receiver.getCredit() <= threshold) {
receiver.flow(credits - receiver.getCredit());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should protect against trying to flow <=0 after the calculation.

* Test that the AMQPSessionCallback grants no credit when not at threshold
*/
@Test
public void testOfferProducerWithNoAddressDoesNMotTopOffCreditAboveThresholdN() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typos in name testOfferProducerWithNoAddressDoesNMotTopOffCreditAboveThresholdN

AMQPSessionCallback session = new AMQPSessionCallback(
protonSPI, manager, connection, transportConnection, executor, operationContext);

// Credit is below threshold
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Above threshold?

assertNotNull(argument.getValue());
argument.getValue().run();

// Credit runnable should top off credit to configured value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not top off credit?

* Test that the AMQPSessionCallback grants no credit when not at threshold
*/
@Test
public void testOfferProducerWithAddressDoesNMotTopOffCreditAboveThresholdN() throws Exception {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typos as earlier

@tabish121
Copy link
Contributor Author

@gemmellr I've pushed some updates based on comments, thanks for reviewing

Ensure the broker looks at local receiver credit when checking for
credit top off threshold and then do a proper top off back to the high
water mark to sync with how client receivers manage their credit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants