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

singleton manager: use ASSERT_IS_MAIN_OR_TEST_THREAD rather than comparing tid directly #34766

Merged
merged 3 commits into from
Jun 17, 2024

Conversation

wbpcode
Copy link
Member

@wbpcode wbpcode commented Jun 16, 2024

Commit Message: singleton manager: use ASSERT_IS_MAIN_OR_TEST_THREAD rather than comparing tid directly
Additional Description:

Singleton manager is introduced in the #1410 and tid comparing is used to ensure the singleton manager is only used in the thread where it's created (main thread or test thread).

However, in the integration test, the singleton manager is created in the separated thread and we cannot access it in the test thread.

This PR updated the tid comparing to the ASSERT_IS_MAIN_OR_TEST_THREAD to resolve the problem. (And I think the ASSERT_IS_MAIN_OR_TEST_THREAD macro should be an unified way to ensure we are in the main thread)

Risk Level: low.
Testing: n/a.
Docs Changes: n/a.
Release Notes: n/a.
Platform Specific Features: n/a.

wbpcode added 2 commits June 16, 2024 03:22
…aring tid directly

Signed-off-by: wbpcode <wbphub@live.com>
Signed-off-by: wbpcode <wbphub@live.com>
Signed-off-by: wbpcode <wbphub@live.com>
@wbpcode wbpcode merged commit 5708695 into envoyproxy:main Jun 17, 2024
51 of 52 checks passed
wbpcode pushed a commit to wbpcode/envoy that referenced this pull request Jun 18, 2024
Signed-off-by: wbpcode <wbphub@live.com>
Nealsoni00 pushed a commit to Nealsoni00/envoy that referenced this pull request Jun 18, 2024
…aring tid directly (envoyproxy#34766)

* singleton manager: use ASSERT_IS_MAIN_OR_TEST_THREAD rather than comparing tid directly

Signed-off-by: wbpcode <wbphub@live.com>

* fix test

Signed-off-by: wbpcode <wbphub@live.com>

* fix test

Signed-off-by: wbpcode <wbphub@live.com>

---------

Signed-off-by: wbpcode <wbphub@live.com>
Co-authored-by: wbpcode <wbphub@live.com>
Signed-off-by: Neal Soni <Nealsoni00@gmail.com>
wbpcode added a commit that referenced this pull request Jun 21, 2024
* local rate limit: add cross local cluster rate limit support

Signed-off-by: wbpcode <wbphub@live.com>

* change log

Signed-off-by: wbpcode <wbphub@live.com>

* fix typo

Signed-off-by: wbpcode <wbphub@live.com>

* add integration tests

Signed-off-by: wbpcode <wbphub@live.com>

* fix test

Signed-off-by: wbpcode <wbphub@live.com>

* main thread assert

Signed-off-by: wbpcode <wbphub@live.com>

* Update api/envoy/extensions/common/ratelimit/v3/ratelimit.proto

Co-authored-by: Adi (Suissa) Peleg <adip@google.com>
Signed-off-by: code <wangbaiping@corp.netease.com>

* Update api/envoy/extensions/filters/http/local_ratelimit/v3/local_rate_limit.proto

Co-authored-by: Adi (Suissa) Peleg <adip@google.com>
Signed-off-by: code <wangbaiping@corp.netease.com>

* address comments

Signed-off-by: wbpcode <wbphub@live.com>

* remove macro after #34766

Signed-off-by: wbpcode <wbphub@live.com>

* resolve confliction after merge main

Signed-off-by: wbpcode <wbphub@live.com>

---------

Signed-off-by: wbpcode <wbphub@live.com>
Signed-off-by: code <wangbaiping@corp.netease.com>
Co-authored-by: wbpcode <wbphub@live.com>
Co-authored-by: Adi (Suissa) Peleg <adip@google.com>
nbaws pushed a commit to nbaws/envoy that referenced this pull request Jun 22, 2024
…oxy#34276)

* local rate limit: add cross local cluster rate limit support

Signed-off-by: wbpcode <wbphub@live.com>

* change log

Signed-off-by: wbpcode <wbphub@live.com>

* fix typo

Signed-off-by: wbpcode <wbphub@live.com>

* add integration tests

Signed-off-by: wbpcode <wbphub@live.com>

* fix test

Signed-off-by: wbpcode <wbphub@live.com>

* main thread assert

Signed-off-by: wbpcode <wbphub@live.com>

* Update api/envoy/extensions/common/ratelimit/v3/ratelimit.proto

Co-authored-by: Adi (Suissa) Peleg <adip@google.com>
Signed-off-by: code <wangbaiping@corp.netease.com>

* Update api/envoy/extensions/filters/http/local_ratelimit/v3/local_rate_limit.proto

Co-authored-by: Adi (Suissa) Peleg <adip@google.com>
Signed-off-by: code <wangbaiping@corp.netease.com>

* address comments

Signed-off-by: wbpcode <wbphub@live.com>

* remove macro after envoyproxy#34766

Signed-off-by: wbpcode <wbphub@live.com>

* resolve confliction after merge main

Signed-off-by: wbpcode <wbphub@live.com>

---------

Signed-off-by: wbpcode <wbphub@live.com>
Signed-off-by: code <wangbaiping@corp.netease.com>
Co-authored-by: wbpcode <wbphub@live.com>
Co-authored-by: Adi (Suissa) Peleg <adip@google.com>
Signed-off-by: Nigel Brittain <nbaws@amazon.com>

change init behaviour

Signed-off-by: Nigel Brittain <nbaws@amazon.com>

extraneous comments

Signed-off-by: Nigel Brittain <nbaws@amazon.com>

fix cluster init

Signed-off-by: Nigel Brittain <nbaws@amazon.com>

cluster fix

Signed-off-by: Nigel Brittain <nbaws@amazon.com>

format

Signed-off-by: Nigel Brittain <nbaws@amazon.com>

Signed-off-by: code <wbphub@gmail.com>
antoniovleonti pushed a commit to antoniovleonti/envoy that referenced this pull request Jun 26, 2024
…aring tid directly (envoyproxy#34766)

* singleton manager: use ASSERT_IS_MAIN_OR_TEST_THREAD rather than comparing tid directly

Signed-off-by: wbpcode <wbphub@live.com>

* fix test

Signed-off-by: wbpcode <wbphub@live.com>

* fix test

Signed-off-by: wbpcode <wbphub@live.com>

---------

Signed-off-by: wbpcode <wbphub@live.com>
Co-authored-by: wbpcode <wbphub@live.com>
Signed-off-by: antoniovleonti <leonti@google.com>
antoniovleonti pushed a commit to antoniovleonti/envoy that referenced this pull request Jun 26, 2024
…oxy#34276)

* local rate limit: add cross local cluster rate limit support

Signed-off-by: wbpcode <wbphub@live.com>

* change log

Signed-off-by: wbpcode <wbphub@live.com>

* fix typo

Signed-off-by: wbpcode <wbphub@live.com>

* add integration tests

Signed-off-by: wbpcode <wbphub@live.com>

* fix test

Signed-off-by: wbpcode <wbphub@live.com>

* main thread assert

Signed-off-by: wbpcode <wbphub@live.com>

* Update api/envoy/extensions/common/ratelimit/v3/ratelimit.proto

Co-authored-by: Adi (Suissa) Peleg <adip@google.com>
Signed-off-by: code <wangbaiping@corp.netease.com>

* Update api/envoy/extensions/filters/http/local_ratelimit/v3/local_rate_limit.proto

Co-authored-by: Adi (Suissa) Peleg <adip@google.com>
Signed-off-by: code <wangbaiping@corp.netease.com>

* address comments

Signed-off-by: wbpcode <wbphub@live.com>

* remove macro after envoyproxy#34766

Signed-off-by: wbpcode <wbphub@live.com>

* resolve confliction after merge main

Signed-off-by: wbpcode <wbphub@live.com>

---------

Signed-off-by: wbpcode <wbphub@live.com>
Signed-off-by: code <wangbaiping@corp.netease.com>
Co-authored-by: wbpcode <wbphub@live.com>
Co-authored-by: Adi (Suissa) Peleg <adip@google.com>
Signed-off-by: antoniovleonti <leonti@google.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.

None yet

2 participants