sipcapture / heplify

Portable and Lightweight HEP Capture Agent for HOMER
https://sipcapture.org
GNU Affero General Public License v3.0
185 stars 66 forks source link

panic: runtime error: slice bounds out of range [20:18] for heplify version 1.63 #218

Closed rvanza closed 5 months ago

rvanza commented 3 years ago

Hi Team,

The heplify service restarted and checking the /var/log/syslog file found the below logs in /var/log/syslog file. I have also enabled the error log level in service file using "-l error" but there is no written any errors in logs for that but if set for debug then its working.

heplify -version

heplify 1.63

/var/log/syslog Jul 8 08:02:55 heplify[25207]: panic: runtime error: slice bounds out of range [20:18] Jul 8 08:02:55 heplify[25207]: goroutine 16 [running]: Jul 8 08:02:55 heplify[25207]: github.com/sipcapture/heplify/decoder.extractCID(0xc0099c661a, 0x4, 0x580, 0x8d2328, 0xc0099c661e, 0x4, 0x57c, 0xd5b1, 0xc0099c6642, 0x558, ...) Jul 8 08:02:55 heplify[25207]: #011/app/decoder/correlator.go:233 +0x1b52 Jul 8 08:02:55 heplify[25207]: github.com/sipcapture/heplify/decoder.(Decoder).processTransport(0xc00010b500, 0xc00010b520, 0xc00010b988, 0xc00010b848, 0xc00010bac0, 0x1, 0x4, 0x4, 0xfe01cac, 0x0, ...) Jul 8 08:02:55 heplify[25207]: #011/app/decoder/decoder.go:373 +0x637 Jul 8 08:02:55 heplify[25207]: github.com/sipcapture/heplify/decoder.(Decoder).Process(0xc00010b500, 0xc0099c6600, 0x59a, 0x59a, 0xc0099a93b0) Jul 8 08:02:55 heplify[25207]: #011/app/decoder/decoder.go:227 +0x1148 Jul 8 08:02:55 heplify[25207]: github.com/sipcapture/heplify/sniffer.(MainWorker).OnPacket(0xc00008e370, 0xc0099c6600, 0x59a, 0x59a, 0xc0099a93b0) Jul 8 08:02:55 heplify[25207]: #011/app/sniffer/sniffer.go:72 +0x57 Jul 8 08:02:55 heplify[25207]: github.com/sipcapture/heplify/sniffer.(SnifferSetup).Run(0xc0001229a0, 0x0, 0x0) Jul 8 08:02:55 heplify[25207]: #011/app/sniffer/sniffer.go:318 +0x588 Jul 8 08:02:55 heplify[25207]: main.main.func2(0xc0001229a0, 0xc00008e090, 0xc0054f2fc0) Jul 8 08:02:55 heplify[25207]: #011/app/main.go:138 +0x2b Jul 8 08:02:55 heplify[25207]: created by main.main Jul 8 08:02:55 heplify[25207]: #011/app/main.go:137 +0x13b Jul 8 08:02:55 kernel: [1584010.778293] device ens192 left promiscuous mode Jul 8 08:02:55 systemd[1]: heplify.service: Main process exited, code=exited, status=2/INVALIDARGUMENT Jul 8 08:02:55 kill[26742]: kill: failed to parse argument: '': No such file or directory Jul 8 08:02:55 systemd[1]: heplify.service: Control process exited, code=exited status=1 Jul 8 08:02:55 systemd[1]: heplify.service: Unit entered failed state. Jul 8 08:02:55 systemd[1]: heplify.service: Failed with result 'exit-code'. Jul 8 08:03:03 systemd[1]: Started Session 25819 of user root. Jul 8 08:03:06 systemd[1]: heplify.service: Service hold-off time over, scheduling restart. Jul 8 08:03:06 systemd[1]: Stopped Captures packets from wire and sends them to Homer. Jul 8 08:03:06 systemd[1]: Started Captures packets from wire and sends them to Homer.

heplify.service [Unit] Description=Captures packets from wire and sends them to Homer After=network.target

