bgp / stayrtr

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

Stayrtr throws rtrlib.SendableData is *rtrlib.BgpsecKey, not *rtrlib.VRP #92

Closed lamehost closed 1 year ago

lamehost commented 1 year ago

Dear developers of stayrtr

Whenever i start stayrtr 8a3a71e0 in my network, i get the error below:

stayrtr_1      | panic: interface conversion: rtrlib.SendableData is *rtrlib.BgpsecKey, not *rtrlib.VRP
stayrtr_1      | 
stayrtr_1      | goroutine 1046 [running]:
stayrtr_1      | github.com/bgp/stayrtr/lib.(*Client).SendSDs.func1(0x1?, 0x0)
stayrtr_1      |    github.com/bgp/stayrtr/lib/server.go:1059 +0x2f9
stayrtr_1      | sort.partition_func({0xc0031c2e80?, 0xc00733d470?}, 0x0, 0x21f63, 0xc008a77630?)
stayrtr_1      |    sort/zsortfunc.go:142 +0xaf
stayrtr_1      | sort.pdqsort_func({0xc0031c2e80?, 0xc00733d470?}, 0x0?, 0x62c42?, 0x87d300?)
stayrtr_1      |    sort/zsortfunc.go:114 +0x20f
stayrtr_1      | sort.pdqsort_func({0xc0031c2e80?, 0xc00733d470?}, 0x7f1e00deed28?, 0x18?, 0xc00006ec00?)
stayrtr_1      |    sort/zsortfunc.go:121 +0x25a
stayrtr_1      | sort.Slice({0x87d300?, 0xc00733aca8?}, 0x6ec00?)
stayrtr_1      |    sort/slice.go:26 +0xfa
stayrtr_1      | github.com/bgp/stayrtr/lib.(*Client).SendSDs(0xc00582cd20, 0x4ced, 0x0, {0xc008858000?, 0x62c42, 0x6ec00})
stayrtr_1      |    github.com/bgp/stayrtr/lib/server.go:1035 +0xb8
stayrtr_1      | github.com/bgp/stayrtr/lib.(*DefaultRTREventHandler).RequestCache(0xc0001a4da0, 0xc00582cd20)
stayrtr_1      |    github.com/bgp/stayrtr/lib/server.go:84 +0x109
stayrtr_1      | github.com/bgp/stayrtr/lib.(*Server).RequestCache(0xc00a7ce200?, 0x886e60?)
stayrtr_1      |    github.com/bgp/stayrtr/lib/server.go:520 +0x2b
stayrtr_1      | github.com/bgp/stayrtr/lib.(*Client).passSimpleHandler(0xc00a7cc6f0?, {0x9e4668?, 0xc00733ea3c?})
stayrtr_1      |    github.com/bgp/stayrtr/lib/server.go:802 +0x71
stayrtr_1      | github.com/bgp/stayrtr/lib.(*Client).Start(0xc00582cd20)
stayrtr_1      |    github.com/bgp/stayrtr/lib/server.go:877 +0x377
stayrtr_1      | created by github.com/bgp/stayrtr/lib.(*Server).acceptClientTCP
stayrtr_1      |    github.com/bgp/stayrtr/lib/server.go:554 +0x276

Here's how i am launching it:

  stayrtr:
    image: rpki/stayrtr:8a3a71e0
    depends_on:
      - rpki-client
    volumes:
     - "rpki-client-output:/var/lib/rpki-client/"
    command:
      - -cache
      - /var/lib/rpki-client/json
      - -checktime=false
      - -bind
      - 0.0.0.0:323
    expose:
      - 323
    ports:
      - 323:323

I believe it's worth to note that I have also tried with rpki/stayrtr:v0.5.0 with similar results and that everything was working with rpki/stayrtr:ad3ed83a .

Could you please look into it?

Thank you

Regards

benjojo commented 1 year ago

@lamehost Can you try (when CI pushes it) the docker image that is built from b2a79528c5d221f46bdd766ce9c448714f3b62d5

lamehost commented 1 year ago

Done.

Here's the result:

stayrtr_1      | panic: interface conversion: rtrlib.SendableData is *rtrlib.VAP, not *rtrlib.VRP
stayrtr_1      | 
stayrtr_1      | goroutine 2673 [running]:
stayrtr_1      | github.com/bgp/stayrtr/lib.(*Client).SendSDs.func1(0x596d5?, 0x0)
stayrtr_1      |    github.com/bgp/stayrtr/lib/server.go:1059 +0x319
stayrtr_1      | sort.partition_func({0xc0053abe80?, 0xc004cb1200?}, 0x0, 0x62cbe, 0x87e400?)
stayrtr_1      |    sort/zsortfunc.go:142 +0xaf
stayrtr_1      | sort.pdqsort_func({0xc0053abe80?, 0xc004cb1200?}, 0x7faa436011d8?, 0x18?, 0xc00a700000?)
stayrtr_1      |    sort/zsortfunc.go:114 +0x20f
stayrtr_1      | sort.Slice({0x87e400?, 0xc004cad5f0?}, 0x6ec00?)
stayrtr_1      |    sort/slice.go:26 +0xfa
stayrtr_1      | github.com/bgp/stayrtr/lib.(*Client).SendSDs(0xc00950e280, 0xe074, 0x0, {0xc00aa80000?, 0x62cbe, 0x6ec00})
stayrtr_1      |    github.com/bgp/stayrtr/lib/server.go:1035 +0xb8
stayrtr_1      | github.com/bgp/stayrtr/lib.(*DefaultRTREventHandler).RequestCache(0xc000094060, 0xc00950e280)
stayrtr_1      |    github.com/bgp/stayrtr/lib/server.go:84 +0x109
stayrtr_1      | github.com/bgp/stayrtr/lib.(*Server).RequestCache(0xc005e880e0?, 0x887f60?)
stayrtr_1      |    github.com/bgp/stayrtr/lib/server.go:520 +0x2b
stayrtr_1      | github.com/bgp/stayrtr/lib.(*Client).passSimpleHandler(0xc004cc8000?, {0x9e6028?, 0xc003ed556c?})
stayrtr_1      |    github.com/bgp/stayrtr/lib/server.go:802 +0x71
stayrtr_1      | github.com/bgp/stayrtr/lib.(*Client).Start(0xc00950e280)
stayrtr_1      |    github.com/bgp/stayrtr/lib/server.go:877 +0x377
stayrtr_1      | created by github.com/bgp/stayrtr/lib.(*Server).acceptClientTCP
stayrtr_1      |    github.com/bgp/stayrtr/lib/server.go:554 +0x276
benjojo commented 1 year ago

Ah, Figured it out to be a data race, Can you try now? with the latest image that is building?

lamehost commented 1 year ago

Hello,

I am running 28752753 and everything looks OK so far

benjojo commented 1 year ago

Wonderful, I'll tag a release up soon with this fix

benjojo commented 1 year ago

@lamehost Can you test https://github.com/bgp/stayrtr/commit/62f59527762a908a74664b8ce1fc69304f80f84b ? It should have improved performance significantly

benjojo commented 1 year ago

My bad, I mean https://github.com/bgp/stayrtr/commit/5a3782245ccacad6b7d22349ed5392aba4d0a6e2 (test caught me off guard there)

lamehost commented 1 year ago

It's running now. Looks good so far

benjojo commented 1 year ago

Fixed in v0.5.1