UnsatisfiedLinkError when starting yjp on Ubuntu 16.10

Questions about YourKit Java Profiler
Post Reply
ivoanjo
Posts: 4
Joined: Wed Nov 30, 2016 7:36 pm

UnsatisfiedLinkError when starting yjp on Ubuntu 16.10

Post by ivoanjo »

Hello,

I just downloaded and tried to start the latest early access release of yjp (yjp-2016.06-b32-eap.zip) on linux, and I'm getting the following error:

Code: Select all

$ bin/yjp.sh 
Exception in thread "YJP Startup" java.lang.ExceptionInInitializerError
        at com.yourkit.h.ae.a(a:170)
        at com.yourkit.h.ae.findClass(a:34)
        at com.yourkit.h.ae.loadClass(a:164)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:348)
        at com.yourkit.e.run(a:6)
Caused by: java.lang.RuntimeException: Cannot load /home/knuckles/Apps/yjp-2016.06/bin/linux-x86-64/libyjpagent.so
If you use the profiler API, please make sure you add to the CLASSPATH the yjp.jar from entire YourKit Java Profiler distribution (YJP_HOME/lib/yjp.jar), but not a copy of yjp.jar placed to arbitrary directory.

        at com.yourkit.Natives.a(a:58)
        at com.yourkit.Natives.<clinit>(a:29)
        ... 7 more
Caused by: java.lang.UnsatisfiedLinkError: /home/knuckles/Apps/yjp-2016.06/bin/linux-x86-64/libyjpagent.so: /home/knuckles/Apps/yjp-2016.06/bin/linux-x86-64/libyjpagent.so: failed to map segment from shared object
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
        at java.lang.Runtime.load0(Runtime.java:809)
        at java.lang.System.load(System.java:1086)
        at com.yourkit.Natives.a(a:6)
        ... 8 more
and here are some system details:

Code: Select all

$ java -version
java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)
$ uname -a
Linux maruchan 4.8.0-28-generic #30-Ubuntu SMP Fri Nov 11 14:03:52 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
$ lsb_release -a
LSB Version:    core-9.20160110ubuntu5-amd64:core-9.20160110ubuntu5-noarch:printing-9.20160110ubuntu5-amd64:printing-9.20160110ubuntu5-noarch:security-9.20160110ubuntu5-amd64:security-9.20160110ubuntu5-noarch
Distributor ID: Ubuntu
Description:    Ubuntu 16.10
Release:        16.10
Codename:       yakkety
I can run other java apps just fine, so I'm a bit stumped on what to try next here.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: UnsatisfiedLinkError when starting yjp on Ubuntu 16.10

Post by Anton Katilin »

Hello,

Could you please provide output of the following commands:

file /home/knuckles/Apps/yjp-2016.06/bin/linux-x86-64/libyjpagent.so
ldd /home/knuckles/Apps/yjp-2016.06/bin/linux-x86-64/libyjpagent.so
ls -l /home/knuckles/Apps/yjp-2016.06/bin/linux-x86-64/libyjpagent.so

/home/knuckles/Apps/yjp-2016.06/samples/sample1/run.sh
/home/knuckles/Apps/yjp-2016.06/samples/sample2/run.sh

Best regards,
Anton
ivoanjo
Posts: 4
Joined: Wed Nov 30, 2016 7:36 pm

Re: UnsatisfiedLinkError when starting yjp on Ubuntu 16.10

Post by ivoanjo »

Thanks for the feedback. Here are the results:

Code: Select all

$ file bin/linux-x86-64/libyjpagent.so 
bin/linux-x86-64/libyjpagent.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, stripped

Code: Select all

$ ldd bin/linux-x86-64/libyjpagent.so 
        linux-vdso.so.1 =>  (0x00007ffe2c8e2000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f763248e000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f763228a000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f7631f81000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7631bba000)
        /lib64/ld-linux-x86-64.so.2 (0x000055af72b07000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f763199c000)

Code: Select all

$ ls -l bin/linux-x86-64/libyjpagent.so 
-rwxr-xr-x 1 knuckles knuckles 3646952 nov 17 16:20 bin/linux-x86-64/libyjpagent.so

Code: Select all

$ samples/sample1/run.sh 
Using Java: samples/sample1/../../jre64/bin/java
Using agent: samples/sample1/../../bin/linux-x86-64/libyjpagent.so
[YourKit Java Profiler 2016.06-b32 EAP] Log file: /home/knuckles/.yjp/log/APIDemo1-9739.log
The application has captured its own memory snapshot.
It is saved to the file /home/knuckles/Snapshots/APIDemo1-2016-12-01.snapshot

Code: Select all

$ samples/sample2/run.sh 
Using Java: samples/sample2/../../jre64/bin/java
Using agent: samples/sample2/../../bin/linux-x86-64/libyjpagent.so
[YourKit Java Profiler 2016.06-b32 EAP] Log file: /home/knuckles/.yjp/log/APIDemo2-9855.log
The application has captured its own memory snapshot.
It is saved to the file /home/knuckles/Snapshots/APIDemo2-2016-12-01.snapshot

Loading captured snapshot...
Exception in thread "main" java.lang.ExceptionInInitializerError
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:348)
        at com.yourkit.api.MemorySnapshot.getImplementationClass(a:23)
        at com.yourkit.api.MemorySnapshot.<init>(a:26)
        at com.yourkit.api.MemorySnapshot.<init>(a:68)
        at APIDemo2.main(APIDemo2.java:24)
Caused by: java.lang.RuntimeException: No valid license key available
        at com.yourkit.api.SnapshotImpl.<clinit>(a:10)
        ... 6 more
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: UnsatisfiedLinkError when starting yjp on Ubuntu 16.10

Post by Anton Katilin »

Thank you for providing this detail.
The library loads just fine in the simple cases, so there should be an issue specific to running the full UI.

Could you please provide the profiler UI log file, whose name should be ~/.yjp/log/yjp-<pid>.log
ivoanjo
Posts: 4
Joined: Wed Nov 30, 2016 7:36 pm

Re: UnsatisfiedLinkError when starting yjp on Ubuntu 16.10

Post by ivoanjo »

It would seem that in this case the crash happens before any logging starts. All I have on my "~/.yjp/log/" folder are the APIDemo1 and APIDemo2 log files.
ivoanjo
Posts: 4
Joined: Wed Nov 30, 2016 7:36 pm

Re: UnsatisfiedLinkError when starting yjp on Ubuntu 16.10

Post by ivoanjo »

Update: I was doing some experiments and finally managed to get YourKit to run!

It seems the issue was that my user had a 6GB address space / virtual memory limit on /etc/security/limits.conf .

By removing it, yourkit now launches successfully. So this seems like the JVM was trying to load the native library and not having enough address space size to do it.

Thanks for the support!
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: UnsatisfiedLinkError when starting yjp on Ubuntu 16.10

Post by Anton Katilin »

Thank you for the notification that the problem has been resolved.
Post Reply