Dispatcher panics when a failed delivery returns a response body larger than 768 bytes
Los mantenedores suelen responder en 1 día
@RaphaelFakhri ya está trabajando en esto.
Desde el 3/11/2026.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 74/100
Línea de trabajo
El panic viene de dispatchExecutionInfoTransformers en pkg/kncloudevents/event_dispatcher.go, alrededor de la línea 593, donde el búfer se limita a KnativeErrorDataExtensionMaxLength pero se codifica en él el cuerpo completo de la respuesta. Empieza leyendo esa función y el caso TestSendEvent invalid destination with a large response body and delivery option, y luego ejecútalo para reproducir el panic de índice fuera de rango. Está terminado cuando la prueba pasa con un cuerpo de más de 768 bytes y el valor knativeerrordata es el base64 del cuerpo truncado a 1024 caracteres.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
When a subscriber or trigger destination returns a non-2xx response with a body longer than 768 bytes, and the delivery has a dead letter sink (or a reply), the dispatcher panics with runtime error: index out of range in encoding/base64.(*Encoding).Encode.
dispatchExecutionInfoTransformers in pkg/kncloudevents/event_dispatcher.go caps the destination buffer at KnativeErrorDataExtensionMaxLength (1024) but encodes the whole response body into it:
encodedLen := base64.StdEncoding.EncodedLen(bodyLen)
if encodedLen > attributes.KnativeErrorDataExtensionMaxLength {
encodedLen = attributes.KnativeErrorDataExtensionMaxLength
}
encodedBuf := make([]byte, encodedLen)
base64.StdEncoding.Encode(encodedBuf, httpResponseBody)
base64.Encode always writes EncodedLen(len(src)) bytes, so it panics if the buffer is shorter than that.
Effects:
- In the in-memory channel dispatcher, the fanout runs each subscription in its own goroutine, so the panic is not recovered and the dispatcher process exits.
- In the broker filter,
net/httprecovers the panic, the connection is dropped, and the event never reaches the dead letter sink.
Expected behavior
The event goes to the dead letter sink, and knativeerrordata holds the base64-encoded response body truncated to 1024 characters.
To Reproduce
- Create a Trigger or Subscription with
delivery.deadLetterSinkset. - Point the subscriber at a service that returns HTTP 500 with a body of 2000 bytes (for example, an HTML error page).
- Send an event. The dispatcher logs
panic: runtime error: index out of rangeand the dead letter sink receives nothing.
The unit test case invalid destination with a large response body and delivery option in TestSendEvent reproduces this on main:
panic: runtime error: index out of range [3] with length 0
encoding/base64.(*Encoding).Encode(...)
knative.dev/eventing/pkg/kncloudevents.dispatchExecutionInfoTransformers(...)
pkg/kncloudevents/event_dispatcher.go:593
Knative release version
main (2153953). The same code has been in place since at least the kncloudevents refactor (#7092).
Additional context
Bodies of 768 bytes or fewer are not affected, because their encoded length fits in the buffer.
- Lenguaje dominante
- Go
- Estrellas
- 1.6k
- Forks
- 637
- Merge medio
- 10 h 57 min
- PR fusionados (30 d)
- 13
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de knative/eventing
-
auto:flaky
Dificultad 4/5 3-5 días Aptitud para principiantes 30/100
knative/eventing#9597 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
auto:flaky
Dificultad 4/5 1-2 días Aptitud para principiantes 32/100
knative/eventing#9596 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[flaky] test/rekt.TestInMemoryChannelTLS/SubscriptionTLSTrustBundle/Requirement/channel_is_readyAbiertoauto:flaky
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
knative/eventing#9595 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
auto:flaky
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
knative/eventing#9594 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
auto:flaky
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
knative/eventing#9593 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de knative/eventing
Issues similares
-
bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
orion-belt-dev/orion-belt#181 ·
Los mantenedores suelen responder en 1 día
-
documentation good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
kubesmarts/logic-operator#105 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 78/100
jakartaee/jakartablogs.ee#125 ·
-
story
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
patch-it-dev/patch-it-plugins#120 ·
Los mantenedores suelen responder en 1 día
-
[Plugin] calendarAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
MUKE-coder/grit#228 ·