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

connector-init: start listening on tcp port before check_protocol #1127

Merged
merged 2 commits into from
Jul 31, 2023

Conversation

mdibaiee
Copy link
Member

@mdibaiee mdibaiee commented Jul 27, 2023

Description:

  • With this change, we start listening on the tcp port in connector-init as soon as possible, but we don't process the requests while we check the protocol. After we have checked the protocol, we use the incoming stream to serve requests.
  • This allows clients to connect to the server earlier and write to it, in a sense buffering some request(s)
  • This is motivated by our code in flowctl's docker_run not being able to clearly distinguish between a port that it can connect to, and a port that is ready for data to be written to it here. It's still a mystery to me how the go implementation of the same connection works fine and waits until the grpc server actually starts processing before it considers the connection as ready. The relevant go code is here and Tonic seems to conceptually check for readiness here, however it seems it has a different formulation of readiness.

I still don’t love this, because I would like to understand why the tonic client considers the connection ready and the go client doesn’t, and ideally we would have the tonic client behave similar to the go client…

Workflow steps:

(How does one use this feature, and how has it changed)

Documentation links affected:

(list any documentation links that you created, or existing ones that you've identified as needing updates, along with a brief description)

Notes for reviewers:

(anything that might help someone review this PR)


This change is Reviewable

@mdibaiee mdibaiee force-pushed the mahdi/flowctl-raw-discover branch 3 times, most recently from b29ee73 to 1d214fc Compare July 27, 2023 13:12
"--publish", &format!("0.0.0.0:{}:{}/tcp", port, CONNECTOR_INIT_PORT),
"--entrypoint",
target_connector_init,
"--mount", &format!("type=bind,source={host_inspect_str},target={target_inspect}"),
image,
&format!("--image-inspect-json-path={target_inspect}"),
&format!("--port={CONNECTOR_INIT_PORT}"),
], args].concat())
Copy link
Member Author

Choose a reason for hiding this comment

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

Updated the arguments here to match the ones in container.go

Copy link
Member

Choose a reason for hiding this comment

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

rust fmt? perhaps sort --flags ?

Also remove LOG_LEVEL=trace ? that's going to be very verbose.

@mdibaiee mdibaiee changed the title flowctl: fix flowctl raw connection (broken transport) connector-init: start listening on tcp port before check_protocol Jul 27, 2023
Copy link
Member

@jgraettinger jgraettinger left a comment

Choose a reason for hiding this comment

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

LGTM % comments

"--publish", &format!("0.0.0.0:{}:{}/tcp", port, CONNECTOR_INIT_PORT),
"--entrypoint",
target_connector_init,
"--mount", &format!("type=bind,source={host_inspect_str},target={target_inspect}"),
image,
&format!("--image-inspect-json-path={target_inspect}"),
&format!("--port={CONNECTOR_INIT_PORT}"),
], args].concat())
Copy link
Member

Choose a reason for hiding this comment

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

rust fmt? perhaps sort --flags ?

Also remove LOG_LEVEL=trace ? that's going to be very verbose.

@mdibaiee mdibaiee merged commit aad3e0d into master Jul 31, 2023
4 checks passed
@mdibaiee mdibaiee deleted the mahdi/flowctl-raw-discover branch July 31, 2023 11:28
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.

2 participants