java NullPointerException when running SPM Level1Design

30 views
Skip to first unread message

Jason

unread,
May 21, 2014, 6:54:46 PM5/21/14
to nipy...@googlegroups.com
Hello, 

I have encountered this problem with 2 different scripts (slight modifications of the SPM nested workflow example, http://nipy.sourceforge.net/nipype/users/examples/fmri_spm_nested.html  and the SPM fMRI & Dartel example, http://nipy.sourceforge.net/nipype/users/examples/fmri_spm_dartel.html). The workflow runs fine if I only run a few subjects, but if I try to run a large batch, I eventually get java errors, specifically when it runs the spm.Level1Design nodes. I notice that while running these nodes, it briefly opens a window displaying the design matrix, etc. for each subject. My suspicion is that this leads to problems when running too many (possibly from memory leaks?). The following java errors are repeated in the command window several times: 

java.lang.NullPointerException
at com.mathworks.hg.peer.LabelPeer.doSetString(LabelPeer.java:86)
at com.mathworks.hg.peer.AbstractUicontrolPeer$11.run(AbstractUicontrolPeer.java:625)
at com.mathworks.hg.util.HGPeerQueue$HGPeerRunnablesRunner.runit(HGPeerQueue.java:273)
at com.mathworks.hg.util.HGPeerQueue$HGPeerRunnablesRunner.runNotThese(HGPeerQueue.java:305)
at com.mathworks.hg.util.HGPeerQueue$HGPeerRunnablesRunner.run(HGPeerQueue.java:321)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:721)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:682)
at java.awt.EventQueue$3.run(EventQueue.java:680)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:691)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
java.lang.NullPointerException
at com.mathworks.hg.peer.AbstractUicontrolPeer.doSetVisible(AbstractUicontrolPeer.java:1264)
at com.mathworks.hg.peer.AbstractUicontrolPeer$13.run(AbstractUicontrolPeer.java:664)
at com.mathworks.hg.util.HGPeerQueue$HGPeerRunnablesRunner.runit(HGPeerQueue.java:273)
at com.mathworks.hg.util.HGPeerQueue$HGPeerRunnablesRunner.runNotThese(HGPeerQueue.java:305)
at com.mathworks.hg.util.HGPeerQueue$HGPeerRunnablesRunner.run(HGPeerQueue.java:321)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:721)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:682)
at java.awt.EventQueue$3.run(EventQueue.java:680)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:691)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

I'm running on a new MacPro (2014 model) with OSX 10.9 Mavericks, Matlab 2013b, SPM8, and Nipype development version 1.0. I got the same errors with Nipype 0.9. 

Any advice on diagnosing this?  

Thanks!
Jason

Thomas Nickson

unread,
May 22, 2014, 12:26:28 PM5/22/14
to nipy...@googlegroups.com
Must be a matlab error as that's the only thing I can think that uses Java. I think there are options to turn off java and windowing when you set up matlab i.e

 Set the way matlab should be called
 import nipype.interfaces.matlab as mlab      # how to run matlab
 mlab.MatlabCommand.set_default_matlab_cmd("matlab -nodesktop -nosplash")
You can add -nojvm option as well if you want.

http://www.mathworks.co.uk/help/matlab/matlab_env/startup-options.html


--

---
You received this message because you are subscribed to the Google Groups "NiPy Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nipy-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jason

unread,
May 28, 2014, 8:00:23 PM5/28/14
to nipy...@googlegroups.com
Thanks, yes I figured it was probably Matlab's fault. The -nojvm option didn't work because SPM must use java to some extent in the background. I was able to fix it, however, using "-nodisplay" instead of "-nodesktop" when calling matlab:

mlab.MatlabCommand.set_default_matlab_cmd("matlab -nodisplay -nosplash")


It seems that the mac version of Matlab has issues when opening lots of figures, and java runs out of memory quickly: http://stackoverflow.com/questions/6201272/how-to-avoid-matlab-crash-when-opening-too-many-figures

The spm.Level1Design node opens a window displaying the design matrix for every subject. That's why it didn't crash when only running a few subjects, but had problems when running 20 or more.


Thanks for your help.
Jason
Reply all
Reply to author
Forward
0 new messages