2 Replies Latest reply on Jun 21, 2007 3:40 AM by yimianshisan

    About Kill -3 signal

    yimianshisan

      You know the jboss profiler will sleep until you send a wake-up signal.
      The wake-up and stop signal can be sent by a kill -3 command on UNIX.
      I just want to know the reson for this, why I send kill -3 pid, the profiler will wake up. Why not kill -4.
      Whre the kill -3 signal are captured? In Jboss Inspector? or JVM?
      And If I want to pause the profiling,which signal should I send?

      Can anyone give me an answer , or the detail process of kill -3 signal.

      Thank you very much!

        • 1. Re: About Kill -3 signal
          clebert.suconic

          The signal is captured by the JVM, and there is a specific API for that signal on JVMPI.

          I tried capturing signals on the native layer... but every time I tried breaking the regular flow of execution.... (JVM->NativeLayer) I got crashes.


          The first version used only kill -3, later I developed a MBean where you could use Java->native methods to control its life cycle.

          The best way to control the execution now would be through MBean.. but you need to have the jboss-profiler-noAOP.sar deployed before JBoss started.

          • 2. Re: About Kill -3 signal
            yimianshisan

            Thank you Clerbert!

            I know the execution can be controlled by MBean well, it's really a better way.

            But what I want to know is the principle of the signal handle. I have tried to define my own signal handling method in jbossInspector.cc. as following:

            void signalStartProfiler(int signum)
            {
            if (profilerRunning>=0) {
            initProfiler();
            } else {
            printMessageError();
            }
            }

            and in the JVM_onLoad() method, I added the following code:

            signal(SIGUSR1,signalStartProfiler);

            Now I can send signal kill -10 to the process. the profiling now can be started, but the process is dead. When I delete the following code in method initProfile,every thing is OK.

            if (profileMemory)
            {
            jvmpi_interface->DisableEvent(JVMPI_EVENT_OBJECT_ALLOC, NULL);
            jvmpi_interface->DisableEvent(JVMPI_EVENT_OBJECT_FREE, NULL);
            }

            It is interesting, but I don't know why. when I define my own signal handle,what the JVM had done?