[Service] ExecStart=/usr/local/bin/heplify -l error -p "/var/log/heplify/" -i ens192 -pr 9XXX-9XXX -hs ipaddress:9XXX -dim OPTIONS -nt tcp ExecStop=/bin/kill ${MAINPID} Restart=on-failure RestartSec=10s Type=simple

[Install] WantedBy=multi-user.target

Please let me know if anything missing that help you for debug.

Thank you. RK

rvanza commented 3 years ago

Do we have any update on this?

Majongman commented 2 years ago

I have same error.

Mar 25 15:03:52 myserver heplify[18700]: panic: runtime error: slice bounds out of range [19:17] Mar 25 15:03:52 myserver heplify[18700]: goroutine 72 [running]: Mar 25 15:03:52 myserver heplify[18700]: github.com/sipcapture/heplify/decoder.extractCID(0xc0005f9b1c, 0x4, 0x44c, 0x8d176e, 0xc0005f9b20, 0x4, 0x448, 0x13c4, 0xc0005f9b38, 0x430, ...) Mar 25 15:03:52 myserver heplify[18700]: #011/app/decoder/correlator.go:233 +0x1b52 Mar 25 15:03:52 myserver heplify[18700]: github.com/sipcapture/heplify/decoder.(Decoder).processTransport(0xc002278000, 0xc002278020, 0xc002278488, 0xc002278348, 0xc0022785c0, 0x1, 0x4, 0x4, 0x1a918c5e, 0x0, ...) Mar 25 15:03:52 myserver heplify[18700]: #011/app/decoder/decoder.go:373 +0x637 Mar 25 15:03:52 myserver heplify[18700]: github.com/sipcapture/heplify/decoder.(Decoder).Process(0xc002278000, 0xc0005f9b00, 0x468, 0x468, 0xc002248b40) Mar 25 15:03:52 myserver heplify[18700]: #011/app/decoder/decoder.go:227 +0x1148 Mar 25 15:03:52 myserver heplify[18700]: github.com/sipcapture/heplify/sniffer.(MainWorker).OnPacket(0xc002268100, 0xc0005f9b00, 0x468, 0x468, 0xc002248b40) Mar 25 15:03:52 myserver heplify[18700]: #011/app/sniffer/sniffer.go:72 +0x57 Mar 25 15:03:52 myserver heplify[18700]: github.com/sipcapture/heplify/sniffer.(SnifferSetup).Run(0xc0000ba8f0, 0x0, 0x0) Mar 25 15:03:52 myserver heplify[18700]: #011/app/sniffer/sniffer.go:318 +0x588 Mar 25 15:03:52 myserver heplify[18700]: main.main.func2(0xc0000ba8f0, 0xc0000709b0, 0xc0004ea090) Mar 25 15:03:52 myserver heplify[18700]: #011/app/main.go:138 +0x2b Mar 25 15:03:52 myserver heplify[18700]: created by main.main Mar 25 15:03:52 myserver heplify[18700]: #011/app/main.go:137 +0x13b Mar 25 15:03:52 myserver systemd[1]: heplify.service: Main process exited, code=exited, status=2/INVALIDARGUMENT Mar 25 15:03:52 myserver systemd[1]: heplify.service: Failed with result 'exit-code'. Mar 25 15:04:02 myserver systemd[1]: heplify.service: Service RestartSec=10s expired, scheduling restart. Mar 25 15:04:02 myserver systemd[1]: heplify.service: Scheduled restart job, restart counter is at 8. Mar 25 15:04:02 myserver systemd[1]: Stopped Captures packets from wire and sends them to Homer. Mar 25 15:04:02 myserver systemd[1]: Started Captures packets from wire and sends them to Homer.

My service config:

[Unit] Description=Captures packets from wire and sends them to Homer After=network.target [Service] WorkingDirectory=/usr/local/bin ExecStart=/usr/local/bin/heplify -i any -hs myserver.local:9060 -m SIPRTCP -hi 1011 ExecStop=/bin/kill ${MAINPID} Restart=on-failure RestartSec=10s Type=simple [Install] WantedBy=multi-user.target

lmangani commented 2 years ago

recent builds should have addressed this issue - needs confirmation

kYroL01 commented 5 months ago

Tested in lab - issue seems resolved. Reopen if necessary