Skip to content

make grpcmux pause/resume come in pair by returning a RAII obj which resumes requests on destruction.#11739

Merged
htuch merged 21 commits intoenvoyproxy:masterfrom
stevenzzzz:raii-pause
Jul 9, 2020
Merged

make grpcmux pause/resume come in pair by returning a RAII obj which resumes requests on destruction.#11739
htuch merged 21 commits intoenvoyproxy:masterfrom
stevenzzzz:raii-pause

Conversation

@stevenzzzz
Copy link
Copy Markdown
Contributor

@stevenzzzz stevenzzzz commented Jun 24, 2020

make api pause/resume in pair by returning a RAII obj which resumes requests on destruction.

At present, the pause/resume appear in pair in most call sites, besides the clusterManagerImpl::updateClusterCounts(). this PR add some constraint to pause caller that they need to take care of the resume or the paused type-urls auto resume when the returned Cleanup is out of scope.

Ideally caller of Pause should always resume the resource when it's done, this is a step towards that goal.

Commit Message:
Additional Description:
Risk Level: low, mostly refactoring.
Testing: unit tests adjusted
Docs Changes: N/A
Release Notes: N/A
[Optional Runtime guard:]
[Optional Fixes #Issue] #11674

lizan and others added 9 commits March 2, 2020 14:27
Signed-off-by: Lizan Zhou <lizan@tetrate.io>
Signed-off-by: Xin Zhuang <stevenzzz@google.com>
Signed-off-by: Xin Zhuang <stevenzzz@google.com>
Signed-off-by: Xin Zhuang <stevenzzz@google.com>
Signed-off-by: Xin Zhuang <stevenzzz@google.com>
Signed-off-by: Xin Zhuang <stevenzzz@google.com>
…equests on destruction

Signed-off-by: Xin Zhuang <stevenzzz@google.com>
Signed-off-by: Xin Zhuang <stevenzzz@google.com>
Signed-off-by: Xin Zhuang <stevenzzz@google.com>
@repokitteh-read-only
Copy link
Copy Markdown

PTAL cannot be assigned to this issue.

🐱

Caused by: a #11739 (comment) was created by @stevenzzzz.

see: more, trace.

@stevenzzzz
Copy link
Copy Markdown
Contributor Author

/assign @htuch

…l be happy

Signed-off-by: Xin Zhuang <stevenzzz@google.com>
Copy link
Copy Markdown
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

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

Thanks so much @stevenzzzz for this change, this is a huge improvement to making pause/resume more robust.
/wait

std::unique_ptr<Cleanup> resume_rds;
// NOTE: This should be defined after noop_init_manager and resume_rds, as it depends on the
// noop_init_manager, and we want a single RDS discovery request to be sent to management server.
std::unique_ptr<Cleanup> init_noop_init_manager;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you give this a clearer name? It's easy to confuse noop_init_manager and init_noop_init_manager when reading.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

how about disposable_init_mgr?

Signed-off-by: Xin Zhuang <stevenzzz@google.com>
@stevenzzzz
Copy link
Copy Markdown
Contributor Author

thanks

Copy link
Copy Markdown
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

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

Looks good, a few minor comments.
/wait

// NOTE: This should be defined after noop_init_manager and resume_rds, as it depends on the
// noop_init_manager, and we want a single RDS discovery request to be sent to management server.
std::unique_ptr<Cleanup> init_noop_init_manager;
std::unique_ptr<Init::ManagerImpl> disposable_init_mgr;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggestion: call this srds_init_mgr

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

// NOTE: This should be defined after disposable_init_mgr and resume_rds, as it depends on the
// disposable_init_mgr, and we want a single RDS discovery request to be sent to management
// server.
std::unique_ptr<Cleanup> init_disposable_init_mgr;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggestion: call this srds_initialization_continuation

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done, indeed a better name.

)EOF";
Protobuf::RepeatedPtrField<ProtobufWkt::Any> resources;
parseScopedRouteConfigurationFromYaml(*resources.Add(), config_yaml);
init_watcher_.expectReady().Times(1);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: Times(1) is redundant, that is the default.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Signed-off-by: Xin Zhuang <stevenzzz@google.com>
Signed-off-by: Xin Zhuang <stevenzzz@google.com>
Signed-off-by: Xin Zhuang <stevenzzz@google.com>
Signed-off-by: Xin Zhuang <stevenzzz@google.com>
@stevenzzzz
Copy link
Copy Markdown
Contributor Author

