Back to the main page.

Bug 1900 - ft_freqstatistics crashes on maci64, due to mex?

Reported 2012-12-17 22:59:00 +0100
Modified 2014-02-24 10:56:25 +0100
Product: FieldTrip
Component: core
Version: unspecified
Hardware: Macintosh
Operating System: Mac OS
Importance: P3 normal
Assigned to: Robert Oostenveld
Depends on:
See also:

Matt Mollison - 2012-12-17 22:59:02 +0100

First off, I apologize if this report doesn't have all the details you might need, but I don't know how to debug mex problems very well. I'm happy to provide more info and data as needed. I'm using Matlab R2012b on a quad-core xeon Mac Pro tower (same computer I've been using FieldTrip on for years). My problem also occurs on R2012a. I have a version of fieldtrip from August (20120802) where ft_freqstatistics works fine. Some time around October I downloaded a new version and ft_freqstatistics started crashing when running a mex file, but I didn't have time to look into it until now so I went back to the August version. However, it seems that the same thing is still happening with fieldtrip-20121216. I can see in the crash log that the offending mex file is fieldtrip/utilities/private/nanmean.maci64. I don't know why it's crashing, I can only tell you that it is. Here are a few potential clues: - I see that fieldtrip/src/nanmean.c has changed significantly between these working (august) and non-working (december) versions of FT. - I tried running ft_compile_mex(true) for the december version and copied fieldtrip/src/nanmean.maci64 to fieldtrip/utilities/private but it still crashes. - The non-working (december) version has fieldtrip/src/nanmean.m (with no actual code inside) while the working (august) one does not. Let me know if there's some way I can help fix this or continue to debug it. I can provide the crash dump if that would be helpful. (Also, I'm surprised that no one else on the email list seems to be having this issue...) Matt

Robert Oostenveld - 2012-12-18 09:52:52 +0100

Created attachment 394 test script for nanstat Thanks for the details sofar. The nan source code has been improved quite a bit recently, but it might be that the changed version was not compiled for all platforms. The reason for the changes to the source code were that we realized that there are fringe cases where it is also supposed to behave correctly, i.e. on int8 data, logicals or with infs in the input. Can you please try and run the attached test script? For me this works on OS X 10.6.8 and MATLAB 2011b.

Matt Mollison - 2012-12-24 23:56:30 +0100

I'm having trouble running this script with the old FT from August. First I had to go download xUnit <>. Then I had to comment out the ft_hastoolbox('xunit', 1); check because it wasn't finding xUnit even though I added it to my path. And then when i=1, it tries to sum a logical vector and errors: Error using nansum Input argument 1 should be numeric Error in test_nanstat (line 37) assertEqual(nansum(x), sum(x)); If I change those to [1, 1, 0] instead, it errors when i=2 because it also wants numeric input. With the new FT from December it successfully runs the entire script, including the ft_hastoolbox check. This is on my laptop, OS X 10.8.2 and Matlab 2012b. (I'm away from campus right now and I'm having VPN issues so I can't get on the computer I was using before.) I don't know how to interpret this result, but I hope that helps.

Matt Mollison - 2013-01-14 23:55:14 +0100

Created attachment 399 Matlab crashdump from nanmean mex, run during ft_freqanalysis

Matt Mollison - 2013-01-14 23:58:48 +0100

(In reply to comment #3) Hi Robert, I can confirm that the test_nanstat script runs through on the Mac Pro tower (OS X 10.6.8, Matlab 2012b, fieldtrip-20130114), just like it did on my laptop, but Matlab still crashes when I try to run ft_freqstatistics. I've attached the crashdump, but it's clear that it is crashing because of nanmean. Going to stick with the fieldtrip from August (20120802) because I need to get some analyses done (hope I'm not missing out on any improvements!). Let me know if I can provide any more info or do any more testing. Matt

Robert Oostenveld - 2013-12-05 10:13:43 +0100

Hi Matt, Sorry for this report remaining open for so long. In the mean time the nanstat mex files have received attention due to other issues and various updates have been done. I hope that the problem has been resolved by one of those updates. If your problem persists, please reopen this bug and we will look at it in more detail. best regards Robert

Robert Oostenveld - 2014-02-24 10:56:25 +0100

I closed several bugs at once that all have been resolved for some time. If you disagree, please reopen.