Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Disconnecting while Kafka bridge turned on causes a panic #72

@jlundy2

Description

@jlundy2

If bridge-way is set to 1, disconnecting an MQTT client causes the following error:

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

goroutine 51 [running]:
github.com/wind-c/comqtt/v2/plugin/bridge/kafka.(*Bridge).OnDisconnect(0xc000382960, 0xc00011e780, {0x0, 0x0}, 0x68?)
     /app/plugin/bridge/kafka/kafka.go:279 +0x98
github.com/wind-c/comqtt/v2/mqtt.(*Hooks).OnDisconnect(0xc00030c2a0?, 0xd628c1?, {0x0, 0x0}, 0x3?)
     /app/mqtt/hooks.go:265 +0x13c
github.com/wind-c/comqtt/v2/mqtt.(*Server).attachClient(0xc000382190, 0xc00011e780, {0xd54ca3, 0x3})
    /app/mqtt/server.go:381 +0x7c5
github.com/wind-c/comqtt/v2/mqtt.(*Server).EstablishConnection(0x8747ae?, {0xd54ca3, 0x3}, {0xe712a8?, 0xc000012008?})
     /app/mqtt/server.go:311 +0x65
github.com/wind-c/comqtt/v2/mqtt/listeners.(*TCP).Serve.func1()
     /app/mqtt/listeners/tcp.go:84 +0x47
created by github.com/wind-c/comqtt/v2/mqtt/listeners.(*TCP).Serve
     /app/mqtt/listeners/tcp.go:83 +0x145

Not sure if it's because the client has already disconnected or what.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions