You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "Aias00 (via GitHub)" <gi...@apache.org> on 2026/07/26 17:28:21 UTC

[I] [BUG] protocolwrapper: BuildInvokerChain nil-deref panics on unknown filter name (GetFilter bool discarded) [dubbo-go]

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: notifications-unsubscribe@dubbo.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [I] [BUG] protocolwrapper: BuildInvokerChain nil-deref panics on unknown filter name (GetFilter bool discarded) [dubbo-go]

Posted by "Alanxtl (via GitHub)" <gi...@apache.org>.
Alanxtl commented on issue #3548:
URL: https://github.com/apache/dubbo-go/issues/3548#issuecomment-5086260219

   not planned


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [I] [BUG] protocolwrapper: BuildInvokerChain nil-deref panics on unknown filter name (GetFilter bool discarded) [dubbo-go]

Posted by "Alanxtl (via GitHub)" <gi...@apache.org>.
Alanxtl closed issue #3548: [BUG] protocolwrapper: BuildInvokerChain nil-deref panics on unknown filter name (GetFilter bool discarded)
URL: https://github.com/apache/dubbo-go/issues/3548


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org