[MINC-users] Running MINC tools from the www user

Alex Zijdenbos alex at bic.mni.mcgill.ca
Mon Apr 21 16:21:30 EDT 2008


Hi Burt,

This remains curious - clearly something in the change to your _www user 
affects the ability of CachedArray to generate a temporary file. I have 
no idea why but since it is very reproducible you can probably figure it 
out somehow.

The CachedArray source lives in the EBTKS library

    http://packages.bic.mni.mcgill.ca/tgz/ebtks-1.6.1.tar.gz

in

    ebtks-1.6.1/templates/

Alternatively, if you wanted to try to move on without identifying the 
source of this problem, you could add a '-nocache' flag to the call(s) 
to volume_stats in the nu_correct scripts (specifically in 
nu_estimate_np_and_em which throws this error). That should tell 
volume_stats to use the non-cached SimpleArray class instead of 
CachedArray as shown in the code snippet you listed.

-- Alex

Burt Crépeault wrote:
> Although I haven't moved an inch on solving the issue (thanks Alex for the
> help), here's more information on my problem:
> 
> 
> 1) If I type type the following command in a terminal window, everything
> works fine:
> /usr/local/minc2/bin/nu_correct -clobber -mapping_dir /Library/MEDICS/tmp
> -tmpdir /Library/MEDICS/tmp/ -iterations 100 -shrink 3 -fwhm 0.1 -distance
> 100 -verbose /Library/MEDICS/tmp/abc1.mnc /Library/MEDICS/tmp/abc.mnc
> 
> 
> 2) If I precede the previous command with sudo -u _www, I get an error:
> sudo -u _www /usr/local/minc2/bin/nu_correct -clobber -mapping_dir
> /Library/MEDICS/tmp -tmpdir /Library/MEDICS/tmp/ -iterations 100 -shrink 3
> -fwhm 0.1 -distance 100 -verbose /Library/MEDICS/tmp/abc1.mnc
> /Library/MEDICS/tmp/abc.mnc
> 
> [nu_correct] [_www at pita.crulrg.local:/usr/local/minc2/lib/perl5/site_perl]
> [2008-04-21 14:44:23] /usr/local/minc2/bin/nu_estimate_np_and_em -parzen
> -log -sharpen 0.1 0.01 -iterations 100 -stop 0.001 -shrink 3 -auto_mask
> -nonotify -b_spline 1 -distance 100 -verbose -execute -clobber -nokeeptmp
> -tmpdir /Library/MEDICS/tmp/ /Library/MEDICS/tmp/abc1.mnc
> /Library/MEDICS/tmp/abc.imp
> 
> Uncorrected volume (input): /Library/MEDICS/tmp/abc1.mnc
> Intensity mapping (output): /Library/MEDICS/tmp/abc.imp
> 
> # Start of NU estimation algorithm
> [nu_estimate_np_and_em]
> [_www at pita.crulrg.local:/usr/local/minc2/lib/perl5/site_perl]
> [2008-04-21 14:44:23] /usr/local/minc2/bin/mincresample -clobber -verbose
> -nearest_neighbour -nelements 20 30 30 -step 10.8 -9.14058 -9.14058
> /Library/MEDICS/tmp/abc1.mnc /Library/MEDICS/tmp/abc1___.mnc
> Transforming slices:....................Done
> [nu_estimate_np_and_em]
> [_www at pita.crulrg.local:/usr/local/minc2/lib/perl5/site_perl]
> [2008-04-21 14:44:23] /usr/local/minc2/bin/mincmath -clobber -verbose -clamp
> -const2 1 1.7e+308 /Library/MEDICS/tmp/abc1___.mnc
> /Library/MEDICS/tmp/abc_log.mnc.temp
> Processing:....................Done
> [nu_estimate_np_and_em]
> [_www at pita.crulrg.local:/usr/local/minc2/lib/perl5/site_perl]
> [2008-04-21 14:44:23] /usr/local/minc2/bin/mincmath -clobber -verbose -zero
> -log /Library/MEDICS/tmp/abc_log.mnc.temp /Library/MEDICS/tmp/abc_log.mnc
> Processing:....................Done
> [nu_estimate_np_and_em]
> [_www at pita.crulrg.local:/usr/local/minc2/lib/perl5/site_perl]
> [2008-04-21 14:44:23] /bin/rm /Library/MEDICS/tmp/abc_log.mnc.temp
> [nu_estimate_np_and_em]
> [_www at pita.crulrg.local:/usr/local/minc2/lib/perl5/site_perl]
> [2008-04-21 14:44:23] /usr/local/minc2/bin/mincinfo -attvalue
> xspace:spacetype -attvalue yspace:spacetype -attvalue zspace:spacetype
> /Library/MEDICS/tmp/abc1___.mnc
> [nu_estimate_np_and_em]
> [_www at pita.crulrg.local:/usr/local/minc2/lib/perl5/site_perl]
> [2008-04-21 14:44:23] /usr/local/minc2/bin/volume_stats -quiet -biModalT
> /Library/MEDICS/tmp/abc1___.mnc
> Assertion failed at line 742 in file templates/CachedArray.cc
> nu_estimate_np_and_em: crashed while running volume_stats (termination
> status=256)
> nu_correct: crashed while running nu_estimate_np_and_em (termination
> status=256)
> 
> 
> 3) The directory /Library/MEDICS/tmp is writable by everyone (mode 777). The
> owner of the directory is _www.
> 
> 
> 4) Temporary files abc1_.mnc, abc1__.mnc, abc1___.mnc and abc_log.mnc all
> get created so I don't suspect a permission problem being the case here.
> 
> 
> 5) I don't quite understand the MINC source code just yet (hey, that's a lot
> of code), where would I find CachedArray.cc?
> 
> 
> 6) I noticed that in volumeStats.cc, there is the following:
> 
>     if (args.cached)
>       voxels = new CachedArray<float>(0);
>     else
>       voxels = new SimpleArray<float>(0);
> 
> Is there a way I could just bypass the call to CachedArray and not bother
> with trying to save memory (after all, GBytes are cheaper than the time
> we're spending to try to make this work... ;)
> 
> 
> Again, many thanks,
> 
> Burt.
> 
> 
> On Wed, Apr 16, 2008 at 5:01 PM, Burt Crépeault <
> burt.crepeault at crulrg.ulaval.ca> wrote:
> 
>> Hi Alex,
>>
>> I went ahead and tried your suggestions, unfortunately I'm still stuck. The /tmp folder still has plenty of space and it is writable by anyone. I still get the following error from running the process:
>>
>>
>>    [7]:     [_www at pita.crulrg.local:/Library/WebServer/Documents/] [2008-04-16 12:32:14] running:
>>    [8]:       /usr/local/minc2/bin/nu_estimate_np_and_em -parzen -log -sharpen 0.1 0.01 -iterations 100
>>                 -stop 0.001 -shrink 3 -auto_mask -nonotify -b_spline 1 -distance 100 -quiet -execute
>>
>>                 -clobber -nokeeptmp -tmpdir /tmp/nu_correct_1361/
>>                 '/Library/MEDICS/data/images/10188/bl/MR.T1.MP-RAGE/1004/Library.MEDICS.data.images.10188.bl.MR.T1.MP-RAGE.1004.1.10004.[mnc.d2m].Br.12_p2.mnc'
>>
>>                 '/Library/MEDICS/data/images/10188/bl/MR.T1.MP-RAGE/1007/Library.MEDICS.data.images.10188.bl.MR.T1.MP-RAGE.1007.1.10007.[mnc.d2m+mnc.nuc].Br.22_p2.imp'
>>    [9]:
>>    [10]:     Assertion failed at line 742 in file templates/CachedArray.cc
>>
>>    [11]:     nu_estimate_np_and_em: crashed while running volume_stats (termination status=256)
>>    [12]:     nu_correct: crashed while running nu_estimate_np_and_em (termination status=256)
>>
>> I've listed my environment variables below:
>>
>>
>>        [TMPDIR] => /tmp
>>        [FOO] => /bar
>>        [PERL5LIB] => :/usr/local/minc2/lib:/Library/Perl/5.8.8:/usr/local/minc2/lib/perl5/site_perl/:/Users/burt/lib/perl
>>        [LD_LIBRARY_PATH] => :/Applications/MATLAB72/dip/Darwin/lib
>>
>>        [PATH] => /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/minc2/bin:/opt/local/bin:/opt/local/sbin:/bin:/usr/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/mysql/bin
>>        [PWD] => /Library/WebServer/Documents
>>
>>        [SHLVL] => 1
>>        [DYLD_LIBRARY_PATH] => :/usr/local/minc2/external-libs
>>
>> I tried the command at line [8] of my log directly in a terminal and everything runs fine. There is a /tmp/nu_correct_xxxx dir that is being created. However, that directory does not appear when the process is launched from the web app, therefore your assumption that CachedArray.cc is unable to create the temp file (or more likely dir) appears to be correct.
>>
>>
>> This is where I'm stuck at the moment, any other ideas?
>>
>>
>> --
>> Burt Crépeault
>> Research Assistant
>> Centre de Recherche de l'Université Laval - Robert-Giffard
>> 418-663-5741, ext 6844


More information about the MINC-users mailing list