Skip to content

NPE from within CoverageModule.convertCoverageToRuby #5111

@JasonLunn

Description

@JasonLunn

After stopping my test Tomcat instance, SimpleCov's at_exit hook is attempting to produce a coverage report, but errors out in the process:

cat ~/opt/apache-tomcat-8.5.20/logs/localhost.2018-03-26.log:

26-Mar-2018 11:22:21.678 SEVERE [localhost-startStop-2] org.apache.catalina.core.ApplicationFilterConfig.release Failed to destroy the filter named [RackFilter] of type [org.jruby.rack.RackFilter]
 java.lang.NullPointerException
        at org.jruby.ext.coverage.CoverageModule.convertCoverageToRuby(CoverageModule.java:81)
        at org.jruby.ext.coverage.CoverageModule.result(CoverageModule.java:61)
        at org.jruby.ext.coverage.CoverageModule$INVOKER$s$0$0$result_DBG.call(CoverageModule$INVOKER$s$0$0$result_DBG.gen)
        at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:298)
        at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:127)
        at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:344)
        at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:74)
        at org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:78)
        at org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:144)
        at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:130)
        at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:192)
        at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:298)
        at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:127)
        at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:344)
        at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:74)
        at org.jruby.ir.interpreter.Interpreter.INTERPRET_BLOCK(Interpreter.java:132)
        at org.jruby.runtime.MixedModeIRBlockBody.commonYieldPath(MixedModeIRBlockBody.java:148)
        at org.jruby.runtime.IRBlockBody.call(IRBlockBody.java:73)
        at org.jruby.runtime.Block.call(Block.java:124)
        at org.jruby.RubyProc.call(RubyProc.java:289)
        at org.jruby.RubyProc.call19(RubyProc.java:273)
        at org.jruby.RubyProc$INVOKER$i$0$0$call19_DBG.call(RubyProc$INVOKER$i$0$0$call19_DBG.gen)
        at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:196)
        at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:192)
        at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:298)
        at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:127)
        at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:344)
        at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:74)
        at org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:78)
        at org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:144)
        at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:130)
        at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:192)
        at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:298)
        at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:127)
        at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:344)
        at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:74)
        at org.jruby.ir.interpreter.Interpreter.INTERPRET_BLOCK(Interpreter.java:132)
        at org.jruby.runtime.MixedModeIRBlockBody.commonYieldPath(MixedModeIRBlockBody.java:148)
        at org.jruby.runtime.IRBlockBody.call(IRBlockBody.java:73)
        at org.jruby.runtime.Block.call(Block.java:124)
        at org.jruby.RubyProc.call(RubyProc.java:289)
        at org.jruby.RubyProc.call(RubyProc.java:246)
        at org.jruby.Ruby.tearDown(Ruby.java:3229)
        at org.jruby.rack.DefaultRackApplicationFactory$RackApplicationImpl.destroy(DefaultRackApplicationFactory.java:455)
        at org.jruby.rack.DefaultRackApplicationFactory.finishedWithApplication(DefaultRackApplicationFactory.java:125)
        at org.jruby.rack.SharedRackApplicationFactory.destroy(SharedRackApplicationFactory.java:60)
        at org.jruby.rack.DefaultRackDispatcher.destroy(DefaultRackDispatcher.java:74)
        at org.jruby.rack.AbstractFilter.destroy(AbstractFilter.java:77)
        at org.apache.catalina.core.ApplicationFilterConfig.release(ApplicationFilterConfig.java:318)
        at org.apache.catalina.core.StandardContext.filterStop(StandardContext.java:4623)
        at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5421)
        at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:226)
        at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1435)
        at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1424)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)

Environment

  • JRuby 9.1.15.0
  • Warbler from master via git
  • Tomcat 8.5.20
  • Java 1.8.0_121-b13
  • macOS High Sierra: Darwin brakebills.home 17.4.0 Darwin Kernel Version 17.4.0: Sun Dec 17 09:19:54 PST 2017; root:xnu-4570.41.2~1/RELEASE_X86_64 x86_64

Other relevant info you may wish to add:

  • SimpleCov 0.16.1
  • Rails 5.0.6
  • RAILS_ENV=test
  • JAVA_OPTS=-Xmx2g -Djruby.debug.fullTrace=true

Expected Behavior

  • I expect SimpleCov to generate a code coverage report without causing an NPE when the JRuby interpreter is spawned by Tomcat / Warbler in a manner similar to how it is able to do so when started from the command line.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions