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
ames: always ack recork pleas #6364
Conversation
135854c
to
233d957
Compare
~halbex-palheb is looking good, and with better performance since it has already acked thousands of recorks that many ships were sending to it. |
I'm wondering if there's a race condition here:
This is only possible if Ames will send a %cork before all the previous messages have been acked. I don't remember whether it does that or not. If this is in fact a problem, we could handle it by doing the following: when publisher receives a packet on a corked bone, check whether it's a %cork message -- if it is, ack it; otherwise, drop it. This would be legitimate because |
We found an issue with the solution proposed above. No-oping on the non-cork plea will mean that it's going to retry forever. One solution would be to guarantee that a cork plea is never sent if there are live packets in the pump, so the publisher will only remove the flow when all previous messages have been processed. This would happen in =/ future-cork=?
?& :: in-flight packets
::
?=(^ live.packet-pump-state.state)
:: are we trying to send a cork?
::
?=(^ ;;((soft [%$ path %cork ~]) (cue message-blob)))
==
?: future-cork
:: put the cork back in the queue and no-op
::
=. unsent-messages.state (~(put to unsent-messages.state) message-blob)
message-pump One concern here is how much will affect call cue on possibly many messages (but only if there are live packets) |
A different solution we have considered is to enforce on the receiver of a plea that there will be only 1 possible message in the future instead of the current 10. This will drop any future messages and guarantee that corks (the last message of a flow) are never processed before previous messages have been acked. |
After some thinking, the solution currently on this PR (always acking a plea send on a corking bone) seems to be fine because there's always going to be two scenarios here:
For both cases, whether to ack or nack the %plea message (in the scenario where the initial ack got lost, and the subscriber is trying to send it again) before the cork is irrelevant, if the flow has already been corked on the publisher. |
It sounds like this is ready for review then @yosoyubik — if so, please mark as Ready for Review. |
Fixes #6363
We have a reproduction betwen ~halbex-palbep and ~rontul-dantyr-norsyr-torryn, I'll put this fix in ~halbex-palheb to confirm that it work and will then open it for review.