/retest

@repokitteh-read-only
Copy link
Copy Markdown

🤷‍♀️ nothing to rebuild.

🐱

Caused by: a #11739 (comment) was created by @stevenzzzz.

see: more, trace.

htuch
htuch previously approved these changes Jun 29, 2020
Copy link
Copy Markdown
Member

@htuch htuch 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!

@htuch
Copy link
Copy Markdown
Member

htuch commented Jun 29, 2020

@stevenzzzz approved, but master merges are blocked until the security release tomorrow. I'm going to leave #11674 open still until we sort out the story with cluster manager and refcounts (can you comment there? thanks).

@stevenzzzz
Copy link
Copy Markdown
Contributor Author

stevenzzzz commented Jun 29, 2020 via email

@stevenzzzz stevenzzzz changed the title [WIP] make grpcmux pause/resume come in pair by returning a RAII obj which resumes requests on destruction. make grpcmux pause/resume come in pair by returning a RAII obj which resumes requests on destruction. Jun 29, 2020
@htuch
Copy link
Copy Markdown
Member

htuch commented Jul 1, 2020

@stevenzzzz can you merge master? Thanks.

Signed-off-by: Xin Zhuang <stevenzzz@google.com>
Signed-off-by: Xin Zhuang <stevenzzz@google.com>
Signed-off-by: Xin Zhuang <stevenzzz@google.com>
@stevenzzzz stevenzzzz force-pushed the raii-pause branch 2 times, most recently from 00817ed to 6e0a725 Compare July 8, 2020 02:42
@stevenzzzz stevenzzzz requested a review from dio as a code owner July 8, 2020 02:42
@stevenzzzz
Copy link
Copy Markdown
Contributor Author

sorry, had a git problem locally, had to force push.
Synced to upstream head, and addressed harvey's last round review comments.

Copy link
Copy Markdown
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

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

@stevenzzzz LGTM, but there is some strange formatting in this PR (hence why I'm sure CI is failing). Can you fix_format?

Signed-off-by: Xin Zhuang <stevenzzz@google.com>
Signed-off-by: Xin Zhuang <stevenzzz@google.com>
Signed-off-by: Xin Zhuang <stevenzzz@google.com>
@stevenzzzz
Copy link
Copy Markdown
Contributor Author

seems like a clang version problem, formatted using "tools/code_format/check_format.py fix" with clang10 now.

@stevenzzzz
Copy link
Copy Markdown
Contributor Author

/retest
(I dont know if it works)

@repokitteh-read-only
Copy link
Copy Markdown

🤷‍♀️ nothing to rebuild.

🐱

Caused by: a #11739 (comment) was created by @stevenzzzz.

see: more, trace.

@htuch htuch merged commit 81b5299 into envoyproxy:master Jul 9, 2020
scheler pushed a commit to scheler/envoy that referenced this pull request Aug 4, 2020
…resumes requests on destruction. (envoyproxy#11739)

* doc: fix SNI FAQ link (envoyproxy#10227)

Signed-off-by: Lizan Zhou <lizan@tetrate.io>

* make api pause/resume in pair by returning a RAII obj which resumes requests on destruction

Signed-off-by: Xin Zhuang <stevenzzz@google.com>

* cancel resume_cds_ on shutdown of clustermanagerImpl

Signed-off-by: Xin Zhuang <stevenzzz@google.com>

* format errors fix

Signed-off-by: Xin Zhuang <stevenzzz@google.com>

* move the ABSL_MUST_USE_RESULT attr to the beginning to see if gcc will be happy

Signed-off-by: Xin Zhuang <stevenzzz@google.com>

* pass by reference type_urls into cleanup in scoped rds

Signed-off-by: Xin Zhuang <stevenzzz@google.com>

* review fixes per Harvey comments.

Signed-off-by: Xin Zhuang <stevenzzz@google.com>

* remove unused parameter, weird it wasnt caught previously

Signed-off-by: Xin Zhuang <stevenzzz@google.com>

* fix-format using clang 10

Signed-off-by: Xin Zhuang <stevenzzz@google.com>

Co-authored-by: Lizan Zhou <lizan@tetrate.io>
Signed-off-by: scheler <santosh.cheler@appdynamics.com>
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.

3 participants