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

Fix Service Bus messages send from HTTP failing to renew message locks #169

Merged
merged 19 commits into from
Sep 18, 2018

Conversation

lawrencegripper
Copy link
Owner

@lawrencegripper lawrencegripper commented Sep 13, 2018

Related: #157

So I'm very nearly finished with this fix. It's been a long journey to get to the bottom of the issue and I've done quite a bit of work with the go amqp 1 library to get things in place.

Currently I'm seeing slightly non-deterministic behavior with the renewals. The lock token is in the deliveryTag of each message but is stored in the .NET GUID byte format not the AMQP UUID format so a conversion is needed my current code only works roughly 80% of the time.

closes #157, closes #170

@lawrencegripper
Copy link
Owner Author

This is hopefully now ready for review, end2end smoketest is passing :)

if err != nil {
// Todo: Additional could be put in here to cleanup operations. See: #171
// https://github.com/lawrencegripper/ion/issues/171
log.WithError(err).Panic("Failed to renew locks therefor cannot continue to operation as message maybe reassigned to another dispatcher.")
Copy link
Collaborator

@jjcollinge jjcollinge Sep 17, 2018

Choose a reason for hiding this comment

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

Check grammar: would guess: "Failed to renew locks therefor therefore cannot continue to operation as message maybe could be reassigned to another dispatcher."

Copy link
Owner Author

Choose a reason for hiding this comment

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

Ta

@@ -150,7 +150,8 @@ func (c *Committer) commitBlob(blobsDir string) (map[string]string, error) {

logger.Info(c.context, "committed blob data")
logger.DebugWithFields(c.context, "blob file names", map[string]interface{}{
"files": files,
"files": files,
"blobURIs": blobURIs,
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this a potential security leak i.e. storing authenticated URLs in logs?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Yes, removed. Left over from debugging :(

Copy link
Owner Author

Choose a reason for hiding this comment

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

Good spot

@@ -192,22 +192,45 @@ func NewAmqpConnection(ctx context.Context, config *types.Configuration) *AmqpCo
return &listener
}

func swapIndex(indexOne, indexTwo int, array *[16]byte) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can perform the swap with only 1 temp variable if needed

Copy link
Owner Author

Choose a reason for hiding this comment

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

Well now your just getting fancy, had gone down the explicit route but agree will fix this up.

go func() {
defer wg.Done()
for {
// Locks are held for 1 mins, renew every 20 sec to keep locks
time.Sleep(20 * time.Second)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we provide cancellation contexts to our Sleeps to keep the dispatcher responsive to Kubernetes ops?

Copy link
Owner Author

Choose a reason for hiding this comment

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

This is a good point - probably something worthy of a separate issue as quite a chunk of changes unrelated to this PR. It's already tracked #110 as help wanted.

Copy link
Collaborator

@jjcollinge jjcollinge left a comment

Choose a reason for hiding this comment

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

LGTM

@jjcollinge jjcollinge merged commit 35d4ee2 into master Sep 18, 2018
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.

Blob files not passed correctly between modules Error returned when renewing locks on AMQP messages
2 participants