bgp / stayrtr

RPKI-To-Router server implementation in Go
BSD 3-Clause "New" or "Revised" License
85 stars 13 forks source link

stayrtr services crashes: panic: interface conversion: rtrlib.SendableData is *rtrlib.VAP, not *rtrlib.VRP #96

Closed teunvink closed 1 year ago

teunvink commented 1 year ago

Running stayrtr 0.5.0-1 on Debian unstable (the latest versions available as I write this) we observe crashes of stayrtr:

root@rpki1:~# stayrtr -bind :8323 -checktime=false -cache /var/lib/rpki-client/json
INFO[0000] new cache file: Updating sha256 hash  -> 20b0ad2a81664fd9428005e867012272b54fd10d0014d654696b53aced35f578
INFO[0003] New update (409561 uniques, 409561 total prefixes).
INFO[0004] Updated added, new serial 0
INFO[0004] StayRTR Server started (sessionID:28188, refresh:3600, retry:600, expire:7200)
INFO[0012] Accepted tcp connection from 172.17.8.128:64739 (1/0)
INFO[0012] Accepted tcp connection from 172.17.8.27:54068 (2/0)
INFO[0012] Accepted tcp connection from 172.17.3.72:51164 (3/0)
INFO[0012] Accepted tcp connection from 172.17.3.76:55694 (4/0)
INFO[0605] File /var/lib/rpki-client/json is identical to the previous version
INFO[0606] New update to old state (409561 uniques, 409561 total prefixes). (old 409574 - new 409561)
INFO[0610] Updated added, new serial 1
INFO[1205] new cache file: Updating sha256 hash 20b0ad2a81664fd9428005e867012272b54fd10d0014d654696b53aced35f578 -> 560962ca54dd0808e2cc4192d9133a51bad03ed5dd1928baa6b89c2b606f9bfe
INFO[1208] New update (409560 uniques, 409560 total prefixes).
INFO[1212] Updated added, new serial 2
INFO[1804] new cache file: Updating sha256 hash 560962ca54dd0808e2cc4192d9133a51bad03ed5dd1928baa6b89c2b606f9bfe -> 39f3616a17e11dedea5a59c73e768152442df0b8ad3b9c12352e8d25b558e241
INFO[1807] New update (409563 uniques, 409563 total prefixes).
INFO[1810] Updated added, new serial 3
panic: interface conversion: rtrlib.SendableData is *rtrlib.VAP, not *rtrlib.VRP

goroutine 36 [running]:
github.com/bgp/stayrtr/lib.(*Client).SendSDs.func1(0x1e160?, 0x0)
    github.com/bgp/stayrtr/lib/server.go:1059 +0x305
sort.partition_func({0xc00855fe80?, 0xc00007e150?}, 0x0, 0x3c2c2, 0x9587a6?)
    sort/zsortfunc.go:142 +0xaf
sort.pdqsort_func({0xc00005de80?, 0xc00007e150?}, 0xc000012060?, 0x0?, 0x844274?)
    sort/zsortfunc.go:114 +0x254
sort.Slice({0x8a32e0, 0xc000012060}, 0x6ec00?)
    sort/slice.go:23 +0x97
github.com/bgp/stayrtr/lib.(*Client).SendSDs(0xc000122140, 0x6e1c, 0x3, {0xc00caa4000?, 0x64327, 0x6ec00})
    github.com/bgp/stayrtr/lib/server.go:1035 +0xaa
github.com/bgp/stayrtr/lib.(*DefaultRTREventHandler).RequestCache(0xc0000c2ec0, 0xc000122140)
    github.com/bgp/stayrtr/lib/server.go:84 +0x109
github.com/bgp/stayrtr/lib.(*Server).RequestCache(0xc0142482a0?, 0x8ad2c0?)
    github.com/bgp/stayrtr/lib/server.go:520 +0x2b
github.com/bgp/stayrtr/lib.(*Client).passSimpleHandler(0xc0000b6450?, {0xa265c8?, 0xc00f75a06c?})
    github.com/bgp/stayrtr/lib/server.go:802 +0x91
github.com/bgp/stayrtr/lib.(*Client).Start(0xc000122140)
    github.com/bgp/stayrtr/lib/server.go:877 +0x39f
created by github.com/bgp/stayrtr/lib.(*Server).acceptClientTCP
    github.com/bgp/stayrtr/lib/server.go:554 +0x276

stayrtr package used:

root@rpki1:~# apt-cache policy stayrtr
stayrtr:
  Installed: 0.5.0-1
  Candidate: 0.5.0-1
  Version table:
 *** 0.5.0-1 500
        500 http://httpredir.debian.org/debian bookworm/main amd64 Packages
        500 http://deb.debian.org/debian bookworm/main amd64 Packages
        100 /var/lib/dpkg/status

arguments used:

root@rpki1:~# cat /etc/default/stayrtr
STAYRTR_ARGS=-bind :8323 -checktime=false -cache /var/lib/rpki-client/json

This happens quite often (a few times per hour) on multiple stayrtr instances we have running (all using the same stayrtr version).

benjojo commented 1 year ago

Ah, That's unfortunate, as 0.5 is known to do this, to fix it https://github.com/bgp/stayrtr/releases/tag/v0.5.1 was released.

I've been meaning to push this as a real release, I'll try and find the debian maintainer for it too

teunvink commented 1 year ago

I just installed 0.5.1 from debian unstable on one of our setups and will check if that helps.

teunvink commented 1 year ago

0.5.1 from debian unstable seems to be more stable 🤪, so I think this can be flagged as resolved.