Skip to content

Conversation

karknu
Copy link
Contributor

@karknu karknu commented Mar 16, 2020

Implements #1395, apart from the multi-chunk message timeout.

@karknu karknu force-pushed the karknu/moar_timeouts branch from d429ebd to 27a9ee4 Compare March 16, 2020 17:06
@mrBliss mrBliss force-pushed the karknu/moar_timeouts branch from 27a9ee4 to 63b6755 Compare March 17, 2020 09:58
@karknu karknu force-pushed the karknu/moar_timeouts branch 10 times, most recently from 388066e to 51c77cd Compare March 19, 2020 09:28
@karknu karknu requested review from coot, dcoutts and mrBliss March 19, 2020 10:32
@karknu karknu marked this pull request as ready for review March 19, 2020 10:32
@karknu karknu force-pushed the karknu/moar_timeouts branch from 51c77cd to 87b14bb Compare March 19, 2020 13:56
@karknu karknu requested a review from njd42 March 19, 2020 15:25
Copy link
Contributor

@coot coot left a comment

Choose a reason for hiding this comment

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

@karknu I realised some of my comments are about size limits, while this PR is only about timeouts. I didn't removed them, as we need to discuss these anyway, but we can ignore them to approve this PR.

where
stateToLimit :: forall (pr :: PeerRole) (st :: BlockFetch block).
PeerHasAgency pr st -> Word
stateToLimit (ClientAgency TokIdle) = smallByteLimit
Copy link
Contributor

Choose a reason for hiding this comment

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

@karknu I think it would be good to document why all messages in the TokIdle state are smaller than: smallByteLimits. These are mostly trivial things , but it would be good to have it documented.

If we start using ToCBOR or at least have encodedSizeExpr for all the codecs we could add tests for these limits, let's create an issue for this. The limitation is that one cannot compute encodedSizeExpr of things like block or tx, but it's possible to do that for headers.

PeerHasAgency pr st -> Word
stateToLimit (ClientAgency TokIdle) = smallByteLimit
stateToLimit (ServerAgency TokBusy) = smallByteLimit
stateToLimit (ServerAgency TokStreaming) = largeByteLimit
Copy link
Contributor

Choose a reason for hiding this comment

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

We have a dependency between these limits and blockFetchProtocolLimits; I was more conservative there: I estimated max message size to 2_097_154 bytes (which is 2MB block + cbor overhead); I think these two limits (mux ingress queue size limits & per protocol state limits) should agree.

Copy link
Contributor

Choose a reason for hiding this comment

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

Strictly speaking they don't have to agree. The conjunction is enforced. But yes it's more consistent.

where
stateToLimit :: forall (pr :: PeerRole) (st :: ChainSync header tip).
PeerHasAgency pr st -> Word
stateToLimit (ClientAgency TokIdle) = smallByteLimit
Copy link
Contributor

Choose a reason for hiding this comment

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

The same here; But we actually know the maximal header size. It's documented in NodeToNode module, so we can give more adequate limits.

where
stateToLimit :: forall (pr :: PeerRole) (st :: TxSubmission txid tx).
PeerHasAgency pr st -> Word
stateToLimit (ClientAgency (TokTxIds TokBlocking)) = largeByteLimit
Copy link
Contributor

Choose a reason for hiding this comment

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

Also here we can use estimations which were calculated for mux ingress queue + enhancing the haddocks.

@karknu
Copy link
Contributor Author

karknu commented Mar 20, 2020

@coot I will update the size limit ticket with references to your byteLimits comments to ensure that they aren't forgotten.

@coot
Copy link
Contributor

coot commented Mar 20, 2020

@karknu thanks; then just please update the haddocs in this PR and I'll accept it.

Copy link
Contributor

@coot coot left a comment

Choose a reason for hiding this comment

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

LGTM; just a reminder to append to a comment.

Copy link
Contributor

@dcoutts dcoutts left a comment

Choose a reason for hiding this comment

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

Looking very good.

A couple questions and comments below.

PeerHasAgency pr st -> Word
stateToLimit (ClientAgency TokIdle) = smallByteLimit
stateToLimit (ServerAgency TokBusy) = smallByteLimit
stateToLimit (ServerAgency TokStreaming) = largeByteLimit
Copy link
Contributor

Choose a reason for hiding this comment

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

Strictly speaking they don't have to agree. The conjunction is enforced. But yes it's more consistent.

Comment on lines +38 to +39
stateToLimit (ClientAgency (TokTxIds TokBlocking)) = largeByteLimit
stateToLimit (ClientAgency (TokTxIds TokNonBlocking)) = largeByteLimit
Copy link
Contributor

Choose a reason for hiding this comment

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

I think these can be the small byte limit. The messages in this state are transaction ids, not transactions. With the 64k limit you could fit 2k tx ids. Our maximum outstanding window size is less than 2k. It's currently 100.

Also, this could be collapsed into one case with a wildcard on the blocking type.

@karknu karknu force-pushed the karknu/moar_timeouts branch 2 times, most recently from 6393b47 to a3fb47d Compare March 24, 2020 07:08
@karknu
Copy link
Contributor Author

karknu commented Mar 24, 2020

bors r+

iohk-bors bot added a commit that referenced this pull request Mar 24, 2020
1813: Protocol timeouts r=karknu a=karknu

Implements #1395, apart from the multi-chunk message timeout. 

Co-authored-by: Karl Knutsson <[email protected]>
@karknu
Copy link
Contributor Author

karknu commented Mar 24, 2020

bors r-

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Mar 24, 2020

Canceled

@karknu karknu force-pushed the karknu/moar_timeouts branch from a3fb47d to 4d72207 Compare March 24, 2020 13:08
karknu added 4 commits March 24, 2020 14:15
Implement an optional timeout for reading Mux SDUs.

This adds a 30s timeout when reading SDUs over a socketSnocket
(IPv4/IPv6). There is no timeout for reading messages over
localSnockets.
@karknu karknu force-pushed the karknu/moar_timeouts branch from 4d72207 to e0445d0 Compare March 24, 2020 13:22
@dcoutts
Copy link
Contributor

dcoutts commented Mar 24, 2020

bors r+

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Mar 24, 2020

@iohk-bors iohk-bors bot merged commit ea9aae7 into master Mar 24, 2020
@iohk-bors iohk-bors bot deleted the karknu/moar_timeouts branch March 24, 2020 14:41
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