Menu

Thread Dump

Help
rzo
2012-03-26
2013-06-12
  • rzo

    rzo - 2012-03-26

    hello, using your tool for the last 3 months thank you.

    1. is there a downloadable version of the javadoc?

    2. can you give instructions on how to download the files read only from sourceforge so i can see code and make java doc locally?

    3. i want a stack trace of the wrapper service. running as a service with config file created by tool. I can run java agent code on the process (on windows as admin).

    But how do i get a handle on the WrappedJavaProcess ? can you provide a sample code ? in http://yajsw.sourceforge.net/#mozTocId896633 "Getting a Thread Dump of the wrapped application" you say:
    WrappedJavaProcess w = …

    w.requestThreadDump();

    need to know what to put in the … to get the instance (only one service running)

    4. will be nice to get a iterator of all WrappedJavaProcess by s static method and ability to run a arbitary jar (so even of priveldges do not allow me to run a java agent I can still invoke some code on the wrapper jvm - might be required for linux/ strict OS

    5. my goal is to get the Thread Dump of the wrapped application - do I need to make a custom wrapper? a sample would be good with Thread Dump of the wrapped application; Monitoring Heap etc

    thanks again

     
  • rzo

    rzo - 2012-03-26

    hello,

    1. is there a downloadable version of the javadoc?

    no, you can easily create one from the source

    2. can you give instructions on how to download the files read only from sourceforge so i can see code and make java doc locally?

    source code is included within the download zip file

    3. i want a stack trace of the wrapper service. running as a service with config file created by tool. I can run java agent code on the process (on windows as admin).

    there are multiple ways to get a stack trace:

    1. using the system tray icon
    2. activating jmx and using a jmx client such as jconsole, which is included in the jdk.
    3. using a groovy script or a command file
    4. yajsw comes with an example script for generating a thread dump at shutdown.
    5. you can access the WrappedJavaProcess object from within a groovy script.

    If you have any questions on the above possibilities pls state which you would like to use.

    The code from the documentation is meant for the case where you are using yajsw from within a java application. If you are just using yajsw to wrap an application and run it as service then you do not need this.

    4. will be nice to get a iterator of all WrappedJavaProcess by s static method and ability to run a arbitary jar (so even of priveldges do not allow me to run a java agent I can still invoke some code on the wrapper jvm - might be required for linux/ strict OS

    this is not clear to me. with yajsw you can wrap a java jar. you can also run a native executable.

    • Ron
     
  • Tushar Kapila

    Tushar Kapila - 2012-03-27

    hello
    we are using Yajsw to wrap a java process (few instances of Jboss and more of our custom server app)

    thanks I just saw the src folder. Was expecting to get the src from svn, so javadoc not an issue either.

    I can use jconsole on my local but do not want to use it on our server as it seems heavy but I will try that if nothing else works.

    The issue I'm facing is that locally I can call a jstack command (of sun java) and get a stack trace but when i try that in my hardended systems it says access denied.  I tried running the command from psExec too but no luck. What we notice is that on some systems with new windows updates our app 'hangs' wanted to do a thread dump before restart to see if its a code issue or OS/ environment

    Can you point me to samples of how you :

    3. using a groovy script or a command file
    4. yajsw comes with an example script for generating a thread dump at shutdown. (if there is a function for this I will try to expose an admin port so I can just write to a new file when a specfic request is recevied on the admin port.)
    5. you can access the WrappedJavaProcess object from within a groovy script.

     
  • Tushar Kapila

    Tushar Kapila - 2012-04-03

    hello, can you help me get started with a grovy script that can get a thread dump and save it to a new text file every time invoked? we need a few dumps every day and when(if) process hangs. right now gone back to console mode but really need to run it as a service and be able to get the dump on demand

    thank you

     
  • rzo

    rzo - 2012-04-03

    hello,

    hello,

    would you like to create the dumps manually (on demand), or automatically at certain intervalls ?

    • Ron
     
  • Tushar Kapila

    Tushar Kapila - 2012-04-04

    on demand will be preferable.

    but intervals will be ok too - once every 30 minutes too. perfect would be to have both :)

    also as a future feature would be nice to have an alternate config file that is read at start and when that file is modified so we can change some settings at run time. like i might want the service to write a dump (or run other scripts) for a few days and then stop that without having to re start the service

    this is important for txn servers where we get new txns in production thru the night and would like to minimize full down times where possible

     
  • rzo

    rzo - 2012-04-06

    hello,

    thread dump on demand is already possible.
    see scripts/commandCondition.gv

    to trigger a thread dump create a file named cmd.txt containing the line

    DUMP

    and copy it to the working folder of the wrapper
    whenever the wrapper detects the file it will trigger a thread dump, which is logged to the log file and then deletes the cmd.txt file.
    note: you may also configure an absolute path to the file.

    to get a dump every 30 seconds you can extend the script as follows:

    after
    process.start()
    add
    nextDumpTime = System.currentTimeMillis()+30000

    at the end of the file add
    if (nextDumpTime > System.currentTimeMillis())
    {
    nextDumpTime = System.currentTimeMillis()+30000
    doCommand("DUMP")
    }

    Let me know if this works for you.

    • Ron
     
  • rzo

    rzo - 2012-04-06

    PS: to control the start/stop the cyclic thread dump change the script as follows:

    after
    process.start()
    add
    doCyclicDump = false

    change
    if (nextDumpTime > System.currentTimeMillis())
    to
    if (nextDumpTime > System.currentTimeMillis() && doCyclicDump )

    before
    else
    logger.info("unknown command");
    add
    else if ("STARTCYCLICDUMP".equals(cmd))
          doCyclicDump = true
    else if ("STOPCYCLICDUMP".equals(cmd))
          doCyclicDump = false

    now you can turn the cyclic dump on/off by writing STARTCYCLICDUMP or STOPCYCLICDUMP to cmd.txt and copying it to the working folder of the wrapper.

    • Ron
     
  • rzo

    rzo - 2012-04-09

    hello,

    these changes will be included in the next release.

    • Ron
     
  • Tushar Kapila

    Tushar Kapila - 2012-09-26

    hi thanks for your replies and I will download the latest and try this next week

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.