Coder Social home page Coder Social logo

Comments (13)

apangin avatar apangin commented on September 27, 2024 1

@roy-20230331 libasyncProfiler.so should be available in the container at the same path as in the host. Please see the linked questions for details.

from async-profiler.

apangin avatar apangin commented on September 27, 2024

Please, remove > /dev/null at profiler.sh:48 and rerun the script to see if jattach prints an error message.

from async-profiler.

jakewins avatar jakewins commented on September 27, 2024

Well.. I did that, retried, and the attach worked just fine. Tried adding > /dev/null back, for sanity, but it seems to work now. I'm not entirely sure what I changed. I'll come back with updated output if I'm able to reproduce it again.

from async-profiler.

krems avatar krems commented on September 27, 2024

I've got the same issue
After removing all >/dev/nulls the output is:

Connected to remote JVM
Response code = -1

Failed to inject profiler into 32698
	linux-vdso.so.1 =>  (0x00007fffa0d2d000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f27e9042000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f27e8e26000)
	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f27e8b1f000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f27e889d000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f27e8687000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f27e82fa000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f27e98e5000)

Couldn't find any solution out there.
@apangin , please advise

from async-profiler.

apangin avatar apangin commented on September 27, 2024

@krems Are you building async-profiler from master without changes?

Please check what the following command prints.

java -agentpath:/path/to/libasyncProfiler.so=start,summary,flat -version

from async-profiler.

krems avatar krems commented on September 27, 2024

Yes

$ java -agentpath:./build/libasyncProfiler.so=start,summary,flat -version
Started [cpu] profiling
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
--- Execution profile ---
Total samples:         10
Unknown (native):      3 (30.00%)

Frame buffer usage:    0.0079%

     2091384 (20.60%)       2  Method::make_jmethod_id(ClassLoaderData*, Method*)
     1136257 (11.19%)       1  java.io.BufferedWriter.write
     1015855 (10.00%)       1  java.lang.Thread.<init>
     1012302 ( 9.97%)       1  java.util.LinkedHashMap.linkNodeLast
     1007078 ( 9.92%)       1  ClassFileParser::parseClassFile(Symbol*, ClassLoaderData*, Handle, KlassHandle, GrowableArray<Handle>*, TempNewSymbol&, bool, Thread*)
     1006586 ( 9.91%)       1  SignatureStream::SignatureStream(Symbol*, bool)
      998909 ( 9.84%)       1  SymbolTable::lookup_only(char const*, int, unsigned int&)
      995460 ( 9.80%)       1  clock_gettime

from async-profiler.

krems avatar krems commented on September 27, 2024

I should mention that I have to run profiler via sudo -u user ./profiler.sh

from async-profiler.

apangin avatar apangin commented on September 27, 2024

OK, the library seems to work.
Is anything printed in stderr of the target JVM when you run profiler.sh?

from async-profiler.

krems avatar krems commented on September 27, 2024

No output, but I found out what was the problem.
I'd assume this is our administration settings issue.
Even though I was running profiler.sh under user, the fact that async-profiler/* files were not in that user's home dir prevented profiler from attaching to the JVM process.
Moving async-profiler dir to user's home fixed the problem

from async-profiler.

hvanhovell avatar hvanhovell commented on September 27, 2024

I hit a similar error when I tried to attach the async profiler to something that was running inside a LXC container. Running it from inside the container did the trick for me.

from async-profiler.

apangin avatar apangin commented on September 27, 2024

Thank you for the details. The clue is that profiler library is loaded by the target JVM on behalf of the user of the JVM process. This implies that async-profiler binary must be accessible by that user by exactly the same absolute path. I'll update troubleshooting sections with this information.

from async-profiler.

roy-20230331 avatar roy-20230331 commented on September 27, 2024

Dear @apangin,

I encounter this issue when I run async profiler in host, my application is running as container in this host.

[root@ip-1-1-1-1 async-profiler-2.9-linux-x64]# java -agentpath:/tmp/async-profiler-2.9-linux-x64/build/libasyncProfiler.so=start,flat -version
Profiling started
openjdk version "11.0.18" 2023-01-17 LTS
OpenJDK Runtime Environment Corretto-11.0.18.10.1 (build 11.0.18+10-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.18.10.1 (build 11.0.18+10-LTS, mixed mode)
 Execution profile 
Total samples       : 0
ns  percent  samples  top

[root@ip-1-1-1-1 async-profiler-2.9-linux-x64]# ./profiler.sh -d 30 -e mprotect -f /tmp/a.html 13751
Failed to inject profiler into 13751
./profiler.sh: line 116: /bin/true: No such file or directory
[root@ip-1-1-1-1 async-profiler-2.9-linux-x64]# ./profiler.sh -v
Async-profiler 2.9 built on Nov 26 2022
Copyright 2016-2021 Andrei Pangin
[oot@ip-1-1-1-1 async-profiler-2.9-linux-x64]#

I give all the permission(-rwxrwxrwx) to libasyncProfiler.so.

[root@ip-1-1-1-1 build]# ll
total 460
-rwxrwxrwx 1 root root   5015 Nov 26 22:40 async-profiler.jar
-rwxrwxrwx 1 root root  46172 Nov 26 22:40 converter.jar
-rwxrwxrwx 1 root root  18218 Nov 26 22:40 fdtransfer
-rwxrwxrwx 1 root root  24850 Nov 26 22:40 jattach
-rwxrwxrwx 1 root root 361312 Nov 26 22:40 libasyncProfiler.so
[root@ip-1-1-1-1 build]# 

Could u please kindly help to check?

from async-profiler.

roy-20230331 avatar roy-20230331 commented on September 27, 2024

I see, thx @apangin !

from async-profiler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.