wind-c / comqtt

A lightweight, high-performance go mqtt server(v3.0|v3.1.1|v5.0) supporting distributed cluster
MIT License
869 stars 50 forks source link

Missing OnPublishedWithSharedFilters in debug hook #84

Closed Nvos closed 3 months ago

Nvos commented 3 months ago

Seems that at runtime debug hook results in panic due to lack of OnPublishedWithSharedFilters implementation. This happens only when some client publishes

Logs

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

goroutine 191 [running]:
github.com/wind-c/comqtt/v2/mqtt/hooks/debug.(*Hook).OnPublishedWithSharedFilters(_, {{{{0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, ...}, ...}, ...}, ...)
        <autogenerated>:1 +0x28
github.com/wind-c/comqtt/v2/mqtt.(*Hooks).OnPublishedWithSharedFilters(_, {{{{0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, ...}, ...}, ...}, ...)
        /home/czort/go/pkg/mod/github.com/wind-c/comqtt/v2@v2.5.3/mqtt/hooks.go:558 +0x14c
github.com/wind-c/comqtt/v2/mqtt.(*Server).PublishToSubscribers(_, {{{{0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, ...}, ...}, ...}, ...)
        /home/czort/go/pkg/mod/github.com/wind-c/comqtt/v2@v2.5.3/mqtt/server.go:961 +0x2ec
github.com/wind-c/comqtt/v2/mqtt.(*Server).publishToSubscribers(...)
        /home/czort/go/pkg/mod/github.com/wind-c/comqtt/v2@v2.5.3/mqtt/server.go:925
github.com/wind-c/comqtt/v2/mqtt.(*Server).processPublish(_, _, {{{{0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, {0x0, 0x0, ...}, ...}, ...}, ...})
        /home/czort/go/pkg/mod/github.com/wind-c/comqtt/v2@v2.5.3/mqtt/server.go:875 +0x7e5
github.com/wind-c/comqtt/v2/mqtt.(*Server).processPacket(_, _, {{{{0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, {0x0, 0x0, ...}, ...}, ...}, ...})
        /home/czort/go/pkg/mod/github.com/wind-c/comqtt/v2@v2.5.3/mqtt/server.go:627 +0x128
github.com/wind-c/comqtt/v2/mqtt.(*Server).receivePacket(_, _, {{{{0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, {0x0, 0x0, ...}, ...}, ...}, ...})
        /home/czort/go/pkg/mod/github.com/wind-c/comqtt/v2@v2.5.3/mqtt/server.go:432 +0x58
github.com/wind-c/comqtt/v2/mqtt.(*Client).Read(0xc000ec8280, 0xc0012457c0)
        /home/czort/go/pkg/mod/github.com/wind-c/comqtt/v2@v2.5.3/mqtt/clients.go:362 +0x15d
github.com/wind-c/comqtt/v2/mqtt.(*Server).attachClient(0xc000af5860, 0xc000ec8280, {0x1f055d9, 0x3})
        /home/czort/go/pkg/mod/github.com/wind-c/comqtt/v2@v2.5.3/mqtt/server.go:387 +0x605
github.com/wind-c/comqtt/v2/mqtt.(*Server).EstablishConnection(0x0?, {0x1f055d9, 0x3}, {0x2298db8?, 0xc001132000?})
        /home/czort/go/pkg/mod/github.com/wind-c/comqtt/v2@v2.5.3/mqtt/server.go:327 +0x5e
github.com/wind-c/comqtt/v2/mqtt/listeners.(*TCP).Serve.func1()
        /home/czort/go/pkg/mod/github.com/wind-c/comqtt/v2@v2.5.3/mqtt/listeners/tcp.go:84 +0x43
created by github.com/wind-c/comqtt/v2/mqtt/listeners.(*TCP).Serve in goroutine 44
        /home/czort/go/pkg/mod/github.com/wind-c/comqtt/v2@v2.5.3/mqtt/listeners/tcp.go:83 +0x128