Haiyang-Sun / nodeprof.js

Instrumentation framework for Node.js compliant to ECMAScript 2020 based on GraalVM.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when running mocha tests with NodeProf.js vm

thepalbi opened this issue · comments

commented

Hi NodeProf.js team!
I'm trying to use the nodeprof.js instrumented vm to replicate the results of https://github.com/cs-au-dk/taser, since I might use it for master thesis. I'm having a hard time running in the last version of nodeprof.js an empty suite of mocha tests. I want to be able to run the to collect runtime information while the test suite of some Node project is running.

You can see the full trial and error in this issue: cs-au-dk/taser#4

Regardless, the tldr is the following:
I tracked down that the last version of mocha that works with the latest version of nodeprof.js is 5.2.0. Every major release following that errors with a similar trace:

java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 12
        at com.oracle.truffle.object.CoreLocations$LongArrayLocation.getOffset(CoreLocations.java:567)
        at com.oracle.truffle.object.CoreLocations$LongArrayLocation.setLongInternal(CoreLocations.java:525)
        at com.oracle.truffle.object.CoreLocations$LongArrayLocation.setLong(CoreLocations.java:531)
        at com.oracle.truffle.object.CoreLocations$PrimitiveLocationDecorator.setLongInternal(CoreLocations.java:711)
        at com.oracle.truffle.object.CoreLocations$DoubleLocationDecorator.setDouble(CoreLocations.java:818)
[...]
at com.oracle.truffle.js.nodes.instrumentation.DeclareTagProvider$MaterializedFunctionBodyNode.execute(DeclareTagProvider.java:155)
        at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm(FunctionRootNode.java:147)
        at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:93)
        at com.oracle.truffle.api.impl.DefaultCallTarget.callDirectOrIndirect(DefaultCallTarget.java:84)
        at com.oracle.truffle.api.impl.DefaultCallTarget.call(DefaultCallTarget.java:99)
        at com.oracle.truffle.js.runtime.builtins.JSFunction.call(JSFunction.java:311)
        at com.oracle.truffle.js.runtime.JSRuntime.call(JSRuntime.java:2493)
        at com.oracle.truffle.trufflenode.GraalJSAccess.functionCall(GraalJSAccess.java:1424)
        at com.oracle.truffle.trufflenode.GraalJSAccess.functionCall0(GraalJSAccess.java:1433)
Caused by: Attached Guest Language Frames (8)

I've discarded it's something related to TASER, since it fails with the same error when running an empty Jalangi analysis.

Any idea on what might me causing this, and if it's fixable?

Hi @thepalbi , which nodeprof version are you using? What test code are you running? Can you reproduce the bug with our latest binary or docker release ( https://github.com/Haiyang-Sun/nodeprof.js/releases/tag/v20.2.0-dev) here? If you can show me how to reproduce the bug, I may have some time to have a look during the weekends.

commented

Hey @Haiyang-Sun , thanks for the response.
So I tried what you mentioned. I downloaded the latest release of NodeProf, and ran the example with an empty mocha (8.3.2) suite:

describe('Missing assertions', function() {
    it('cloneDeep directly from require', function() {
    })
})

Running the test analysis, --analysis ./nodeprof/examples/example.js, everything runs OK. Now, when I try to use that NodeProf distribution with the TASER analysis, I get some failures related to TASER's codebase, so mostly the NodeProf issues I was having are fixed.

Some questions so I try to fix the error I'm getting:

  • In the analysis codebase, the // DO NOT INSTRUMENT comment is used to avoid analysis the analyzer code right?
  • The js sources in this folder are example analysis correct?

If I don't have luck fixing TASER, I'll probably try to implement my work on top of NodeProf.js directly.