New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProductRecommander sample - System.AccessViolationException #2488

Ikaer opened this Issue Feb 10, 2019 · 3 comments


3 participants
Copy link

Ikaer commented Feb 10, 2019

System information

  • OS version/distro: Win10
  • .NET Version (eg., dotnet --info): .Net Core 2.1


  • What did you do? I tried the sample Product recommander with my own sample of product IDs. I first try it with the provided data (Amazon0302) and it works fine. Then I try a different file (which is attached).
  • What happened? An exception is throw at ITransformer model = est.Fit(traindata); System.AccessViolationException: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.'
  • What did you expect? To not have this kind of exception at least (this is scary) and to be able to use a different sample than the one provided.
    I have the same error if, for example, I truncate the file Amazon0302 to only keep the first 10 lines.

Source code / logs

I just downloaded the ProductRecommander sample and replace the variable TrainingDataLocation with my own file. I reproduced the problem on two machines (one with Win10, another one with Windows Server 2016, both with .net core 2.1)


This comment has been minimized.

Copy link

Ivanidzo4ka commented Feb 11, 2019

Thank you for reporting this. I'll investigate this issue.

@Ivanidzo4ka Ivanidzo4ka added the bug label Feb 11, 2019

@Ivanidzo4ka Ivanidzo4ka self-assigned this Feb 11, 2019

@shauheen shauheen added this to To do in v0.11 Feb 11, 2019


This comment has been minimized.

Copy link

Ivanidzo4ka commented Feb 12, 2019

If you look into sample all across it we use magic number 262111. This number is basically maximum ID +1 you have in your file. Everything above that number would be ignored.
You can put 375092 for your sample and it will work.

But that's not excuse for us to throw exception.
@wschin I can see how matrix factorization throw exception on this line
If I set u=262109 it works fine, if I set u = 262110 it I get ptr equal to null and ptr->v leads to exception (or b[v])


This comment has been minimized.

Copy link

Ikaer commented Feb 12, 2019

Thanks to have check it out 👍 . Really nice of you.

Just a last question, I've provided a fix sample, so I can determine this maximum ID + 1 and set the KeyCount. But ultimately, I would like to provide a dynamic sample, so I can still determine this maximum ID + 1, and I can through code set it on this line:
But I don't know how to dynamically set it on those lines:

@wschin wschin moved this from To do to In Progress in v0.11 Feb 13, 2019

@wschin wschin closed this in #2525 Feb 14, 2019

v0.11 automation moved this from In Progress to Done Feb 14, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment