nextflow-io / nextflow

A DSL for data-driven computational pipelines
http://nextflow.io
Apache License 2.0
2.78k stars 634 forks source link

Hangs after NullPointerException in map #506

Closed timdiels closed 7 years ago

timdiels commented 7 years ago

Running the following with a missing clime column in the csv, causes nextflow to hang until given C-c twice.

// Parse species.txt
Channel
    .fromPath("$params.input/species.txt")
    .splitCsv(sep: "\t", header: true)
    .map {
        def specie = [
            name: it.name,
            id: it.id,
            proteome: Paths.get(it.proteome),
            longName: it.long_name,
            orthofinder: it.orthofinder.toBoolean(),
            phyml: it.phyml.toBoolean(),
            interproscan: it.interproscan.toBoolean(),
            blast2go: it.blast2go.toBoolean(),
            clime: it.clime.toBoolean(),
        ]

        // Assert proteome is an absolute path
        if (!specie.proteome.isAbsolute()) {
            error(
                "$specie.name's proteome must be an absolute path, got: $specie.proteome"
            )
        }

        // Assert OrthoFinder is set when PhyML is set
        if (!specie.orthofinder && specie.phyml) {
            error(
                "$specie.name has PhyML set, but not OrthoFinder. PhyML requires " +
                "OrthoFinder. Please set OrthoFinder as well or unset PhyML."
            )
        }

        // Assert PhyML is set when CLIME is set
        if (!specie.phyml && specie.clime) {
            error(
                "$specie.name has CLIME set, but not PhyML. CLIME requires " +
                "PhyML. Please set PhyML as well or unset CLIME."
            )
        }

        //
        return specie
    }
    .set { species }

Stdout/err:

Picked up JAVA_TOOL_OPTIONS: -XX:ParallelGCThreads=1
N E X T F L O W  ~  version 0.24.2
Launching `/home/tidie/projects/cedalion/main.nf` [admiring_knuth] - revision: ba99cac2c0
ERROR ~ Cannot invoke method toBoolean() on null object

 -- Check script 'main.nf' at line: 115 or see '.nextflow.log' file for more details
[warm up] executor > local
[warm up] executor > sge
^C
^COne more CTRL+C to force exit
^CAdieu

From .nextflow.log:

java.lang.NullPointerException: Cannot invoke method toBoolean() on null object                                                                                                                                     
        at org.codehaus.groovy.runtime.NullObject.invokeMethod(NullObject.java:91)                                                                                                                                  
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:48)                                                                                                                   
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)                                                                                                                    
        at org.codehaus.groovy.runtime.callsite.NullCallSite.call(NullCallSite.java:35)                                                                                                                             
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)                                                                                                                    
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)                                                                                                                    
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)                                                                                                                    
        at _nf_script_85e9e12a$_run_closure3.doCall(_nf_script_85e9e12a:115)                                                                                                                                        
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)                                                                                                                                              
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)                                                                                                                            
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)                                                                                                                    
        at java.lang.reflect.Method.invoke(Method.java:497)                                                                                                                                                         
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)                                                                                                                                 
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)                                                                                                                                               
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)                                                                                                           
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1027)                                                                                                                                          
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)                                                                                                                   
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)                                                                                                                    
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)                                                                                                                    
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)                                                                                                                    
        at nextflow.extension.MapOp$_apply_closure1.doCall(MapOp.groovy:49)                                                                                                                                         
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)                                                                                                                                              
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)                                                                                                                            
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)                                                                                                                    
        at java.lang.reflect.Method.invoke(Method.java:497)                                                                                                                                                         
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)                                                                                                                                 
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)                                                                                                                                               
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)                                                                                                           
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1027)                                                                                                                                          
        at groovy.lang.Closure.call(Closure.java:414)                                                                                                                                                               
        at groovyx.gpars.dataflow.operator.DataflowOperatorActor.startTask(DataflowOperatorActor.java:120)                                                                                                          
        at groovyx.gpars.dataflow.operator.DataflowOperatorActor.onMessage(DataflowOperatorActor.java:108)                                                                                                          
        at groovyx.gpars.actor.impl.SDAClosure$1.call(SDAClosure.java:43)                                                                                                                                           
        at groovyx.gpars.actor.AbstractLoopingActor.runEnhancedWithoutRepliesOnMessages(AbstractLoopingActor.java:293)                                                                                              
        at groovyx.gpars.actor.AbstractLoopingActor.access$400(AbstractLoopingActor.java:30)                                                                                                                        
        at groovyx.gpars.actor.AbstractLoopingActor$1.handleMessage(AbstractLoopingActor.java:93)                                                                                                                   
        at groovyx.gpars.util.AsyncMessagingCore.run(AsyncMessagingCore.java:132)                                                                                                                                   
        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) 
pditommaso commented 7 years ago

I'm closing because I'm unable to replicate the issue. Feel free to reopen if you are able to provide a replicable test case.