Aias00 opened a new issue, #3548:
URL: https://github.com/apache/dubbo-go/issues/3548
### Problem
`BuildInvokerChain` discards the `bool` from `extension.GetFilter`, so an
unregistered filter name (typo, or a filter whose package wasn't imported)
produces a `FilterInvoker` with a **nil** `filter`, which nil-dereferences on
the first request:
```go
// protocol/protocolwrapper/protocol_filter_wrapper.go BuildInvokerChain
for _, filterName := range slices.Backward(filterNames) {
flt, _ := extension.GetFilter(strings.TrimSpace(filterName)) // bool
discarded
fi := &FilterInvoker{next: next, invoker: invoker, filter: flt} // flt
== nil if name unknown
next = fi
}
func (fi *FilterInvoker) Invoke(ctx context.Context, invocation
base.Invocation) result.Result {
result := fi.filter.Invoke(ctx, fi.next, invocation) // nil interface
deref -> panic
return fi.filter.OnResponse(ctx, result, fi.invoker, invocation)
}
```
`extension.GetFilter` returns `(nil, false)` for an unknown name
(`common/extension/filter.go:40-46`); the `bool` is the intended signal and is
thrown away. Setup succeeds; the first request through the chain panics instead
of failing loudly at boot.
### Current behavior
A configured filter name that is not registered (typo'd in config, or a
filter package not imported) → `FilterInvoker{filter: nil}` → every `Invoke`
through that chain nil-derefs the filter → panic.
### Expected behavior
An unregistered filter name should not silently produce a nil-filter chain
that panics at runtime; it should be skipped (logged) so misconfiguration is
visible without crashing requests.
### Suggested approach
Check the `bool` from `GetFilter`; on `!ok`, log an error and `continue`
(skip that filter, wrap the rest).
### Acceptance criteria
- [ ] An unknown filter name is skipped (no nil `FilterInvoker` built).
- [ ] The chain `Invoke` does not panic on the skipped-unknown path.
- [ ] Existing `TestProtocolFilterWrapperExport`/`Refer` remain green.
- [ ] Regression test catches the old nil-deref (verified to fail on the old
code).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]