mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-24 16:59:26 +00:00
Polling filters (eth_newFilter, eth_newBlockFilter, eth_newPendingTransactionFilter) buffer incoming events between GetFilterChanges calls. If a client polls infrequently the internal slices (f.logs, f.hashes, f.txs) grow without bound, potentially consuming hundreds of MB of RAM under high event traffic. Add MaxPendingItems to Config (default 10 000). When a filter's queue exceeds this limit the oldest items are dropped to make room for new ones, keeping memory bounded at the cost of silently losing stale data. The drop-oldest policy is appropriate here because: - Events that exceed the cap are already "stale" relative to chain head - Clients that care about every event should use eth_subscribe instead of polling (which is the recommended pattern) Add a debug log line when items are dropped so operators can detect clients that poll too infrequently in their logs. Three new tests verify the cap behaviour for each filter type: TestPendingTxFilterQueueCap TestBlockFilterQueueCap TestLogFilterQueueCap |
||
|---|---|---|
| .. | ||
| catalyst | ||
| downloader | ||
| ethconfig | ||
| fetcher | ||
| filters | ||
| gasestimator | ||
| gasprice | ||
| protocols | ||
| syncer | ||
| tracers | ||
| api_admin.go | ||
| api_backend.go | ||
| api_backend_test.go | ||
| api_debug.go | ||
| api_debug_test.go | ||
| api_miner.go | ||
| backend.go | ||
| dropper.go | ||
| handler.go | ||
| handler_eth.go | ||
| handler_eth_test.go | ||
| handler_snap.go | ||
| handler_test.go | ||
| peer.go | ||
| peerset.go | ||
| state_accessor.go | ||
| sync.go | ||
| sync_test.go | ||