quasar icon indicating copy to clipboard operation
quasar copied to clipboard

verifyInstrumentation warning about uninstrumented methods in Strand class

Open cheese-stands-alone opened this issue 8 years ago • 10 comments

Starting in quasar 0.7.7 the verifyInstrumentation warning about uninstrumented methods in Strand class, specifically sleep and park. I've created a sample project here https://github.com/rwhite226/quasar-verifyInstrumentation-test. When run with quasar 0.7.6 it runs normal, but when running with quasar 0.7.7 it outputs

WARNING: Uninstrumented whole methods ('**') or single calls ('!!') detected: at co.paralleluniverse.common.util.ExtendedStackTrace.here() (ExtendedStackTrace.java:44 bci: 8) at co.paralleluniverse.fibers.Fiber.checkInstrumentation() (Fiber.java:1668 bci: 0) at co.paralleluniverse.fibers.Fiber.verifySuspend(co.paralleluniverse.fibers.Fiber) (Fiber.java:1641 bci: 6) at co.paralleluniverse.fibers.Fiber.verifySuspend() (Fiber.java:1636 bci: 3) at co.paralleluniverse.fibers.Fiber.park(java.lang.Object,co.paralleluniverse.fibers.Fiber$ParkAction,long,java.util.concurrent.TimeUnit) (Fiber.java:620 bci: 0) at co.paralleluniverse.fibers.Fiber.park(java.lang.Object) (Fiber.java:632 bci: 4) at co.paralleluniverse.strands.Strand.park(java.lang.Object) (Strand.java:536 bci: 78) !! (instrumented suspendable calls at: BCIs [54], lines [536]) at co.paralleluniverse.strands.ConditionSynchronizer.await(int) (ConditionSynchronizer.java:54 bci: 255) at co.paralleluniverse.strands.channels.SingleConsumerQueueChannel.receive() (SingleConsumerQueueChannel.java:94 bci: 193) at co.paralleluniverse.actors.Actor.receive() (Actor.java:481 bci: 94) at com.test.Ping.doRun() (test.kt:29 bci: 356) at com.test.Ping.doRun() (test.kt:24 bci: 1) at co.paralleluniverse.actors.Actor.run0() (Actor.java:710 bci: 222) at co.paralleluniverse.actors.ActorRunner.run() (ActorRunner.java:51 bci: 148) at co.paralleluniverse.actors.Actor.run() (Actor.java:278 bci: 80) at co.paralleluniverse.fibers.Fiber.run() (Fiber.java:1072 bci: 11) at co.paralleluniverse.fibers.Fiber.run1() (Fiber.java:1067 bci: 1)

for each ping/pong.

cheese-stands-alone avatar Dec 05 '16 16:12 cheese-stands-alone

We see the same thing in Corda (github.com/corda/corda). We can't upgrade to 0.7.7 because it flags a call to Fiber.parkAndSerialize as uninstrumented. The issue appears to be a mismatch between the bytecode offset it's expecting to see and what it gets from inside HotSpot.

We have one method (annotated as @Suspendable by hand) that calls parkAndSerialize. It gets this BCI in the @Instrumented annotation:

suspendableCallSiteOffsetsAfterInstr = [112]

but what it got from the ExtendedStackTraceHotSpot$ExtendedStackTraceElement is 151 - they don't match and it gets flagged.

This code is grovelling around in HotSpot's memory, so it isn't surprising that this check is a bit fragile. Perhaps we could have a system property or some other flag to disable this code and fall back to just matching line numbers?

If I had to guess I'd point the finger at one of the JIT compilers doing some bytecode-level inlining which is then being reflected in the internal stack trace data.

mikehearn avatar Jan 03 '17 15:01 mikehearn

What we can do is, instead of recording the bcis instrumented, we record the names of the method calls instrumented. This should be almost as accurate as bcis and far less brittle.

pron avatar Jan 04 '17 11:01 pron

Sounds good to me.

mikehearn avatar Jan 04 '17 12:01 mikehearn

There's now a new name-based (rather than bci-based) verification technique 74c2fb42bd8f71fc21e4afd6e2f502f2f3c52550. You can give it a try at 0.7.8-SNAPSHOT.

pron avatar Jan 10 '17 20:01 pron

I have the same problem and tested with 0.7.8: https://github.com/puniverse/quasar/issues/254

fab1an avatar Mar 16 '17 20:03 fab1an

@rwhite226 @mikehearn Can you give it a try again now with a fresh local 0.7.8-SNAPSHOT build from HEAD? The fix for #254 seems to have solved this one too for me, I've just tried with https://github.com/rwhite226/quasar-verifyInstrumentation-test and got no instrumentation warnings.

circlespainter avatar Apr 14 '17 05:04 circlespainter

@circlespainter is there a planned release date for version 0.7.8?

I've upgraded to 0.7.8 and still experiencing this issue.

ov7a avatar May 26 '17 15:05 ov7a

Does the problem occur in 0.7.9?

pron avatar Jul 31 '17 13:07 pron

i occur this issue too

yanxinyuan avatar Mar 15 '18 09:03 yanxinyuan