livekit / sip

SIP to WebRTC bridge for LiveKit
132 stars 30 forks source link

Panic when From number cannot be parsed #199

Open AutoScrape123TX opened 1 month ago

AutoScrape123TX commented 1 month ago

The SIP server is flooded by bots.

Just got an exceptional segmentation violation :

2024/10/12 12:57:08 INFO skip header due to error line="From: \"sip911\"<b0119:532@210.213.230.59>;tag=3864356534373562313363340132353633393730333938" err="strconv.Atoi: parsing \"532@210.213.230.59\": invalid syntax"
2024/10/12 12:57:08 INFO skip header due to error line="To: \"sip911\"<b0119:532@210.213.230.59>" err="strconv.Atoi: parsing \"532@210.213.230.59\": invalid syntax"
2024-10-12T12:57:08.437Z        WARN    sipgo@v0.13.2-0.20240820220653-befde351a575/server.go:353       SIP request handler not found   {"nodeID": "NE_vmnKXM8D7joq"}
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x60 pc=0xf1a3bc]

goroutine 1421 [running]:
github.com/emiago/sipgo/sip.NewResponseFromRequest(0xc0003b6c40, 0x195, {0x13361da, 0x12}, {0x0, 0x0, 0x0})
        /root/go/pkg/mod/github.com/livekit/sipgo@v0.13.2-0.20240820220653-befde351a575/sip/response.go:225 +0x5bc
github.com/emiago/sipgo.(*Server).defaultUnhandledHandler(0xc0002ab4f0, 0xc0003b6c40, {0x0?, 0xc000392a90?})
        /root/go/pkg/mod/github.com/livekit/sipgo@v0.13.2-0.20240820220653-befde351a575/server.go:354 +0x7a
github.com/emiago/sipgo.(*Server).handleRequest(0xc0002ab4f0, 0xc0003b6c40, {0x14ddc40, 0xc0003c6800})
        /root/go/pkg/mod/github.com/livekit/sipgo@v0.13.2-0.20240820220653-befde351a575/server.go:235 +0xc9
created by github.com/emiago/sipgo.(*Server).onRequest in goroutine 82
        /root/go/pkg/mod/github.com/livekit/sipgo@v0.13.2-0.20240820220653-befde351a575/server.go:225 +0x8f
davidzhao commented 1 month ago

hi, can you share which version you are running?

AutoScrape123TX commented 1 month ago

I was at this commit id 49e84c723b01eea91ff7d00d5bfb2effc8fbf74e

I compile from source.

commit 49e84c723b01eea91ff7d00d5bfb2effc8fbf74e (HEAD -> main, origin/main, origin/HEAD)
Author: David Colburn <dcolburn0@gmail.com>
Date:   Thu Oct 3 15:16:02 2024 -0700

    Add inbound media processors (#185)

    * add inbound media processors

    * fix test handler

    * dispatch EnabledFeatures

    * add copyright

    * updates

    * update processor

    * fix handler

    * update protocol

    * merge main
AutoScrape123TX commented 1 month ago

Again with last commit id 2fa5c7a8a78714a7ddcf20a1a17254e8bb7e191a

2024-10-15T07:55:06.759Z        WARN    sipgo@v0.13.2-0.20240820220653-befde351a575/server.go:353       SIP request handler not found   {"nodeID": "NE_wXXzgu5M4n2V"}
2024-10-15T07:55:06.760Z        WARN    sipgo@v0.13.2-0.20240820220653-befde351a575/server.go:353       SIP request handler not found   {"nodeID": "NE_wXXzgu5M4n2V"}
2024-10-15T07:55:06.769Z        WARN    sipgo@v0.13.2-0.20240820220653-befde351a575/server.go:353       SIP request handler not found   {"nodeID": "NE_wXXzgu5M4n2V"}
2024-10-15T07:55:06.775Z        WARN    sipgo@v0.13.2-0.20240820220653-befde351a575/server.go:353       SIP request handler not found   {"nodeID": "NE_wXXzgu5M4n2V"}
2024-10-15T07:55:06.780Z        WARN    sipgo@v0.13.2-0.20240820220653-befde351a575/server.go:353       SIP request handler not found   {"nodeID": "NE_wXXzgu5M4n2V"}
2024-10-15T07:55:06.792Z        WARN    sipgo@v0.13.2-0.20240820220653-befde351a575/server.go:353       SIP request handler not found   {"nodeID": "NE_wXXzgu5M4n2V"}
2024-10-15T07:55:06.808Z        WARN    sipgo@v0.13.2-0.20240820220653-befde351a575/server.go:353       SIP request handler not found   {"nodeID": "NE_wXXzgu5M4n2V"}
2024-10-15T07:55:06.824Z        WARN    sipgo@v0.13.2-0.20240820220653-befde351a575/server.go:353       SIP request handler not found   {"nodeID": "NE_wXXzgu5M4n2V"}
2024-10-15T07:55:06.827Z        WARN    sipgo@v0.13.2-0.20240820220653-befde351a575/server.go:353       SIP request handler not found   {"nodeID": "NE_wXXzgu5M4n2V"}
2024-10-15T07:55:12.585Z        INFO    sip     hwstats/cpu.go:112      high cpu load   {"nodeID": "NE_wXXzgu5M4n2V", "load": 0.9122997374531788}
2024-10-15T07:55:14.293Z        WARN    sipgo@v0.13.2-0.20240820220653-befde351a575/server.go:353       SIP request handler not found   {"nodeID": "NE_wXXzgu5M4n2V"}
2024/10/15 07:55:31 INFO skip header due to error line="From: \"sip911\"<b0119:532@210.213.230.59>;tag=3864356534373562313363340133303934383932333231" err="strconv.Atoi: parsing \"532@210.213.230.59\": invalid syntax"
2024/10/15 07:55:31 INFO skip header due to error line="To: \"sip911\"<b0119:532@210.213.230.59>" err="strconv.Atoi: parsing \"532@210.213.230.59\": invalid syntax"
2024-10-15T07:55:31.782Z        WARN    sipgo@v0.13.2-0.20240820220653-befde351a575/server.go:353       SIP request handler not found   {"nodeID": "NE_wXXzgu5M4n2V"}
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x60 pc=0xf19f7c]

goroutine 37522 [running]:
github.com/emiago/sipgo/sip.NewResponseFromRequest(0xc00043bea0, 0x195, {0x13391e2, 0x12}, {0x0, 0x0, 0x0})
        /root/go/pkg/mod/github.com/livekit/sipgo@v0.13.2-0.20240820220653-befde351a575/sip/response.go:225 +0x5bc
github.com/emiago/sipgo.(*Server).defaultUnhandledHandler(0xc0002aae60, 0xc00043bea0, {0xc0006d8788?, 0xc0001368f0?})
        /root/go/pkg/mod/github.com/livekit/sipgo@v0.13.2-0.20240820220653-befde351a575/server.go:354 +0x7a
github.com/emiago/sipgo.(*Server).handleRequest(0xc0002aae60, 0xc00043bea0, {0x14e1040, 0xc000139c00})
        /root/go/pkg/mod/github.com/livekit/sipgo@v0.13.2-0.20240820220653-befde351a575/server.go:235 +0xc9
created by github.com/emiago/sipgo.(*Server).onRequest in goroutine 68
        /root/go/pkg/mod/github.com/livekit/sipgo@v0.13.2-0.20240820220653-befde351a575/server.go:225 +0x8f
dennwc commented 1 month ago

Confirmed, but needs sipgo update to fix, which is a bit complicated at the moment.