Skip to content

Conversation

vikinghawk
Copy link
Contributor

@vikinghawk vikinghawk commented Sep 27, 2017

Isssue #308

First stab at a pluggable recovery retry interval and basic fibonnaci backoff implementation. Let me know your thoughts and i can make changes and add javadoc if this seems like something you guys like.

@pivotal-issuemaster
Copy link

@vikinghawk Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@pivotal-issuemaster
Copy link

@vikinghawk Thank you for signing the Contributor License Agreement!

for (String consumerTag : consumerTags) {
this.connection.deleteRecordedConsumer(consumerTag);
}
// TODO what about any other recorded queues and bindings that were owned by this channel? They will now cause recovery exceptions.
Copy link
Contributor

Choose a reason for hiding this comment

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

Queues and bindings are not "owned" by channels in any way. Consumers are channel state, however. Queues and bindings are tracked by connections (in part because queues can be owned by connections — when they are exclusive — and in part because declaring something on one channel then deleting it on another should leave no traces of that entity.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ya thats a bad description. What that is referencing is that any queues or bindings that were created with this channel still have the recorded entities reference this now closed channel and will throw an exception during recovery. I don't know a good way to address this other than having recorded queues/exchanges/bindings use a special "recovery" channel instead of the original creating channel. I assume the only recorded items that would require to be tied to the original channel that created them would be consumers which are cleaned up.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed this change.

this.connection.deleteRecordedConsumer(consumerTag);
}
this.connection.unregisterChannel(this);
recoveryCleanup();
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this change really related to delay calculation and back-off?

Copy link
Contributor Author

@vikinghawk vikinghawk Sep 28, 2017

Choose a reason for hiding this comment

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

no, just noticed the recorded consumers weren't being deleted with the 2nd close method like the 1st. These were some changes i had stashed in my repo from looking at some other stuff and got included here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed for now. could be a separate future PR

@michaelklishin
Copy link
Contributor

In general this looks promising.

Copy link
Contributor

@acogoluegnes acogoluegnes left a comment

Choose a reason for hiding this comment

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

LGTM. Please polish as you suggested (Javadoc, etc) and address Michael's comments. Thanks!

@vikinghawk
Copy link
Contributor Author

Updated with javadoc, test, and suggested changes.

@@ -541,8 +542,7 @@ private RecoveryAwareAMQConnection recoverConnection() throws InterruptedExcepti
newConn.abort();
return null;
} catch (Exception e) {
// TODO: exponential back-off
Thread.sleep(this.params.getNetworkRecoveryInterval());
Thread.sleep(this.params.getRecoveryDelayHandler().getDelay(attempts));
Copy link
Contributor Author

@vikinghawk vikinghawk Oct 4, 2017

Choose a reason for hiding this comment

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

thoughts on flipping the order of these 2 lines? Should it be delivering the exception before sleeping?

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's keep it the way it is.

Copy link
Contributor

Choose a reason for hiding this comment

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

Good catch. I think at some point we will have to do it. The way it works right now is a bit weird and can complicate additional manual recovery steps.

Copy link
Contributor

@acogoluegnes acogoluegnes left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@@ -541,8 +542,7 @@ private RecoveryAwareAMQConnection recoverConnection() throws InterruptedExcepti
newConn.abort();
return null;
} catch (Exception e) {
// TODO: exponential back-off
Thread.sleep(this.params.getNetworkRecoveryInterval());
Thread.sleep(this.params.getRecoveryDelayHandler().getDelay(attempts));
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's keep it the way it is.

@acogoluegnes acogoluegnes merged commit e3a6039 into rabbitmq:4.3.x-stable Oct 5, 2017
@vikinghawk vikinghawk deleted the 4.3.x-stable branch October 5, 2017 14:49
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.

4 participants