Skip to content

server/multi: remove server-side message caching#699

Merged
chappjc merged 3 commits into
decred:status-integfrom
buck54321:no-msg-cache
Sep 24, 2020
Merged

server/multi: remove server-side message caching#699
chappjc merged 3 commits into
decred:status-integfrom
buck54321:no-msg-cache

Conversation

@buck54321
Copy link
Copy Markdown
Member

@buck54321 buck54321 commented Sep 22, 2020

Removes all server message caching, as well as the requirement to acknowledge match, audit, and redemption requests before progressing through match negotiation. This is intended to be the base upon which a match_status / order_status conflict resolution system is built. #677 is the order_status part.

@buck54321 buck54321 marked this pull request as draft September 22, 2020 22:26
Comment thread server/swap/state.go
// Swapper.liveAckers
LiveAckers map[uint64]*msgAckers
// Swapper.liveWaiters
LiveWaiters map[waiterKey]*handlerArgs
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We can probably get rid of LiveWaiters eventually too, but leaving for now.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If the client resubmits their init or redeem on reconnect?

Copy link
Copy Markdown
Member Author

@buck54321 buck54321 Sep 23, 2020

Choose a reason for hiding this comment

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

If we have a live coin waiter, we haven't acked the client's request, so it'll time out and try again anyways, I think.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Makes sense, client will reconnect, check match_status, and if needed do their 'init' or 'redeem' again. That the plan?

@buck54321 buck54321 marked this pull request as ready for review September 23, 2020 15:40
Copy link
Copy Markdown
Member

@chappjc chappjc left a comment

Choose a reason for hiding this comment

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

Diff looks great, quite simple actually. Despite ~1k loc of my code going to the scrap heap, I'm very happy about this change and the direction it's going.

Next steps will presumably be to revise Swapper bits (e.g. step to stop requiring ack sigs) and allowing for repeated init and redeem request from clients, then the accompanying {order,match}_status changes so clients can get back in the swap at any time as long as their match isn't revoked.

Comment thread server/swap/swap.go
Comment thread server/auth/auth.go
@chappjc
Copy link
Copy Markdown
Member

chappjc commented Sep 23, 2020

Next steps will presumably be to revise Swapper bits (e.g. step to stop requiring ack sigs) and allowing for repeated init and redeem request from clients, then the accompanying {order,match}_status changes so clients can get back in the swap at any time as long as their match isn't revoked.

Oh, this has the step changes already. Nice.

Copy link
Copy Markdown
Member

@itswisdomagain itswisdomagain left a comment

Choose a reason for hiding this comment

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

First pass. I think the message caching feature is completely retired (just a DefaultConnectTimeout constant that I think is now obsolete too). I still see that the server is set up to wait for and process acks for match-related requests. Any plans to completely do away with request acking?

Comment thread server/auth/auth.go
Comment thread server/auth/auth.go Outdated
Comment thread server/auth/auth.go Outdated
Comment thread server/auth/auth.go Outdated
Comment thread server/auth/auth.go Outdated
Comment on lines +566 to +567
// Disconnect and remove known connections. We are creating a new one,
// but persist the response handlers.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We might not create a new connection for this user if some error occurs downline before the call to auth.addClient(client). Is this intentional?

Oh I see that this was moved from below, I understand the reason for moving the account disabling check up here but is it necessary to remove any existing connection earlier as well?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I've refactored this a bit. See 0d6c83d

Comment thread server/market/orderrouter.go Outdated
Comment thread server/swap/swap.go Outdated
Comment thread server/swap/swap.go Outdated
Comment thread server/swap/swap.go
Comment on lines +1653 to +1654
log.Infof("Timeout waiting for contract 'audit' request acknowledgement from user %v (%s) for match %v",
ack.user, makerTaker(ack.isMaker), matchID)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks like we'll be getting a lot of these since clients are no longer required to send acks. Do you plan to subsequently retire this wait for ack feature for match-related requests? Basically, just send the request, if it doesn't get to the user, the match state can be recovered on connect.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I was thinking this was something we'd want in the logs. I do suspect that we'll see a few of these, but hopefully not too many. Are you thinking Debugf?

Comment thread server/swap/swap.go Outdated
@buck54321
Copy link
Copy Markdown
Member Author

Any plans to completely do away with request acking?

I'm certainly open to it. It's becoming less and less relevant.

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.

3 participants