Hi Jakob, Fair enough, but given that constructor claims it’s done, I would maybe try to capture this in gdb and try to understand if __vcl_worker_index is initialized properly at the end of vls_app_create in ldp_init. If not, we should probably be exiting straight from the constructor.
Regards, Florin > On Jul 16, 2026, at 1:29 AM, Jakob Lövhall via lists.fd.io > <[email protected]> wrote: > > Hi Florin, > > Yes, it is indeed unable to find the class in the classpath, fixing that > would not trigger a crash in VCL. > But I aim to help vpp be able to not crash the process in this case, the > process is already in the process of exiting but its not pretty to segfault > while doing so : ) > > Kind regards, > Jakob > Från: [email protected] <mailto:[email protected]> <[email protected] > <mailto:[email protected]>> för Florin Coras via lists.fd.io > <http://lists.fd.io/> <[email protected] > <mailto:[email protected]>> > Skickat: den 13 juli 2026 17:41 > Till: [email protected] <mailto:[email protected]> <[email protected] > <mailto:[email protected]>> > Ämne: Re: [vpp-dev] VCL/LDP segfault in vppcom_app_exit when exit handler is > run by an unexpected thread > > Du får inte ofta e-post från [email protected] > <mailto:[email protected]>. Läs om varför det här är viktigt > <https://aka.ms/LearnAboutSenderIdentification> > Hi Jakob, > > It’s not entirely clear from the logs. The first worker constructor seems to > complete successfully, but then "Error: Could not find or load main class > MyApp” triggers a cleanup and at this point I’m not sure if the worker is > still the first one or if we were trying to initialize another one. > > If the latter, and the worker init was somehow interrupted, it might explain > the crash. But the main issue seems to be the error above. Are you maybe > missing a Classpath (-cp) to the folder where your Class file is. > > Regards, > Florin > >> On Jul 13, 2026, at 1:19 AM, Jakob Lövhall via lists.fd.io >> <[email protected]> wrote: >> >> Hi Florin, >> >> Is it clear from the log if that happens? >> Below is a shortened log with debug enabled for VCL and LDP. >> >> Thanks >> >> >> >> numactl --physcpubind=23 /home/<user>/scripts/start.sh >> + export LD_LIBRARY_PATH=/tmp/vpp_files/lib64/ >> + LD_LIBRARY_PATH=/tmp/vpp_files/lib64/ >> + export VCL_CONFIG=/tmp/vpp_files/vcl_startup.conf >> + VCL_CONFIG=/tmp/vpp_files/vcl_startup.conf >> + export VCL_DEBUG=2 >> + VCL_DEBUG=2 >> + export LDP_DEBUG=1 >> + LDP_DEBUG=1 >> + export LD_PRELOAD=/tmp/vpp_files/lib64/libvcl_ldpreload.so >> <http://libvcl_ldpreload.so/>.26.10 >> + LD_PRELOAD=/tmp/vpp_files/lib64/libvcl_ldpreload.so >> <http://libvcl_ldpreload.so/>.26.10 >> + exec java -cp ':/home/<user>/lib/*' MyApp >> ldp<1121497>: configured LDP debug level (1) from env var LDP_DEBUG! >> VCL<1121497>: configured VCL debug level (2) from VCL_DEBUG! >> ldp<1121497>: fd 3: calling libc_close >> allocated VCL heap = 0x7ff5973d63c0, size 268435456 (0x10000000) >> VCL<1121497>: configured rx_fifo_size 400000 (0x61a80) >> VCL<1121497>: configured tx_fifo_size 400000 (0x61a80) >> VCL<1121497>: configured segment_size 1000000000 (0x3b9aca00) >> VCL<1121497>: configured app_scope_global (1) >> VCL<1121497>: configured app-socket-api (/var/run/vpp/app_ns_sockets/default) >> VCL<1121497>: configured with mq with eventfd >> VCL<1121497>: configured event_queue_size 100000 (0x186a0) >> VCL<1121497>: completed parsing vppcom config! >> ldp<1121497>: fd 3: calling libc_close >> ldp<1121497>: calling libc_socket >> ldp<1121497>: fd 4: calling libc_connect(): addr 0x7ffca456a532, len 110 >> ldp<1121497>: fd 7 vlsh -1, cmd 4 >> vppcom_app_init_common:1569: vcl<1121497:0>: app_name 'java-ldp-1121497', >> my_client_index 1 (0x1) >> ldp<1121497>: LDP initialization: done! >> ldp_constructor:2874: LDP<1121497>: LDP constructor: done! >> NOTE: Picked up JDK_JAVA_OPTIONS: >> --add-opens=java.base/jdk.internal.misc=ALL-UNNAMED -Xms20G -Xmx20G >> -XX:+UnlockExperimentalVMOptions -XX:+AlwaysPreTouch >> -Djava.io.tmpdir=/home/<user>/var/services/run >> Picked up JAVA_TOOL_OPTIONS: -Xlog:gc,gc+init::tags,time,uptime,level >> -XX:+PrintFlagsFinal -Xms256m -Xmx1024m -Djava.net.preferIPv4Stack=true >> -Duser.timezone=UTC -Duser.language=en -Duser.country=SE >> ldp<1121497>: fd 9: calling libc_close >> ldp<1121497>: fd 9: calling libc_close >> ldp<1121497>: fd 9: calling libc_close >> ldp<1121497>: fd 11 vlsh -1, cmd 1 >> ldp<1121497>: fd 9: calling libc_close >> ldp<1121497>: fd 11: calling libc_close >> [2026-07-09T21:53:42.613+0200][0.003s][info][gc,init] CardTable entry size: >> 512 >> [2026-07-09T21:53:42.613+0200][0.003s][info][gc ] Using Serial >> [2026-07-09T21:53:47.308+0200][4.698s][info][gc,init] Version: 25.0.3+9-LTS >> (release) >> [2026-07-09T21:53:47.308+0200][4.698s][info][gc,init] CPUs: 32 total, 1 >> available >> [2026-07-09T21:53:47.308+0200][4.698s][info][gc,init] Memory: 188G >> [2026-07-09T21:53:47.308+0200][4.698s][info][gc,init] Large Page Support: >> Disabled >> [2026-07-09T21:53:47.308+0200][4.698s][info][gc,init] NUMA Support: Disabled >> [2026-07-09T21:53:47.308+0200][4.698s][info][gc,init] Compressed Oops: >> Enabled (Zero based) >> [2026-07-09T21:53:47.308+0200][4.698s][info][gc,init] Heap Min Capacity: 20G >> [2026-07-09T21:53:47.308+0200][4.698s][info][gc,init] Heap Initial Capacity: >> 20G >> [2026-07-09T21:53:47.308+0200][4.698s][info][gc,init] Heap Max Capacity: 20G >> [2026-07-09T21:53:47.308+0200][4.698s][info][gc,init] Pre-touch: Enabled >> ldp<1121497>: fd 9: calling libc_close >> [Global flags] >> ccstr AOTCache = >> {product} {default} >> intx hashCode = 5 >> {experimental} {default} >> ldp<1121497>: fd 0 vlsh -1, cmd 3 >> ldp<1121497>: fd 1 vlsh -1, cmd 3 >> ldp<1121497>: fd 2 vlsh -1, cmd 3 >> Error: Could not find or load main class MyApp >> Caused by: java.lang.ClassNotFoundException: MyApp >> ldp_destructor:2894: LDP<1121497>: LDP destructor: done! >> # >> # A fatal error has been detected by the Java Runtime Environment: >> # >> # SIGSEGV (0xb) at pc=0x00007ff5a758dbf6, pid=1121497, tid=1121505 >> # >> # JRE version: OpenJDK Runtime Environment Temurin-25.0.3+9 (25.0.3+9) >> (build 25.0.3+9-LTS) >> # Java VM: OpenJDK 64-Bit Server VM Temurin-25.0.3+9 (25.0.3+9-LTS, mixed >> mode, sharing, tiered, compressed oops, compressed class ptrs, serial gc, >> linux-amd64) >> # Problematic frame: >> # C [libvppcom.so <http://libvppcom.so/>.26.10+0x19bf6] >> vcl_worker_cleanup+0x56 >> # >> # Core dump will be written. Default location: core.1121497 (may not exist) >> # >> # An error report file with more information is saved as: >> # /home/<user>/var/services/run/hs_err_pid1121497.log >> # >> # If you would like to submit a bug report, please visit: >> # https://github.com/adoptium/adoptium-support/issues >> # >> >> >> >> Från: [email protected] <mailto:[email protected]> <[email protected] >> <mailto:[email protected]>> för Florin Coras via lists.fd.io >> <http://lists.fd.io/> <[email protected] >> <mailto:[email protected]>> >> Skickat: den 10 juli 2026 17:53 >> Till: [email protected] <mailto:[email protected]> <[email protected] >> <mailto:[email protected]>> >> Ämne: Re: [vpp-dev] VCL/LDP segfault in vppcom_app_exit when exit handler is >> run by an unexpected thread >> >> Du får inte ofta e-post från [email protected] >> <mailto:[email protected]>. Läs om varför det här är >> viktigt <https://aka.ms/LearnAboutSenderIdentification> >> Hi Jakob, >> >> Would be interesting to understand why __vcl_worker_index is -1. Ideally >> when constructor creates the app, it should initialize the first worker. >> Does that initialize appropriately? >> >> Regards, >> Florin >> >>> On Jul 10, 2026, at 1:19 AM, Jakob Lövhall via lists.fd.io >>> <[email protected]> wrote: >>> >>> Hi, >>> >>> I tried running VPP with its LD_PRELOAD library on a Java app. >>> What I found was that it will segfault if the JVM encounters some kind of >>> issue, for example not finding the main class to run. >>> The segfault happens in vcl_worker_cleanup coming from vppcom_app_exit, it >>> looks like this is due to indexing issues when __vcl_worker_index is -1. >>> >>> Here is a suggestion for patch to avoid it. Please consider it and add test >>> coverage for it. >>> >>> ``` >>> diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c >>> index 70d2674f9..873204945 100644 >>> --- a/src/vcl/vppcom.c >>> +++ b/src/vcl/vppcom.c >>> @@ -1438,6 +1438,11 @@ vppcom_app_exit (void) >>> { >>> if (!pool_elts (vcm->workers)) >>> return; >>> + >>> + /* exiting thread never used vcl */ >>> + if (vcl_get_worker_index () == ~0) >>> + return; >>> + >>> vcl_worker_cleanup (vcl_worker_get_current (), 1 /* notify vpp */ ); >>> vcl_set_worker_index (~0); >>> vcl_elog_stop (vcm); >>> ``` >>> >>> >>> >>> This is what the segfault backtrace looks like in gdb >>> >>> ``` >>> Error: Could not find or load main class MainClass >>> Caused by: java.lang.ClassNotFoundException: MainClass >>> [Thread 0x7fff4ffff6c0 (LWP 1119246) exited] >>> [Thread 0x7fff641f96c0 (LWP 1119243) exited] >>> [Thread 0x7fff642fa6c0 (LWP 1119242) exited] >>> [Thread 0x7fff66b9d6c0 (LWP 1119240) exited] >>> >>> Thread 11 "VM Thread" received signal SIGSEGV, Segmentation fault. >>> [Switching to Thread 0x7fff4fefe6c0 (LWP 1119247)] >>> vcl_worker_cleanup (wrk=wrk@entry=0x853fe7bd0140, >>> notify_vpp=notify_vpp@entry=1 '\001') at vpp/src/vcl/vcl_private.c:123 >>> warning: 123 vpp/src/vcl/vcl_private.c: No such file or directory >>> (gdb) bt >>> #0 vcl_worker_cleanup (wrk=wrk@entry=0x853fe7bd0140, >>> notify_vpp=notify_vpp@entry=1 '\001') at vpp/src/vcl/vcl_private.c:123 >>> #1 0x00007ffff7d6ffb6 in vppcom_app_exit () at vpp/src/vcl/vppcom.c:1441 >>> #2 0x00007ffff7dec231 in __cxa_finalize () from /lib64/libc.so >>> <http://libc.so/>.6 >>> #3 0x00007ffff7d6e1b7 in __do_global_dtors_aux () from >>> /tmp/vpp_files/lib64/libvppcom.so <http://libvppcom.so/>.26.10 >>> #4 0x00007ffff7fc1a50 in ?? () >>> #5 0x00007ffff7fc90e2 in _dl_call_fini (closure_map=0x7fff4fefd5a0, >>> closure_map@entry=0x7ffff7fc1a50) at dl-call_fini.c:43 >>> #6 0x00007ffff7fcd370 in _dl_fini () at dl-fini.c:120 >>> #7 0x00007ffff7dec7b1 in __run_exit_handlers () from /lib64/libc.so >>> <http://libc.so/>.6 >>> #8 0x00007ffff7dec880 in exit () from /lib64/libc.so <http://libc.so/>.6 >>> #9 0x00007fffa9880c79 in os::exit(int) () from >>> /home/<user>/.sdkman/candidates/java/25.0.3-tem/lib/server/libjvm.so >>> <http://libjvm.so/> >>> #10 0x00007fffa942104c in vm_direct_exit(int) () from >>> /home/<user>/.sdkman/candidates/java/25.0.3-tem/lib/server/libjvm.so >>> <http://libjvm.so/> >>> #11 0x00007fffa9c96a67 in VM_Operation::evaluate() () from >>> /home/<user>/.sdkman/candidates/java/25.0.3-tem/lib/server/libjvm.so >>> <http://libjvm.so/> >>> #12 0x00007fffa9c9a0a2 in VMThread::evaluate_operation(VM_Operation*) () >>> from /home/<user>/.sdkman/candidates/java/25.0.3-tem/lib/server/libjvm.so >>> <http://libjvm.so/> >>> #13 0x00007fffa9c9acd7 in VMThread::inner_execute(VM_Operation*) () from >>> /home/<user>/.sdkman/candidates/java/25.0.3-tem/lib/server/libjvm.so >>> <http://libjvm.so/> >>> #14 0x00007fffa9c9af97 in VMThread::run() () from >>> /home/<user>/.sdkman/candidates/java/25.0.3-tem/lib/server/libjvm.so >>> <http://libjvm.so/> >>> #15 0x00007fffa9bf842f in Thread::call_run() () from >>> /home/<user>/.sdkman/candidates/java/25.0.3-tem/lib/server/libjvm.so >>> <http://libjvm.so/> >>> #16 0x00007fffa9875b16 in thread_native_entry(Thread*) () from >>> /home/<user>/.sdkman/candidates/java/25.0.3-tem/lib/server/libjvm.so >>> <http://libjvm.so/> >>> #17 0x00007ffff7e3ea7f in start_thread () from /lib64/libc.so >>> <http://libc.so/>.6 >>> #18 0x00007ffff7eaf4fc in clone3 () from /lib64/libc.so <http://libc.so/>.6 >>> ``` >>> >>> I created a minimal reproducer with Java. Which was just HelloWorld and >>> then misspell the main class such that it cannot be found, but I see that I >>> am not allowed to attach tar.gz files. The reproducer stays with me for >>> now. Hopefully you can reproduce it on your own. >>> >>> Thanks, >>> Jakob >>> >> >> > > >
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#27112): https://lists.fd.io/g/vpp-dev/message/27112 Mute This Topic: https://lists.fd.io/mt/120203465/21656 Group Owner: [email protected] Unsubscribe: https://lists.fd.io/g/vpp-dev/leave/14379924/21656/631435203/xyzzy [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
