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

sc-7148 fix expired transaction issue #103

Merged
merged 2 commits into from
Jul 13, 2022
Merged

sc-7148 fix expired transaction issue #103

merged 2 commits into from
Jul 13, 2022

Conversation

pdeziel
Copy link
Collaborator

@pdeziel pdeziel commented Jul 13, 2022

This fixes an issue discovered during the last deployment where async transactions were expiring. The cause is a bit complicated, but it boils down to two go routines trying to modify the transaction record at the same time and overwriting each other.

After looking at this a bit I realized the root of the problem is the originator code (in rvasp.go) creating a new transfer request before responding to the beneficiary. This fix isolates things a bit more by creating a few more transaction states and having the originator respond asynchronously using the async routine rather than immediately.

return nil, status.Errorf(codes.FailedPrecondition, "TRISA protocol error: could not parse ReplyNotAfter timestamp in pending message: %s", err)
}

xfer.SetState(pb.TransactionState_ACCEPTED)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was the offending code, at this point we haven't responded to the original Transfer RPC so creating a new transfer back to the beneficiary violates the ordering a bit. The change is to move the new transfer to the async handler instead.


xfer.SetState(pb.TransactionState_ACCEPTED)
return nil
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is where the code was copied to to fix the ordering issue.

@pdeziel pdeziel requested a review from DanielSollis July 13, 2022 20:06
Copy link
Contributor

@DanielSollis DanielSollis left a comment

Choose a reason for hiding this comment

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

Looks good! don't see any spelling issues and the live code review went well, good job!

@pdeziel pdeziel merged commit 57238d6 into main Jul 13, 2022
@pdeziel pdeziel deleted the sc-7148 branch July 13, 2022 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants