Make sure that vm = vlib_mains [thread_index], not vm = vlib_mains[0] = &vlib_global_main.
>From what you wrote, I suspect that’s the problem. D. From: vpp-dev@lists.fd.io <vpp-dev@lists.fd.io> On Behalf Of PRANAB DAS Sent: Friday, February 5, 2021 7:38 PM To: vpp-dev@lists.fd.io Subject: [vpp-dev] vlib_put_frame_to_node to udp-encap causes main-thread crash Hi I am puzzled by the crash in the main-thread caused by the following code snippet that I have used to send control message payload over a udp encap tunnel. The udp encap tunnel is created using udp encap vppcli. The code below works when only a few packets are sent. But when I tried to send a burst of these messages, for instance in a for loop with count 10 it causes a crash on the main-thread even though the call is made on a worker thread. Really appreciate it you could provide some information how to debug this. Thank you if (vlib_buffer_alloc (vm, &bi0, 1) != 1) { return -1; } b0 = vlib_get_buffer (vm, bi0); udp4_encap_node = vlib_get_node_by_name(vm, (u8 *) "udp4-encap"); dp4_encap_node_index=udp4_encap_node->index; vnet_buffer(b0)->sw_if_index[VLIB_RX] = 0; vnet_buffer(b0)->ip.adj_index[VLIB_TX] = 0; // udp encap tunnel created with index 0 vlib_frame_t *f = vlib_get_frame_to_node(vm, udp4_encap_node_index); u32 *to_next = vlib_frame_vector_args(f); to_next[0] = bi0; f->n_vectors = 1; vlib_put_frame_to_node(vm, udp4_encap_node_index, f); This is the back trace. I don't understand how vlib_put_frame_to_node on a worker thread can trigger a crash on the main thread. Is it caused by some corruption ? Thread 1 "vpp_main" received signal SIGSEGV, Segmentation fault. dispatch_pending_node (vm=vm@entry=0x7f55e8b94300 <vlib_global_main>, pending_frame_index=pending_frame_index@entry=3, last_time_stamp=510933815354328) at /usr/src/debug/vpp-20.05.1-2~gcb5420544_dirty.x86_64/src/vlib/main.c:1500 1500 nf->flags |= VLIB_FRAME_IS_ALLOCATED; (gdb) bt #0 dispatch_pending_node (vm=vm@entry=0x7f55e8b94300 <vlib_global_main>, pending_frame_index=pending_frame_index@entry=3, last_time_stamp=510933815354328) at /usr/src/debug/vpp-20.05.1-2~gcb5420544_dirty.x86_64/src/vlib/main.c:1500 #1 0x00007f55e8938bf6 in vlib_main_or_worker_loop (is_main=1, vm=0x7f55e8b94300 <vlib_global_main>) at /usr/src/debug/vpp-20.05.1-2~gcb5420544_dirty.x86_64/src/vlib/main.c:2013 #2 vlib_main_loop (vm=0x7f55e8b94300 <vlib_global_main>) at /usr/src/debug/vpp-20.05.1-2~gcb5420544_dirty.x86_64/src/vlib/main.c:2141 #3 vlib_main (vm=<optimized out>, vm@entry=0x7f55e8b94300 <vlib_global_main>, input=input@entry=0x7f55a7fd6fa0) at /usr/src/debug/vpp-20.05.1-2~gcb5420544_dirty.x86_64/src/vlib/main.c:2387 #4 0x00007f55e8978c46 in thread0 (arg=140006953403136) at /usr/src/debug/vpp-20.05.1-2~gcb5420544_dirty.x86_64/src/vlib/unix/main.c:673 #5 0x00007f55e80243dc in clib_calljmp () from /lib64/libvppinfra.so.20.05.1 #6 0x00007ffd742d0920 in ?? () #7 0x00007f55e8979ced in vlib_unix_main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/vpp-20.05.1-2~gcb5420544_dirty.x86_64/src/vlib/unix/main.c:745
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#18687): https://lists.fd.io/g/vpp-dev/message/18687 Mute This Topic: https://lists.fd.io/mt/80421445/21656 Group Owner: vpp-dev+ow...@lists.fd.io Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-