SkiaSharp: [BUG] Random unit test crashes in dev/update-skia?

I am trying to run the units tests in the dev/update-skia branch, so I can continue working on PRs, but my dotnet test run always fails randomly, with native exceptions (access violations). Sometimes a dozens of tests succeed before crashing, sometimes upto abour 100, so this smells like a multi threading issues. I have 32 hyperthreads (AMD 3950x) all running at the same time, so this might reveal race conditions.

Is this a known issue?

I have build both the native and managed code successfully, on Windows 10, using the latest version of VS2019.

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Comments: 16 (16 by maintainers)

Most upvoted comments

I think I found it…

m68: (https://github.com/mono/skia/blob/xamarin-mobile-bindings/src/c/sk_types_priv.h#L193) ref on the way in

sk_ref_sp(AsColorSpace(info->colorspace)));

m80: (https://github.com/mono/skia/blob/dev/update-m80/src/c/sk_types_priv.h#L210) NO REF on the way in

sk_sp<SkColorSpace>(AsColorSpace(info->colorspace))); 

Let me fix that. What is happening is that when I get the struct from native code, the cs is incremented. When it reaches managed code, it is decremented. So no problem. However, when it goes back into the native code, it is not incremented, so when the native code cleans up, it gets decremented.