[rvm-research] Runtime Exception with JMX

Erik Brangs <[email protected]> Thu, 28 Jun 2018 08:24:25 +0200
Newsgroups gmane.comp.java.jikes.rvm.devel
Message-ID <[email protected]>
Hi,

On 28.06.2018 01:12, Khaled Z Mahmoud wrote:
> I imported the latest changes and I am still getting the same error.
> My code is inside the RVMThread class inside the yieldpoint method.
> 
>         if(!t.isSystemThread()) {
>                 ThreadMXBean tMXB = ManagementFactory.getThreadMXBean();
>                 long tid = t.getId();
>                 ThreadInfo tInfo = tMXB.getThreadInfo(tid,0);
>                 if(tInfo!=null) {             
>                         tInfo.getBlockedCount();
>                         tInfo.getBlockedTime();
>                         tInfo.getLockedMonitors();
>                         tInfo.getLockedSynchronizers();
>                 }
>         }
> 
> If I do not call JMX, not exception happens.

The information that you're interested in is actually not provided by our JMX implementation. The JMX implementation is at libraryInterface/GNUClasspath/EPL/src/gnu/java/lang/management/VMThreadMXBeanImpl.java . The relevant parts are:

long blockedCount = 0; // TODO number of times blocked for Java monitors
long blockedTime = 0; // TODO total time blocked for Java monitors
MonitorInfo[] emptyMonitorInfo = new MonitorInfo[0];
LockInfo[] emptyLockInfo = new LockInfo[0];

Moreover, the approach that you're using really doesn't fit with the design of the Jikes RVM. The yieldpoint method isn't supposed to do actually do any "real" work.

Have you looked into doing instrumentation via an opt compiler phase? I don't have experience with this but according to our user guide this should be doable (see section 8.1 Instrumented Event Counters). Yieldpoint counters look like they could fit your use case.


Kind regards,

Erik Brangs

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot