emmericp / MoonGen

MoonGen is a fully scriptable high-speed packet generator built on DPDK and LuaJIT. It can saturate a 10 Gbit/s connection with 64 byte packets on a single CPU core while executing user-provided Lua scripts for each packet. Multi-core support allows for even higher rates. It also features precise and accurate timestamping and rate control.
MIT License
1.05k stars 235 forks source link

vxlan example - segfault #320

Open fedy85 opened 3 years ago

fedy85 commented 3 years ago

Dear,

I always get Segmentation fault when I run your xvlan example. I use Ubuntu 18.04.6 LTS with 4.15.0-159-generic kernel.

dmesg says

[ 5368.166617] igb 0000:0b:00.2: removed PHC on eth4 [ 5368.751405] igb 0000:0b:00.3: removed PHC on eth5 [ 5390.345730] show_signal_msg: 5 callbacks suppressed [ 5390.345738] lcore-slave-1[2265]: segfault at 34 ip 000055cc7e435e68 sp 00007f0c14e407f0 error 6 in MoonGen[55cc7e33a000+3ea000]

when I run

../build/MoonGen ./vxlan-example.lua 0 1 1 1 [INFO] Initializing DPDK. This will take a few seconds... EAL: Detected 8 lcore(s) EAL: Probing VFIO support... EAL: PCI device 0000:04:00.0 on NUMA socket 0 EAL: probe driver: 8086:15ac net_ixgbe EAL: PCI device 0000:04:00.1 on NUMA socket 0 EAL: probe driver: 8086:15ac net_ixgbe EAL: PCI device 0000:07:00.0 on NUMA socket 0 EAL: probe driver: 8086:1533 net_e1000_igb EAL: PCI device 0000:08:00.0 on NUMA socket 0 EAL: probe driver: 8086:1533 net_e1000_igb EAL: PCI device 0000:0b:00.0 on NUMA socket 0 EAL: probe driver: 8086:1521 net_e1000_igb EAL: PCI device 0000:0b:00.1 on NUMA socket 0 EAL: probe driver: 8086:1521 net_e1000_igb EAL: PCI device 0000:0b:00.2 on NUMA socket 0 EAL: probe driver: 8086:1521 net_e1000_igb EAL: PCI device 0000:0b:00.3 on NUMA socket 0 EAL: probe driver: 8086:1521 net_e1000_igb [INFO] Found 2 usable devices: Device 0: 0C:C4:7A:97:EC:0A (Intel Corporation I350 Gigabit Network Connection) Device 1: 0C:C4:7A:97:EC:0B (Intel Corporation I350 Gigabit Network Connection) [INFO] Device 0 (0C:C4:7A:97:EC:0A) is up: 1000 MBit/s [WARN] Per-queue rate limit is not supported on this device, setting per-device rate limit to 0 Mbit/s instead (note: this may fail as well if the NIC doesn't support any rate limiting). [WARN] global rate limiting is not supported by the hardware or driver [INFO] Device 1 (0C:C4:7A:97:EC:0B) is up: 1000 MBit/s [WARN] dpdk.launchLua() is deprecated, use moongen.startTask() instead. [WARN] dpdk.waitForSlaves() is deprecated, use moongen.waitForTasks() instead. [INFO] Starting vtep decapsulation task [WARN] dpdk.running() is deprecated, use moongen.running() instead. Segmentation fault (core dumped)

Do you have an idea what could be wrong ?

fedy85 commented 3 years ago

have figured out that it is caused by the

 txBufs:allocN(decPacketLen, 0)

in decapsulateSlave while loop. first time it goes OK but second round I get segfault

emmericp commented 3 years ago

@scholzd I believe this is your example, can you please take a look?

fedy85 commented 3 years ago

@scholzd I believe this is your example, can you please take a look?

I found kind of a solution, not sure if it is really correct.

Seems to be working now and no memory leaks seen.

Let me have a question - the process makes a core 100% used even when there is no ingress L2 traffic, so no L3 VXLAN encapsulated packets are sent. I guess it is done by the while mg.running() loop. Is it possible to decrease the usage during the idle time when there is no L2 traffic ?