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

subscriber: clear per-layer interest when short circuiting #1569

Merged
merged 5 commits into from
Sep 16, 2021

Conversation

hawkw
Copy link
Member

@hawkw hawkw commented Sep 15, 2021

Currently, when evaluating register_callsite for a stack containing
per-layer filters, the intermediate Interest from combining the per
layer filters' Interests is stored in the thread-local FilterState.
When all per-layer filters have been evaluated, we reach the Registry,
which clears the FilterState and bubbles the Interest back up.
However, when a global filter in the stack returns Interest::never,
we short-circuit, and don't reach the Registry. This means the
Interest state is not cleared.

This branch adds code in Layered to ensure the per-layer filter state
is cleared when a global filter short circuits Interest evaluation.

This fixes #1563.

Signed-off-by: Eliza Weisman <[email protected]>
Signed-off-by: Eliza Weisman <[email protected]>
This test repros the bug the assertion was *supposed* to prevent.

Signed-off-by: Eliza Weisman <[email protected]>
@hawkw hawkw requested a review from a team September 15, 2021 21:00
@hawkw hawkw merged commit 3b8e680 into v0.1.x Sep 16, 2021
@hawkw hawkw deleted the eliza/fix-interest-panic branch September 16, 2021 02:45
hawkw added a commit that referenced this pull request Sep 16, 2021
# 0.2.23 (September 16, 2021)

This release fixes a few bugs in the per-layer filtering API added in
v0.2.21.

### Fixed

