nupic.core-legacy icon indicating copy to clipboard operation
nupic.core-legacy copied to clipboard

SDRClassifier compute causes segmentation fault

Open ywcui1990 opened this issue 7 years ago • 5 comments

The segmentation fault happens everytime the classifier compute() function writes more than 2 times to the same ClassifierResult instance.

For example, as in the unit test, adding 2 more computes to the same result will cause not only some assertion errors, but also:

c.fastCompute(0, input1, 4, 34.7, false, true, true, &result1); c.fastCompute(1, input1, 4, 34.7, false, true, true, &result1); c.fastCompute(2, input1, 4, 34.7, false, true, true, &result1);

*** Error in./unit_tests': free(): invalid next size (fast): 0x00007f5e58003290 *** Aborted (core dumped)`

If this is run outside gtest, then the error is just a simple "segmentation fault". The way I got around this is by destroying the result object and creating a new one before every compute(), however this defeats the whole purpose of having an associative array inside the result.

See full discussion on this issue on the discourse forum

ywcui1990 avatar Oct 20 '16 16:10 ywcui1990

Also, this happens with both the CLAClassifier and the SDRClassifier, because they write to ClassifierResult in the same way.

dorinclisu avatar Oct 20 '16 16:10 dorinclisu

@natoromano Are you interested in working on this?

rhyolight avatar Oct 20 '16 22:10 rhyolight

@rhyolight is this something that is currently being worked on?

RuneKR avatar May 02 '17 21:05 RuneKR

@MedSolve I don't think anyone is working on this right now.

rhyolight avatar May 02 '17 22:05 rhyolight

I found the course of my problem. I need to classify between 25.000 different classes and this results in high bucketIdx that in return makes everything crash.

-- My bucketIdx had a high offset so adjusting them to be only between 1 and 25.000 worked

RuneKR avatar May 02 '17 22:05 RuneKR