containernetworking / plugins

Some reference and example networking plugins, maintained by the CNI team.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ns.NetNS.Do: "fatal error: checkptr: misaligned pointer conversion"

cyclinder opened this issue · comments

We got this weird error in CI, we executed the netlink.RouteList function in the pod's network namespace, but it failed. Looks like an error at the golang runtime:

Warning  FailedCreatePodSandBox  5m34s                 kubelet            Failed to create pod sandbox: rpc error: code = Unknown desc = failed to setup network for sandbox "c8c9d80ce6893631afb43bd08f01d52461b5a3eaae225058dfffda38d6f19e29": plugin type="multus" name="multus-cni-network" failed (add): [kube-system/spiderdoctor-agent-5gxfx/c77fa64a-c68d-4508-9a78-b0c7cddc721e:macvlan-vlan100-overlay]: error adding container to network "macvlan-vlan100-overlay": netplugin failed: "fatal error: checkptr: misaligned pointer conversion\n\ngoroutine 62 [running, locked to thread]:\nruntime.throw({0x2909a8f?, 0x24b9b7f?})\n\t/usr/local/go/src/runtime/panic.go:1047 +0x5d fp=0xc00069f0c0 sp=0xc00069f090 pc=0x470edd\nruntime.checkptrAlignment(0xc0003ff160?, 0x14?, 0x388?)\n\t/usr/local/go/src/runtime/checkptr.go:20 +0x7d fp=0xc00069f0e0 sp=0xc00069f0c0 pc=0x43eadd\ngithub.com/vishvananda/netlink/nl.DeserializeRtNexthop(...)\n\t/src/vendor/github.com/vishvananda/netlink/nl/route_linux.go:51\ngithub.com/vishvananda/netlink.deserializeRoute.func1({0xc0003ff174, 0x1c, 0x374})\n\t/src/vendor/github.com/vishvananda/netlink/route_linux.go:1131 +0x86 fp=0xc00069f218 sp=0xc00069f0e0 pc=0x24baa06\ngithub.com/vishvananda/netlink.deserializeRoute({_, _, _})\n\t/src/vendor/github.com/vishvananda/netlink/route_linux.go:1189 +0x119f fp=0xc00069f5e8 sp=0xc00069f218 pc=0x24b9b7f\ngithub.com/vishvananda/netlink.(*Handle).RouteListFiltered(0x3ac2840?, 0x0, 0x0, 0x40)\n\t/src/vendor/github.com/vishvananda/netlink/route_linux.go:1038 +0x468 fp=0xc00069fb28 sp=0xc00069f5e8 pc=0x24b8048\ngithub.com/vishvananda/netlink.(*Handle).RouteList(0x4ace85?, {0x0, 0x0}, 0x25e9620?)\n\t/src/vendor/github.com/vishvananda/netlink/route_linux.go:1003 +0xc7 fp=0xc00069fcf8 sp=0xc00069fb28 pc=0x24b7b47\ngithub.com/vishvananda/netlink.RouteList(...)\n\t/src/vendor/github.com/vishvananda/netlink/route_linux.go:990\ngithub.com/spidernet-io/spiderpool/pkg/networking/networking.GetDefaultRouteInterface.func1({0xc00044efc0?, 0x4b856a?})\n\t/src/pkg/networking/networking/route.go:215 +0x7f fp=0xc00069fdb8 sp=0xc00069fcf8 pc=0x24cdcbf\ngithub.com/containernetworking/plugins/pkg/ns.(*netNS).Do.func1({0x2ca4440, 0xc00023c470})\n\t/src/vendor/github.com/containernetworking/plugins/pkg/ns/ns_linux.go:197 +0x36f fp=0xc00069ff30 sp=0xc00069fdb8 pc=0x2447f2f\ngithub.com/containernetworking/plugins/pkg/ns.(*netNS).Do.func2()\n\t/src/vendor/github.com/containernetworking/plugins/pkg/ns/ns_linux.go:218 +0xc9 fp=0xc00069ffe0 sp=0xc00069ff30 pc=0x2447a29\nruntime.goexit()\n\t/usr/local/go/src/runtime/asm_amd64.s:1598 +0x1 fp=0xc00069ffe8 sp=0xc00069ffe0 pc=0x4a9b21\ncreated by github.com/containernetworking/plugins/pkg/ns.(*netNS).Do\n\t/src/vendor/github.com/containernetworking/plugins/pkg/ns/ns_linux.go:215 +0x518\n\ngoroutine 1 [semacquire, locked to thread]:\nruntime.gopark(0x46f933?, 0xc00055e6a8?, 0x0?, 0xe0?, 0xc00055e6c8?)\n\t/usr/local/go/src/runtime/proc.go:381 +0xd6 fp=0xc00055e630 sp=0xc00055e610 pc=0x473c16\nruntime.goparkunlock(...)\n\t/usr/local/go/src/runtime/proc.go:387\nruntime.semacquire1(0xc0001b5b48, 0x40?, 0x1, 0x0, 0x1?)\n\t/usr/local/go/src/runtime/sema.go:160 +0x20f fp=0xc00055e698 sp=0xc00055e630 pc=0x48680f\nsync.runtime_Semacquire(0xc0001b5b48?)\n\t/usr/local/go/src/runtime/sema.go:62 +0x27 fp=0xc00055e6d0 sp=0xc00055e698 pc=0x4a56e7\nsync.(*WaitGroup).Wait(0xc0001b5b40)\n\t/usr/local/go/src/sync/waitgroup.go:116 +0xa5 fp=0xc00055e700 sp=0xc00055e6d0 pc=0x4bd0c5\ngithub.com/containernetworking/plugins/pkg/ns.(*netNS).Do(0xc00044efc0, 0xc0004f6750)\n\t/src/vendor/github.com/containernetworking/plugins/pkg/ns/ns_linux.go:220 +0x525 fp=0xc00055e830 sp=0xc00055e700 pc=0x2447865\ngithub.com/spidernet-io/spiderpool/pkg/networking/networking.GetDefaultRouteInterface({0x2ca4440, 0xc00044efc0}, {0xc00005805c, 0x4}, 0x0)\n\t/src/pkg/networking/networking/route.go:214

Codes like this: https://github.com/spidernet-io/spiderpool/blob/562c26076fe30f6ee866300071fcf15ddf4f39c3/pkg/networking/networking/route.go#L218:

	err := netns.Do(func(_ ns.NetNS) error {
		routes, err := netlink.RouteList(nil, ipfamily)
		if err != nil {
			return err
		}
                 return nil
        })

CI log: https://github.com/spidernet-io/spiderpool/actions/runs/5208528583/jobs/9397378067#step:11:2642

I opened an issue for it in netlink: vishvananda/netlink#877.

Can someone help me?

We can't build CNI plugins with -race flags.