Rule does not fire (missing log entry) at high concurrency
willreichert Feb 20, 2013 3:47 PMI created simple method entry exit rules to track method execution times (wall time) but some of the rules are not firing when I increase the concurrency for the benchmark.
Background
I started by using the built in timers but the output reported a smaller elapsed time for methods that were lower on the call stack (which I believe is not possible). I could not figure out why the methods were reporting a longer execution time than the calling method so I switched my approach to log the timestamp of method entry and exit. This generates a great deal more log data (8G for a 20min test). Using the method entry / exit logging I noticed there were more method entries than exits for some of the methods in the callstack.
Byteman Script:
The actual script traces several methods but each method follows the entry / exit pattern below:
RULE org.spec.jent.ejb.mfg.session.WorkOrderSession.scheduleWorkOrder_entry CLASS org.spec.jent.ejb.mfg.session.WorkOrderSession METHOD scheduleWorkOrder AT ENTRY BIND threadId = Thread.currentThread().getId(); threadName = Thread.currentThread().getName(); nanoTime = ""+System.nanoTime(); milliTime = ""+System.currentTimeMillis(); methodId = "org.spec.jent.ejb.mfg.session.WorkOrderSession.scheduleWorkOrder"; IF TRUE DO openTrace("timedStacks","/home/benchuser/entryExit.log"); traceln("timedStacks","{\"entry\":\""+methodId+"\",\"threadId\":"+threadId+",\"threadName\":\""+threadName+"\",\"nano\":"+nanoTime+",\"milli\":"+milliTime+"}"); ENDRULE RULE org.spec.jent.ejb.mfg.session.WorkOrderSession.scheduleWorkOrder_exit CLASS org.spec.jent.ejb.mfg.session.WorkOrderSession METHOD scheduleWorkOrder AT EXIT BIND threadId = Thread.currentThread().getId(); threadName = Thread.currentThread().getName(); nanoTime = ""+System.nanoTime(); milliTime = ""+System.currentTimeMillis(); methodId = "org.spec.jent.ejb.mfg.session.WorkOrderSession.scheduleWorkOrder"; IF TRUE DO openTrace("timedStacks","/home/benchuser/entryExit.log"); traceln("timedStacks","{\"exit\":\""+methodId+"\",\"threadId\":"+threadId+",\"threadName\":\""+threadName+"\",\"nano\":"+nanoTime+",\"milli\":"+milliTime+"}"); ENDRULE
JVM arguments:
JAVA_OPTS="$JAVA_OPTS -Dorg.jboss.byteman.compile.to.bytecode" JAVA_OPTS="$JAVA_OPTS -javaagent:${BYTEMAN_HOME}/lib/byteman.jar=listener:false,boot:${BYTEMAN_HOME}/lib/byteman.jar,script:/home/benchuser/entryExit.btm" JAVA_OPTS="$JAVA_OPTS -Dorg.jboss.byteman.transform.all"
It looks like traceln immediately flushes the message to the stream so I do not think there is an issue with buffer overflow for logging but please correct me if I am wrong. I suspect the problem may be that an exception is being thrown and therefore AT EXIT is not being invoked. Is there a different rule type I could use which would invoke even if the method exits becasue of an exception?