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

Fix sse and nginx buffering #5042

Merged
merged 23 commits into from
Nov 21, 2020
Merged

Conversation

guzzijones
Copy link
Contributor

@guzzijones guzzijones commented Sep 16, 2020

Environment:

PYTHON_VERSION=python3.6 make requirements.txt

setup nginx st2.conf listening on 8443

server {
  listen       *:8443 ssl;
  client_max_body_size 5M;

  ssl on;

  ssl_certificate           /etc/ssl/st2/st2.crt;
  ssl_certificate_key       /etc/ssl/st2/st2.key;
  ssl_session_cache         shared:SSL:10m;
  ssl_session_timeout       5m;

client call:

python -m st2client.shell --debug  --auth-url https://localhost:8443/auth --api-url https://localhost:8443/api --stream-url https://localhost:8443/stream --cacert=False --skip-config pack install /home/ubuntu/utilstack --python3

What is the problem you're trying to solve with this patch?

#4842

What's the solution?

Solution is to watch the execution id status events and look for one of the LIVEACTION_STATUS_COMPLETED events

What's end event and end execution ID do?

tell the generator function in stream to stop sending events back to the client

How is the cacert option has to do with this change?

allows stream to use the --cacert option via command line. Needed this to test the change using a self signed certificate.

Proxy timeout?

sets a reasonable timeout for connection and for read. other endpoints have it as well.

@pull-request-size pull-request-size bot added the size/S PR that changes 10-29 lines. Very easy to review. label Sep 16, 2020
@guzzijones guzzijones changed the title attempt at fixing sse and nginx buffering WIP: attempt at fixing sse and nginx buffering Sep 16, 2020
@guzzijones
Copy link
Contributor Author

Well it turns out setting the timeout will cut off the stream going back to the client which causes other issues client side. Going to have to keep digging here.

@guzzijones guzzijones closed this Sep 18, 2020
@guzzijones guzzijones reopened this Sep 18, 2020
@pull-request-size pull-request-size bot added size/M PR that changes 30-99 lines. Good size to review. and removed size/S PR that changes 10-29 lines. Very easy to review. labels Sep 23, 2020
@guzzijones
Copy link
Contributor Author

looks like circle and travis had issues.
afaik this PR should pass.
Leaving it here for review.

@guzzijones guzzijones changed the title WIP: attempt at fixing sse and nginx buffering Fix sse and nginx buffering Sep 23, 2020
@guzzijones
Copy link
Contributor Author

Looks like this section of code is missing unit testing. I will create a few.

@pull-request-size pull-request-size bot added size/L PR that changes 100-499 lines. Requires some effort to review. and removed size/M PR that changes 30-99 lines. Good size to review. labels Sep 25, 2020
Copy link
Contributor

@m4dcoder m4dcoder left a comment

Choose a reason for hiding this comment

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

There's no description for the PR. It looks like you're trying to fix a hang on your setup. You have to provide more information in the description. How is your environment setup? What is the problem you're trying to solve with this patch? What's the solution? What's end event and end execution ID do? How is the cacert option has to do with this change? Proxy timeout? There's a lot of dial that are touched but there's no comments and no description what these options are fixing.

@punkrokk punkrokk requested a review from m4dcoder November 13, 2020 15:20
@m4dcoder m4dcoder added this to the 3.4.0 milestone Nov 13, 2020
Copy link
Contributor

@m4dcoder m4dcoder left a comment

Choose a reason for hiding this comment

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

Thank you for including detail explanation in the comments of this PR. This goes a long way to help reviewer understand the context of the change(s).

What happens if something is wrong and the expected end event and end execution ID never arrives? Will the client connection time out? What will the client output looks like in this case?

@guzzijones
Copy link
Contributor Author

Thank you for including detail explanation in the comments of this PR. This goes a long way to help reviewer understand the context of the change(s).

What happens if something is wrong and the expected end event and end execution ID never arrives? Will the client connection time out? What will the client output looks like in this case?

You would get the same UX as the current implementation of code without this change. The client will hang on writing the results to stdout and you will need to kill the command with ctrl-c.

@m4dcoder
Copy link
Contributor

@guzzijones Thanks for the clarification. Ok with the fix as the events cover most completed statuses and failure case when there's a connection issue or other unforeseen errors.

Copy link
Contributor

@m4dcoder m4dcoder left a comment

Choose a reason for hiding this comment

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

@guzzijones Thank you for contributing this fix.

Copy link
Member

@arm4b arm4b left a comment

Choose a reason for hiding this comment

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

Just a reminder that we'll need a Changelog for this fix before merging.

@guzzijones
Copy link
Contributor Author

guzzijones commented Nov 17, 2020 via email

update change log for PR StackStorm#5042 on github
update contributed by in changelog for long polling fix
edit change log per request for sse bugfix
@m4dcoder m4dcoder merged commit 5c4e5f8 into StackStorm:master Nov 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/L PR that changes 100-499 lines. Requires some effort to review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants