Skip to content

Commit a2f9400

Browse files
dependabot[bot]BobTheBuidlergithub-actions[bot]
authored
fix: narrow event watcher provider teardown guard (#2214)
* fix: narrow event watcher provider teardown guard * chore: compile C files for source control * docs: prepare changelog for 1.22.0 * docs: update changelog for latest 1.22.0 fixes --------- Co-authored-by: BobTheBuidler <bobthebuidlerdefi@gmail.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent a89953e commit a2f9400

6 files changed

Lines changed: 1017 additions & 690 deletions

File tree

CHANGELOG.md

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased](https://github.com/eth-brownie/brownie)
99

10-
## [1.22.0.dev1](https://github.com/eth-brownie/brownie/tree/v1.22.0.dev1) - 2026-01-06
10+
## [1.22.0](https://github.com/eth-brownie/brownie/tree/v1.22.0) - TBD
1111

1212
### Changed
1313
- Compile brownie to C to make it much faster and efficient ([#1875](https://github.com/eth-brownie/brownie/pull/1875) and others)
@@ -20,6 +20,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2020
- Various TypedDict definitions and other typing improvements
2121
- Expanded typing coverage and stricter mypy flags for better editor support ([#2051](https://github.com/eth-brownie/brownie/pull/2051), [#2053](https://github.com/eth-brownie/brownie/pull/2053), [#2056](https://github.com/eth-brownie/brownie/pull/2056), [#2082](https://github.com/eth-brownie/brownie/pull/2082), [#2086](https://github.com/eth-brownie/brownie/pull/2086), [#2110](https://github.com/eth-brownie/brownie/pull/2110))
2222
- Pinned build dependencies and wheel naming for consistent artifacts ([#2050](https://github.com/eth-brownie/brownie/pull/2050), [#2059](https://github.com/eth-brownie/brownie/pull/2059))
23+
- Upgrade web3 to v7 and update middleware integration ([#2128](https://github.com/eth-brownie/brownie/pull/2128))
24+
- Bump ujson from 5.11.0 to 5.12.0 ([#2131](https://github.com/eth-brownie/brownie/pull/2131))
25+
- Bump web3 from 7.14.1 to 7.15.0 ([#2138](https://github.com/eth-brownie/brownie/pull/2138))
26+
- Speed up stream downloads ([#2146](https://github.com/eth-brownie/brownie/pull/2146))
27+
- Bump ujson from 5.12.0 to 5.12.1 ([#2151](https://github.com/eth-brownie/brownie/pull/2151))
28+
- Microoptimize attr lookups ([#2159](https://github.com/eth-brownie/brownie/pull/2159))
29+
- Microoptimize attr lookups in transaction.py ([#2160](https://github.com/eth-brownie/brownie/pull/2160))
30+
- Use anvil as the default development backend ([#2163](https://github.com/eth-brownie/brownie/pull/2163))
31+
- Bump mypycify to v0.3.3 ([#2166](https://github.com/eth-brownie/brownie/pull/2166))
32+
- Homogenize testing stack across pythons ([#2177](https://github.com/eth-brownie/brownie/pull/2177))
33+
- Remove deprecated caches from release workflow ([#2178](https://github.com/eth-brownie/brownie/pull/2178))
34+
- Compile mypyc with --strict ([#2181](https://github.com/eth-brownie/brownie/pull/2181))
2335

2436
### Fixed
2537
- Prevent brownie console crash when X11 is not available ([#2088](https://github.com/eth-brownie/brownie/pull/2088))
@@ -32,6 +44,58 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3244
- typing for *args and **kwargs ([#1870](https://github.com/eth-brownie/brownie/pull/1870))
3345
- singleton metaclass instance typing ([#1888](https://github.com/eth-brownie/brownie/pull/1888))
3446
- various other minor typing issues
47+
- TypeError in `_get_deployment` ([#2122](https://github.com/eth-brownie/brownie/pull/2122))
48+
- solc download errors with py-solc-x >=2.0.5 ([#2126](https://github.com/eth-brownie/brownie/pull/2126))
49+
- web3.py v7 middleware integration ([#2136](https://github.com/eth-brownie/brownie/pull/2136))
50+
- Always release confirmed receipts ([#2142](https://github.com/eth-brownie/brownie/pull/2142))
51+
- Support forked pull requests in CI ([#2147](https://github.com/eth-brownie/brownie/pull/2147))
52+
- Remove unsafe `eval()` in networks.py ([#2152](https://github.com/eth-brownie/brownie/pull/2152))
53+
- Adapt test_event.py imports to web3 v7 ([#2156](https://github.com/eth-brownie/brownie/pull/2156))
54+
- web3.py v7 error handling ([#2157](https://github.com/eth-brownie/brownie/pull/2157))
55+
- solcx version handling ([#2158](https://github.com/eth-brownie/brownie/pull/2158))
56+
- Compile evm tests with matrix settings ([#2161](https://github.com/eth-brownie/brownie/pull/2161))
57+
- Make plugin isolation tests less brittle ([#2162](https://github.com/eth-brownie/brownie/pull/2162))
58+
- Anvil launcher options ([#2164](https://github.com/eth-brownie/brownie/pull/2164))
59+
- Rollback coverage calls with snapshots ([#2165](https://github.com/eth-brownie/brownie/pull/2165))
60+
- Decode anvil transaction return values ([#2167](https://github.com/eth-brownie/brownie/pull/2167))
61+
- Decode anvil revert data ([#2168](https://github.com/eth-brownie/brownie/pull/2168))
62+
- Recover dev revert strings from trace source ([#2169](https://github.com/eth-brownie/brownie/pull/2169))
63+
- Assert invalid given arguments directly ([#2170](https://github.com/eth-brownie/brownie/pull/2170))
64+
- Make plugin given block height backend neutral ([#2171](https://github.com/eth-brownie/brownie/pull/2171))
65+
- Normalize prefixed trace memory words ([#2172](https://github.com/eth-brownie/brownie/pull/2172))
66+
- Sync plugin child network config ([#2173](https://github.com/eth-brownie/brownie/pull/2173))
67+
- Declare package data namespace packages ([#2179](https://github.com/eth-brownie/brownie/pull/2179))
68+
- Fix new --strict errs ([#2182](https://github.com/eth-brownie/brownie/pull/2182))
69+
- Use current stdout in pytest printer ([#2183](https://github.com/eth-brownie/brownie/pull/2183))
70+
- Fix C file regeneration after pushes ([#2184](https://github.com/eth-brownie/brownie/pull/2184))
71+
- Fix core-ganache workflow ([#2185](https://github.com/eth-brownie/brownie/pull/2185))
72+
- Preserve ganache default account balance ([#2186](https://github.com/eth-brownie/brownie/pull/2186))
73+
- Allow non-isolated tests under xdist ([#2187](https://github.com/eth-brownie/brownie/pull/2187))
74+
- Load plugin child projects consistently under xdist ([#2188](https://github.com/eth-brownie/brownie/pull/2188))
75+
- Type source map ids as integers ([#2189](https://github.com/eth-brownie/brownie/pull/2189))
76+
- Fix given wrapper kwarg validation ([#2190](https://github.com/eth-brownie/brownie/pull/2190))
77+
- Stabilize plugin child fixture state ([#2191](https://github.com/eth-brownie/brownie/pull/2191))
78+
- Fix plugin child harness state ([#2192](https://github.com/eth-brownie/brownie/pull/2192))
79+
- Select backend-specific rpc tests ([#2193](https://github.com/eth-brownie/brownie/pull/2193))
80+
- Normalize ganache time travel ([#2194](https://github.com/eth-brownie/brownie/pull/2194))
81+
- Stabilize event watcher shutdown ([#2195](https://github.com/eth-brownie/brownie/pull/2195))
82+
- Normalize ganache time travel ([#2196](https://github.com/eth-brownie/brownie/pull/2196))
83+
- Link libraries from solc link references ([#2197](https://github.com/eth-brownie/brownie/pull/2197))
84+
- Harden event watcher shutdown lifecycle ([#2198](https://github.com/eth-brownie/brownie/pull/2198))
85+
- Serialize chain time-travel snapshots ([#2199](https://github.com/eth-brownie/brownie/pull/2199))
86+
- Guard empty Solidity metadata stripping ([#2200](https://github.com/eth-brownie/brownie/pull/2200))
87+
- Restore Ganache default account balance ([#2201](https://github.com/eth-brownie/brownie/pull/2201))
88+
- Compile multicall with the configured Ganache hardfork ([#2202](https://github.com/eth-brownie/brownie/pull/2202))
89+
- Use web3 v7 event filter keyword arguments ([#2203](https://github.com/eth-brownie/brownie/pull/2203))
90+
- Build web3 RPC error middleware tests with web3 objects ([#2204](https://github.com/eth-brownie/brownie/pull/2204))
91+
- Normalize fake solcx install versions in compiler tests ([#2205](https://github.com/eth-brownie/brownie/pull/2205))
92+
- Propagate project development cmd settings ([#2206](https://github.com/eth-brownie/brownie/pull/2206))
93+
- Honor explorer ABI fallback persistence ([#2207](https://github.com/eth-brownie/brownie/pull/2207))
94+
- Fix remaining bad test assumptions ([#2208](https://github.com/eth-brownie/brownie/pull/2208))
95+
- Run event callbacks once per nonrepeat watcher ([#2209](https://github.com/eth-brownie/brownie/pull/2209))
96+
- Remove pytest skip strict keyword ([#2210](https://github.com/eth-brownie/brownie/pull/2210))
97+
- Normalize explorer solc version checks ([#2211](https://github.com/eth-brownie/brownie/pull/2211))
98+
- Guard old Vyper output selection cleanup ([#2212](https://github.com/eth-brownie/brownie/pull/2212))
3599

36100
## [1.21.0](https://github.com/eth-brownie/brownie/tree/v1.21.0) - 2025-05-23
37101
### Fixed

brownie/network/event.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,12 @@ def _loop(self, stop_event: threading.Event) -> None:
518518
if stop_event.is_set():
519519
break
520520
# Check for new events without holding the watcher state lock.
521-
latest_events = elem.get_new_events()
521+
try:
522+
latest_events = elem.get_new_events()
523+
except AttributeError as exc:
524+
if _is_provider_teardown_error(exc):
525+
break
526+
raise
522527
if stop_event.is_set():
523528
break
524529
with self.target_list_lock:
@@ -681,6 +686,12 @@ def _create_event_filter(
681686
return event.create_filter(**filter_kwargs)
682687

683688

689+
def _is_provider_teardown_error(exc: AttributeError) -> bool:
690+
return web3.provider is None and (
691+
getattr(exc, "name", None) == "_is_batching" or "_is_batching" in str(exc)
692+
)
693+
694+
684695
# dictionary of event topic ABIs specific to a single contract deployment
685696
_deployment_topics: Final[DeploymentTopics] = {}
686697

0 commit comments

Comments
 (0)