test: fix server shutdown logic in IntegrationTestServerImpl destructor#44010
Open
kralicky wants to merge 1 commit intoenvoyproxy:mainfrom
Open
test: fix server shutdown logic in IntegrationTestServerImpl destructor#44010kralicky wants to merge 1 commit intoenvoyproxy:mainfrom
kralicky wants to merge 1 commit intoenvoyproxy:mainfrom
Conversation
Signed-off-by: Joe Kralicky <joekralicky@gmail.com>
Contributor
Author
|
Now that I think about it, I think this might still be prone to a data race, since observing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Commit Message: test: fix server shutdown logic in IntegrationTestServerImpl destructor
Additional Description:
This fixes the logic in ~IntegrationTestServerImpl() that determines whether or not the test server needs to be shut down during test cleanup. Previously, it is assumed that if the server was started, it will not have been shut down during the test, however this may not always be the case.
For example, I needed to write an integration test to exercise a callback registered to the
ServerLifecycleNotifier's ShutdownExit stage. In the body of the integration test, the following code would trigger a manual server shutdown:When the server is shut down during the test,
createAndRunEnvoyServer()running in a background thread exits afterserver.run()returns, causingIntegrationTestServerImpl::server_to now point to garbage. It also signals theserver_gone_notification.When the test completes and is torn down,
~IntegrationTestServerImpl()does not check to see ifserver_gone_was already notified during the test, and attempts to callserver_->dispatcher()and crashes.Risk Level: moderate (this code path is probably reached in every integration test)
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]