Uploaded image for project: 'vpp'
  1. vpp
  2. VPP-1979

VCL app with worker is hang on exit

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: High High
    • None
    • 21.01
    • VCL
    • None

      compile the following VCL app

      g++ -I /home/vadim/vpp/build-root/install-vpp_debug-native/vpp/include main.cpp -L/home/vadim/vpp/build-root/install-vpp_debug-native/vpp/lib -lpthread -lvppcom

      #include <vcl/vppcom.h>
      
      #include <cstdio>
      #include <thread>
      
      int func()
      {
          if (vppcom_worker_register() != VPPCOM_OK)
          {
              printf("failed to initialize worker");
              return 1;
          }
      
          return 0;
      }
      
      int main()
      {
          if (vppcom_app_create("test_vcl_server") != VPPCOM_OK)
          {
              printf("failed to initialize vppcom_app");
              return 1;
          }
      
          std::thread thread1(func);
          thread1.join();
          vppcom_app_destroy();
      
          return 0;
      }
      

      vadim@vadim-lenovo:~/hybrid-ngfw/sources/pdk/network_interceptor/test_vcl_server$ sudo LD_LIBRARY_PATH=/home/vadim/vpp/build-root/install-vpp_debug-native/vpp/lib VCL_CONFIG=/home/vadim/config/vcl.conf gdb a.out
      GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2
      Copyright (C) 2020 Free Software Foundation, Inc.
      License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
      This is free software: you are free to change and redistribute it.
      There is NO WARRANTY, to the extent permitted by law.
      Type "show copying" and "show warranty" for details.
      This GDB was configured as "x86_64-linux-gnu".
      Type "show configuration" for configuration details.
      For bug reporting instructions, please see:
      <http://www.gnu.org/software/gdb/bugs/>.
      Find the GDB manual and other documentation resources online at:
      <http://www.gnu.org/software/gdb/documentation/>.

      For help, type "help".
      Type "apropos word" to search for commands related to "word"...
      Reading symbols from a.out...
      (No debugging symbols found in a.out)
      (gdb) r
      Starting program: /home/vadim/hybrid-ngfw/sources/pdk/network_interceptor/test_vcl_server/a.out
      [Thread debugging using libthread_db enabled]
      Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
      VCL<91647>: allocated VCL heap = 0x7fffe786a000, size 268435456 (0x10000000)
      VCL<91647>: configured rx_fifo_size 1048576 (0x100000)
      VCL<91647>: configured tx_fifo_size 1048576 (0x100000)
      VCL<91647>: configured api-socket-name (/run/vpp/api.sock)
      VCL<91647>: configured with mq with eventfd
      VCL<91647>: configured event_queue_size 524288 (0x80000)
      VCL<91647>: completed parsing vppcom config!
      [New Thread 0x7fffe7869700 (LWP 91651)]
      vcl_bapi_connect_to_vpp:504: vcl<91647:0>: app (test_vcl_server-wrk-0) is connected to VPP!
      vcl_bapi_init:607: vcl<91647:0>: sending session enable
      vppcom_app_create:1267: vcl<91647:0>: app_name 'test_vcl_server', my_client_index 512 (0x200)
      [New Thread 0x7fffe7068700 (LWP 91652)]
      [New Thread 0x7fffe6867700 (LWP 91653)]
      vcl_bapi_connect_to_vpp:504: vcl<91647:1>: app (test_vcl_server-wrk-1) is connected to VPP!
      vl_api_app_worker_add_del_reply_t_handler:227: vcl<0:-1>: worker 1 vpp-worker 1 added
      vcl_worker_register_with_vpp:218: vcl<91647:1>: added worker 1
      vcl_worker_cleanup_cb:145: vcl<0:-1>: cleaned up worker 1
      [Thread 0x7fffe7068700 (LWP 91652) exited]
      [Thread 0x7fffe7869700 (LWP 91651) exited]
      ^C
      Thread 1 "a.out" received signal SIGINT, Interrupt.
      __pthread_clockjoin_ex (threadid=140737060960000, thread_return=0x7fffffffe150, clockid=<optimized out>, abstime=<optimized out>, block=<optimized out>) at pthread_join_common.c:145
      145 pthread_join_common.c: No such file or directory.
      (gdb) thread apply all bt

      Thread 4 (Thread 0x7fffe6867700 (LWP 91653)):
      #0 futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x7f814202c950) at ../sysdeps/nptl/futex-internal.h:183
      #1 __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x7f814202c900, cond=0x7f814202c928) at pthread_cond_wait.c:508
      #2 __pthread_cond_wait (cond=0x7f814202c928, mutex=0x7f814202c900) at pthread_cond_wait.c:638
      #3 0x00007ffff7c5928d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:82
      #4 0x4000000000000000 in ?? ()
      #5 0x0000000000000000 in ?? ()

      Thread 1 (Thread 0x7ffff786a780 (LWP 91647)):
      #0 __pthread_clockjoin_ex (threadid=140737060960000, thread_return=0x7fffffffe150, clockid=<optimized out>, abstime=<optimized out>, block=<optimized out>) at pthread_join_common.c:145
      #1 0x00007ffff7b197c1 in disconnect_from_vlib_internal (do_unmap=0 '\000') at /home/vadim/vpp/src/vlibmemory/memory_client.c:518
      #2 0x00007ffff7b19827 in vl_client_disconnect_from_vlib_no_unmap () at /home/vadim/vpp/src/vlibmemory/memory_client.c:538
      #3 0x00007ffff7b20aaa in vl_socket_client_disconnect2 (scm=0x7fffe786ba18) at /home/vadim/vpp/src/vlibmemory/socket_client.c:237
      #4 0x00007ffff7f50569 in vcl_bapi_disconnect_from_vpp () at /home/vadim/vpp/src/vcl/vcl_bapi.c:519
      #5 0x00007ffff7f39bb8 in vcl_api_detach (wrk=0x7fffe786b8c0) at /home/vadim/vpp/src/vcl/vppcom.c:1228
      #6 0x00007ffff7f3a1d4 in vppcom_app_destroy () at /home/vadim/vpp/src/vcl/vppcom.c:1293
      #7 0x000055555555534b in main ()
      (gdb)

       

      Actual

      HANGED on exit

       

      Expected

      No hang on exit

            florin.coras Florin Coras
            vadim.platonov Vadim Platonov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: