Skip to content
This repository has been archived by the owner on Mar 9, 2021. It is now read-only.

[source-kafka] Describe fails with runtime error if sink is not set #61

Open
navidshaikh opened this issue Jun 29, 2020 · 1 comment
Open
Assignees

Comments

@navidshaikh
Copy link
Contributor

Create a kafka source without sink and try describing it, it fails with runtime error as the nil check for Sink is missing:

Steps to reproduce:

  1. Create kafka source
kn source kafka create mykafkasrc --servers my-cluster-kafka-bootstrap.kafka.svc:9092 --topics test-topic --consumergroup test-consumer-group
  1. Describe it
kn source kafka describe mykafkasrc
Name:              mykafkasrc
Namespace:         default
Age:               3h
BootstrapServers:  my-cluster-kafka-bootstrap.kafka.svc:9092
Topics:            test-topic
ConsumerGroup:     test-consumer-group

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x134ad18]

goroutine 1 [running]:
knative.dev/client-contrib/plugins/source-kafka/pkg/factories.writeSink(0x184c360, 0xc00042dc50, 0x0)

[...]

Error: exit status 2
Run 'kn --help' for usage

Suggested fix:

Check for nil value here

writeSink(dw, kafkaSource.Spec.Sink)

@daisy-ycguo
Copy link
Member

/assign

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants