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

Create port bindings instead of relying on docker random port bindings #443

Closed
colin-axner opened this issue Mar 16, 2023 · 2 comments · Fixed by #444
Closed

Create port bindings instead of relying on docker random port bindings #443

colin-axner opened this issue Mar 16, 2023 · 2 comments · Fixed by #444

Comments

@colin-axner
Copy link
Contributor

colin-axner commented Mar 16, 2023

Based on a lot of investigation, we believe there to be a bug in docker which is causing non-deterministic failures in our e2e's due to incorrect packet routing. The problem arises when relying on docker to do the port bindings for the rpc/grpc/p2p ports. I propose we provide in the host config for creating a container, the port bindings.

from the issue above, here is the summarized problem:

in either a workstation or in a shared CI agent or in a production docker cluster, any process can bind an arbitrary high port to itself, accidentally triggering this issue if the port is in the sequence that docker expects to be free.

and the summarized solution:

If a stable, predictable port is important, then specifying the port-mapping is the correct approach.


We will need to determine a starting port address and then increment by X for each chain and by Y for each node. For example:

Start at 32000.
Increment by 1000 per chain
Increment by 5 per node

chain a val 0: 32000, 32001, 32002 etc
chain a val 1: 32005, etc
chain b val 0: 33000, etc

The cosmos chain node type can be modified to store the full port bindings (it currently stores the host rpc and grpc ports). I believe the chain interface would need to be modified to support incrementing the starting port by its index. Maybe there's an alternative approach?

@colin-axner
Copy link
Contributor Author

Another option I explored was trying to prevent the port binding on [::]:<port>, but I could not seem to find a way to do this. Disabling IPv6 in the created docker network did not affect the container port bindings

@agouin
Copy link
Member

agouin commented Mar 17, 2023

Thank you for the investigation @colin-axner !
It would be wonderful if this is truly the root cause of the dreaded intermittent malformed HTTP response errors.

I took a stab at introducing the explicit port bindings while keeping automatic port allocation in #444

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 a pull request may close this issue.

2 participants