- **env-filter**: Fixed excessive `EnvFilter` memory use ([#1568])
- **filter**: Fixed a panic that may occur in debug mode when using
  per-layer filters together with global filters ([#1569])
- Fixed incorrect documentation formatting ([#1572])

[#1568]: #1568
[#1569]: #1569
[#1572]: #1572
hawkw added a commit that referenced this pull request Sep 16, 2021
# 0.2.23 (September 16, 2021)

This release fixes a few bugs in the per-layer filtering API added in
v0.2.21.

### Fixed

- **env-filter**: Fixed excessive `EnvFilter` memory use ([#1568])
- **filter**: Fixed a panic that may occur in debug mode when using
  per-layer filters together with global filters ([#1569])
- Fixed incorrect documentation formatting ([#1572])

[#1568]: #1568
[#1569]: #1569
[#1572]: #1572
hawkw added a commit that referenced this pull request Sep 17, 2021
This is essentially the same change as #1569, but for `enabled` states
rather than `register_callsite`. When a global filter returns `false`
from `enabled`, ensure that the per-layer filter `FilterMap` and debug
counters are cleared, so that they are empty on the next `enabled` call.

See #1563
hawkw added a commit that referenced this pull request Sep 17, 2021
This is essentially the same change as #1569, but for `enabled` states
rather than `register_callsite`. When a global filter returns `false`
from `enabled`, ensure that the per-layer filter `FilterMap` and debug
counters are cleared, so that they are empty on the next `enabled` call.

See #1563
hawkw added a commit that referenced this pull request Sep 19, 2021
This is essentially the same change as #1569, but for `enabled` states
rather than `register_callsite`. When a global filter returns `false`
from `enabled`, ensure that the per-layer filter `FilterMap` and debug
counters are cleared, so that they are empty on the next `enabled` call.

See #1563
davidbarsky pushed a commit that referenced this pull request Nov 29, 2021
Currently, when evaluating `register_callsite` for a stack containing
per-layer filters, the intermediate `Interest` from combining the per
layer filters' `Interest`s is stored in the thread-local `FilterState`.
When all per-layer filters have been evaluated, we reach the `Registry`,
which clears the `FilterState` and bubbles the `Interest` back up.
However, when a _global_ filter in the stack returns `Interest::never`,
we short-circuit, and don't reach the `Registry`. This means the
`Interest` state is not cleared.

This branch adds code in `Layered` to ensure the per-layer filter state
is cleared when a global filter short circuits `Interest` evaluation.

This fixes #1563.

Signed-off-by: Eliza Weisman <[email protected]>
davidbarsky pushed a commit that referenced this pull request Nov 29, 2021
This is essentially the same change as #1569, but for `enabled` states
rather than `register_callsite`. When a global filter returns `false`
from `enabled`, ensure that the per-layer filter `FilterMap` and debug
counters are cleared, so that they are empty on the next `enabled` call.

See #1563
davidbarsky pushed a commit that referenced this pull request Mar 18, 2022
Currently, when evaluating `register_callsite` for a stack containing
per-layer filters, the intermediate `Interest` from combining the per
layer filters' `Interest`s is stored in the thread-local `FilterState`.
When all per-layer filters have been evaluated, we reach the `Registry`,
which clears the `FilterState` and bubbles the `Interest` back up.
However, when a _global_ filter in the stack returns `Interest::never`,
we short-circuit, and don't reach the `Registry`. This means the
`Interest` state is not cleared.

This branch adds code in `Layered` to ensure the per-layer filter state
is cleared when a global filter short circuits `Interest` evaluation.

This fixes #1563.

Signed-off-by: Eliza Weisman <[email protected]>
davidbarsky pushed a commit that referenced this pull request Mar 18, 2022
This is essentially the same change as #1569, but for `enabled` states
rather than `register_callsite`. When a global filter returns `false`
from `enabled`, ensure that the per-layer filter `FilterMap` and debug
counters are cleared, so that they are empty on the next `enabled` call.

See #1563
hawkw added a commit that referenced this pull request Mar 23, 2022
Currently, when evaluating `register_callsite` for a stack containing
per-layer filters, the intermediate `Interest` from combining the per
layer filters' `Interest`s is stored in the thread-local `FilterState`.
When all per-layer filters have been evaluated, we reach the `Registry`,
which clears the `FilterState` and bubbles the `Interest` back up.
However, when a _global_ filter in the stack returns `Interest::never`,
we short-circuit, and don't reach the `Registry`. This means the
`Interest` state is not cleared.

This branch adds code in `Layered` to ensure the per-layer filter state
is cleared when a global filter short circuits `Interest` evaluation.

This fixes #1563.

Signed-off-by: Eliza Weisman <[email protected]>
hawkw added a commit that referenced this pull request Mar 23, 2022
This is essentially the same change as #1569, but for `enabled` states
rather than `register_callsite`. When a global filter returns `false`
from `enabled`, ensure that the per-layer filter `FilterMap` and debug
counters are cleared, so that they are empty on the next `enabled` call.

See #1563
hawkw added a commit that referenced this pull request Mar 23, 2022
Currently, when evaluating `register_callsite` for a stack containing
per-subscriber filters, the intermediate `Interest` from combining the
per-subscriber filters' `Interest`s is stored in the thread-local
`FilterState`. When all per-subscriber filters have been evaluated, we
reach the `Registry`, which clears the `FilterState` and bubbles the
`Interest` back up. However, when a _global_ filter in the stack returns
`Interest::never`, we short-circuit, and don't reach the `Registry`.
This means the `Interest` state is not cleared.

This branch adds code in `Layered` to ensure the per-subscriber filter
state is cleared when a global filter short circuits `Interest`
evaluation.

This fixes #1563.

Signed-off-by: Eliza Weisman <[email protected]>
hawkw added a commit that referenced this pull request Mar 23, 2022
This is essentially the same change as #1569, but for `enabled` states
rather than `register_callsite`. When a global filter returns `false`
from `enabled`, ensure that the per-subscriber filter `FilterMap` and
debug counters are cleared, so that they are empty on the next `enabled`
call.

See #1563
hawkw added a commit that referenced this pull request Mar 23, 2022
Currently, when evaluating `register_callsite` for a stack containing
per-subscriber filters, the intermediate `Interest` from combining the
per-subscriber filters' `Interest`s is stored in the thread-local
`FilterState`. When all per-subscriber filters have been evaluated, we
reach the `Registry`, which clears the `FilterState` and bubbles the
`Interest` back up. However, when a _global_ filter in the stack returns
`Interest::never`, we short-circuit, and don't reach the `Registry`.
This means the `Interest` state is not cleared.

This branch adds code in `Layered` to ensure the per-subscriber filter
state is cleared when a global filter short circuits `Interest`
evaluation.

This fixes #1563.

Signed-off-by: Eliza Weisman <[email protected]>
hawkw added a commit that referenced this pull request Mar 23, 2022
This is essentially the same change as #1569, but for `enabled` states
rather than `register_callsite`. When a global filter returns `false`
from `enabled`, ensure that the per-subscriber filter `FilterMap` and
debug counters are cleared, so that they are empty on the next `enabled`
call.

See #1563
hawkw added a commit that referenced this pull request Mar 24, 2022
Currently, when evaluating `register_callsite` for a stack containing
per-subscriber filters, the intermediate `Interest` from combining the
per-subscriber filters' `Interest`s is stored in the thread-local
`FilterState`. When all per-subscriber filters have been evaluated, we
reach the `Registry`, which clears the `FilterState` and bubbles the
`Interest` back up. However, when a _global_ filter in the stack returns
`Interest::never`, we short-circuit, and don't reach the `Registry`.
This means the `Interest` state is not cleared.

This branch adds code in `Layered` to ensure the per-subscriber filter
state is cleared when a global filter short circuits `Interest`
evaluation.

This fixes #1563.

Signed-off-by: Eliza Weisman <[email protected]>
hawkw added a commit that referenced this pull request Mar 24, 2022
This is essentially the same change as #1569, but for `enabled` states
rather than `register_callsite`. When a global filter returns `false`
from `enabled`, ensure that the per-subscriber filter `FilterMap` and
debug counters are cleared, so that they are empty on the next `enabled`
call.

See #1563
hawkw added a commit that referenced this pull request Mar 24, 2022
Currently, when evaluating `register_callsite` for a stack containing
per-subscriber filters, the intermediate `Interest` from combining the
per-subscriber filters' `Interest`s is stored in the thread-local
`FilterState`. When all per-subscriber filters have been evaluated, we
reach the `Registry`, which clears the `FilterState` and bubbles the
`Interest` back up. However, when a _global_ filter in the stack returns
`Interest::never`, we short-circuit, and don't reach the `Registry`.
This means the `Interest` state is not cleared.

This branch adds code in `Layered` to ensure the per-subscriber filter
state is cleared when a global filter short circuits `Interest`
evaluation.

This fixes #1563.

Signed-off-by: Eliza Weisman <[email protected]>
hawkw added a commit that referenced this pull request Mar 24, 2022
This is essentially the same change as #1569, but for `enabled` states
rather than `register_callsite`. When a global filter returns `false`
from `enabled`, ensure that the per-subscriber filter `FilterMap` and
debug counters are cleared, so that they are empty on the next `enabled`
call.

See #1563
hawkw added a commit that referenced this pull request Mar 24, 2022
Currently, when evaluating `register_callsite` for a stack containing
per-subscriber filters, the intermediate `Interest` from combining the
per-subscriber filters' `Interest`s is stored in the thread-local
`FilterState`. When all per-subscriber filters have been evaluated, we
reach the `Registry`, which clears the `FilterState` and bubbles the
`Interest` back up. However, when a _global_ filter in the stack returns
`Interest::never`, we short-circuit, and don't reach the `Registry`.
This means the `Interest` state is not cleared.

This branch adds code in `Layered` to ensure the per-subscriber filter
state is cleared when a global filter short circuits `Interest`
evaluation.

This fixes #1563.

Signed-off-by: Eliza Weisman <[email protected]>
hawkw added a commit that referenced this pull request Mar 24, 2022
This is essentially the same change as #1569, but for `enabled` states
rather than `register_callsite`. When a global filter returns `false`
from `enabled`, ensure that the per-subscriber filter `FilterMap` and
debug counters are cleared, so that they are empty on the next `enabled`
call.

See #1563
hawkw added a commit that referenced this pull request Mar 24, 2022
Currently, when evaluating `register_callsite` for a stack containing
per-subscriber filters, the intermediate `Interest` from combining the
per-subscriber filters' `Interest`s is stored in the thread-local
`FilterState`. When all per-subscriber filters have been evaluated, we
reach the `Registry`, which clears the `FilterState` and bubbles the
`Interest` back up. However, when a _global_ filter in the stack returns
`Interest::never`, we short-circuit, and don't reach the `Registry`.
This means the `Interest` state is not cleared.

This branch adds code in `Layered` to ensure the per-subscriber filter
state is cleared when a global filter short circuits `Interest`
evaluation.

This fixes #1563.

Signed-off-by: Eliza Weisman <[email protected]>
hawkw added a commit that referenced this pull request Mar 24, 2022
This is essentially the same change as #1569, but for `enabled` states
rather than `register_callsite`. When a global filter returns `false`
from `enabled`, ensure that the per-subscriber filter `FilterMap` and
debug counters are cleared, so that they are empty on the next `enabled`
call.

See #1563
hawkw added a commit that referenced this pull request Mar 24, 2022
Currently, when evaluating `register_callsite` for a stack containing
per-subscriber filters, the intermediate `Interest` from combining the
per-subscriber filters' `Interest`s is stored in the thread-local
`FilterState`. When all per-subscriber filters have been evaluated, we
reach the `Registry`, which clears the `FilterState` and bubbles the
`Interest` back up. However, when a _global_ filter in the stack returns
`Interest::never`, we short-circuit, and don't reach the `Registry`.
This means the `Interest` state is not cleared.

This branch adds code in `Layered` to ensure the per-subscriber filter
state is cleared when a global filter short circuits `Interest`
evaluation.

This fixes #1563.

Signed-off-by: Eliza Weisman <[email protected]>
hawkw added a commit that referenced this pull request Mar 24, 2022
This is essentially the same change as #1569, but for `enabled` states
rather than `register_callsite`. When a global filter returns `false`
from `enabled`, ensure that the per-subscriber filter `FilterMap` and
debug counters are cleared, so that they are empty on the next `enabled`
call.

See #1563
hawkw added a commit that referenced this pull request Mar 24, 2022
Currently, when evaluating `register_callsite` for a stack containing
per-subscriber filters, the intermediate `Interest` from combining the
per-subscriber filters' `Interest`s is stored in the thread-local
`FilterState`. When all per-subscriber filters have been evaluated, we
reach the `Registry`, which clears the `FilterState` and bubbles the
`Interest` back up. However, when a _global_ filter in the stack returns
`Interest::never`, we short-circuit, and don't reach the `Registry`.
This means the `Interest` state is not cleared.

This branch adds code in `Layered` to ensure the per-subscriber filter
state is cleared when a global filter short circuits `Interest`
evaluation.

This fixes #1563.

Signed-off-by: Eliza Weisman <[email protected]>
hawkw added a commit that referenced this pull request Mar 24, 2022
This is essentially the same change as #1569, but for `enabled` states
rather than `register_callsite`. When a global filter returns `false`
from `enabled`, ensure that the per-subscriber filter `FilterMap` and
debug counters are cleared, so that they are empty on the next `enabled`
call.

See #1563
hawkw added a commit that referenced this pull request Mar 24, 2022
Currently, when evaluating `register_callsite` for a stack containing
per-subscriber filters, the intermediate `Interest` from combining the
per-subscriber filters' `Interest`s is stored in the thread-local
`FilterState`. When all per-subscriber filters have been evaluated, we
reach the `Registry`, which clears the `FilterState` and bubbles the
`Interest` back up. However, when a _global_ filter in the stack returns
`Interest::never`, we short-circuit, and don't reach the `Registry`.
This means the `Interest` state is not cleared.

This branch adds code in `Layered` to ensure the per-subscriber filter
state is cleared when a global filter short circuits `Interest`
evaluation.

This fixes #1563.

Signed-off-by: Eliza Weisman <[email protected]>
hawkw added a commit that referenced this pull request Mar 24, 2022
This is essentially the same change as #1569, but for `enabled` states
rather than `register_callsite`. When a global filter returns `false`
from `enabled`, ensure that the per-subscriber filter `FilterMap` and
debug counters are cleared, so that they are empty on the next `enabled`
call.

See #1563
hawkw added a commit that referenced this pull request Mar 24, 2022
Currently, when evaluating `register_callsite` for a stack containing
per-subscriber filters, the intermediate `Interest` from combining the
per-subscriber filters' `Interest`s is stored in the thread-local
`FilterState`. When all per-subscriber filters have been evaluated, we
reach the `Registry`, which clears the `FilterState` and bubbles the
`Interest` back up. However, when a _global_ filter in the stack returns
`Interest::never`, we short-circuit, and don't reach the `Registry`.
This means the `Interest` state is not cleared.

This branch adds code in `Layered` to ensure the per-subscriber filter
state is cleared when a global filter short circuits `Interest`
evaluation.

This fixes #1563.

Signed-off-by: Eliza Weisman <[email protected]>
hawkw added a commit that referenced this pull request Mar 24, 2022
This is essentially the same change as #1569, but for `enabled` states
rather than `register_callsite`. When a global filter returns `false`
from `enabled`, ensure that the per-subscriber filter `FilterMap` and
debug counters are cleared, so that they are empty on the next `enabled`
call.

See #1563
kaffarell pushed a commit to kaffarell/tracing that referenced this pull request May 22, 2024
…1569)

Currently, when evaluating `register_callsite` for a stack containing
per-layer filters, the intermediate `Interest` from combining the per
layer filters' `Interest`s is stored in the thread-local `FilterState`.
When all per-layer filters have been evaluated, we reach the `Registry`,
which clears the `FilterState` and bubbles the `Interest` back up.
However, when a _global_ filter in the stack returns `Interest::never`,
we short-circuit, and don't reach the `Registry`. This means the
`Interest` state is not cleared.

This branch adds code in `Layered` to ensure the per-layer filter state
is cleared when a global filter short circuits `Interest` evaluation.

This fixes tokio-rs#1563.

Signed-off-by: Eliza Weisman <[email protected]>
kaffarell pushed a commit to kaffarell/tracing that referenced this pull request May 22, 2024
# 0.2.23 (September 16, 2021)

This release fixes a few bugs in the per-layer filtering API added in
v0.2.21.

### Fixed

- **env-filter**: Fixed excessive `EnvFilter` memory use ([tokio-rs#1568])
- **filter**: Fixed a panic that may occur in debug mode when using
  per-layer filters together with global filters ([tokio-rs#1569])
- Fixed incorrect documentation formatting ([tokio-rs#1572])

[tokio-rs#1568]: tokio-rs#1568
[tokio-rs#1569]: tokio-rs#1569
[tokio-rs#1572]: tokio-rs#1572
kaffarell pushed a commit to kaffarell/tracing that referenced this pull request May 22, 2024
…s#1575)

This is essentially the same change as tokio-rs#1569, but for `enabled` states
rather than `register_callsite`. When a global filter returns `false`
from `enabled`, ensure that the per-layer filter `FilterMap` and debug
counters are cleared, so that they are empty on the next `enabled` call.

See tokio-rs#1563
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.

2 participants