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

[Windows] Onboard Envoy to SCM #14352

Merged
merged 30 commits into from
Mar 4, 2021
Merged

[Windows] Onboard Envoy to SCM #14352

merged 30 commits into from
Mar 4, 2021

Conversation

davinci26
Copy link
Member

@davinci26 davinci26 commented Dec 9, 2020

Signed-off-by: Sotiris Nanopoulos sonanopo@microsoft.com
Commit Message:
Fixes #13188

Additional Description:

Utilizes the same inter process communication as signal_impl to handle close.

Pending work:

  • Add tests
  • Add documentation on how to use the feature

Risk Level: Low (Windows Only)
Testing: Unit/Integration

Docs Changes: Added on how to run Envoy
Release Notes: N/A

@davinci26
Copy link
Member Author

Creating as draft to have an idea of what the CI is thinking and get some early feedback

@davinci26
Copy link
Member Author

@envoyproxy/windows-dev want to do an early pass to see if this going to the correct direction?

Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
source/exe/main_common.cc Outdated Show resolved Hide resolved
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
examples/mysql/envoy.yaml Outdated Show resolved Hide resolved
Sotiris Nanopoulos added 3 commits December 10, 2020 16:59
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
@davinci26 davinci26 marked this pull request as ready for review December 11, 2020 01:50
Copy link
Member

@sunjayBhatia sunjayBhatia left a comment

Choose a reason for hiding this comment

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

First high level pass looks good overall, some changes requested in comments

source/exe/win32/service_base.cc Show resolved Hide resolved
source/exe/win32/service_base.cc Outdated Show resolved Hide resolved
source/exe/win32/service_base.h Show resolved Hide resolved
test/exe/win32_scm_test.cc Show resolved Hide resolved
Sotiris Nanopoulos added 10 commits December 11, 2020 10:20
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
@davinci26
Copy link
Member Author

/retest

@repokitteh-read-only
Copy link

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #14352 (comment) was created by @davinci26.

see: more, trace.

@davinci26
Copy link
Member Author

davinci26 commented Dec 14, 2020

@wrowe this is ready for review. Please take a look when you have time

Sotiris Nanopoulos added 2 commits December 14, 2020 15:31
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
Signed-off-by: Sotiris Nanopoulos <sonanopo@microsoft.com>
@davinci26
Copy link
Member Author

@wrowe can we get this on track to get merged since 1.17 is out now

Base automatically changed from master to main January 15, 2021 23:02
@davinci26
Copy link
Member Author

@wrowe just a ping for a review

Copy link
Contributor

@wrowe wrowe left a comment

Choose a reason for hiding this comment

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

Re-reviewed with two key concerns, the suggested sc.exe args, and whether we want to utilize preshutdown, see the description of preshutdown in https://docs.microsoft.com/en-us/windows/win32/services/service-control-handler-function

source/exe/win32/service_base.h Outdated Show resolved Hide resolved
docs/root/start/quick-start/run-envoy.rst Outdated Show resolved Hide resolved
wrowe
wrowe previously approved these changes Feb 17, 2021
Copy link
Contributor

@wrowe wrowe left a comment

Choose a reason for hiding this comment

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

LGTM thanks for the contribution and iterating through all our nits.

@envoyproxy/senior-maintainers could someone give this new facility a final pass?

@wrowe wrowe added the enhancement Feature requests. Not bugs or questions. label Feb 17, 2021
@wrowe wrowe added this to the 1.18.0 milestone Feb 17, 2021
@davinci26
Copy link
Member Author

@envoyproxy/senior-maintainers anyone interested in reviewing this one?

@davinci26
Copy link
Member Author

@envoyproxy/senior-maintainers anyone interested in doing a win32 code review to get this one merged?

@mattklein123 mattklein123 self-assigned this Feb 27, 2021
@mattklein123
Copy link
Member

I can take a look.

Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

LGTM at a high level (I skimmed the win32 code) with some small comments. Thank you!

/wait

source/exe/BUILD Outdated Show resolved Hide resolved
source/exe/main_common.h Outdated Show resolved Hide resolved
source/exe/win32/service_base.cc Outdated Show resolved Hide resolved
Signed-off-by: davinci26 <sotirisnan@gmail.com>
Signed-off-by: davinci26 <sotirisnan@gmail.com>
Signed-off-by: davinci26 <sotirisnan@gmail.com>
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Thanks!

@davinci26
Copy link
Member Author

picking up main to fix the CI

@mattklein123 mattklein123 merged commit 207319e into envoyproxy:main Mar 4, 2021
char data[] = {'a'};
Buffer::RawSlice buffer{data, 1};
auto result = handler->writev(&buffer, 1);
RELEASE_ASSERT(result.rc_ == 1,
Copy link
Member

Choose a reason for hiding this comment

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

@davinci26 how come we are using RELEASE_ASSERT here for error handling? This doesn't match error handling policy in https://github.com/envoyproxy/envoy/blob/main/STYLE.md#error-handling I believe. CC @asraa

Copy link
Member

Choose a reason for hiding this comment

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

Or maybe it's fine because you are on the way out anyway? I'd be interested in your take @davinci26 on all the RELEASE_ASSERTs in this module relative to the policy. I actually think it might be fine, but it's hard to tell without understanding the Windows API expectations.

Copy link
Member Author

Choose a reason for hiding this comment

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

Or maybe it's fine because you are on the way out anyway?

Exactly, we have already received a SIGTERM from the service control manager which means that for some reason we need to shutdown anyway. We try to do it in a graceful way but if the write fails we might as well crash.

The rest of the release asserts are guarding against a developer shooting themselves at the foot. i.e. someone manually calling delete the pointers on the global scope. I added the release asserts for them based on or an obvious crash on a subsequent line via null pointer dereference.. No strong opinion though.

Do you want me to document these in code with comments so it's clear for anyone reading the code?

@@ -1,5 +1,9 @@
#include "exe/main_common.h"

#ifdef WIN32
#include "exe/service_base.h"

Choose a reason for hiding this comment

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

I am a new hand to envoy, but there seems no service_base.h header file in ./source/exe/. Should it be #include "exe/win32/service_base.h"?

Copy link
Member Author

Choose a reason for hiding this comment

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

Are you encountering any issues compiling this or just curious? We use the strip_prefix tag on here https://github.com/davinci26/envoy/blob/6650ba0799592927005f59fc00472ce67c03da37/source/exe/BUILD#L196 and this is why win32 is not needed

Choose a reason for hiding this comment

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

Just curious about it, thanks a lot for your help : )

Copy link
Member Author

Choose a reason for hiding this comment

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

No prob, happy to help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/windows enhancement Feature requests. Not bugs or questions.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Process Control on Windows
7 participants