❔ SKIA SHARP PROBLEM
Error:
"SkiaSharp" Version="2.88.1"
Dec 02 16:05:22 mourashop shopmoura-api-app[3847595]: Unhandled exception. System.ArgumentNullException: Value cannot be null. (Parameter 'buffer')
Dec 02 16:05:22 mourashop shopmoura-api-app[3847595]: at SkiaSharp.SKManagedStream.OnReadManagedStream(IntPtr buffer, IntPtr size)
Dec 02 16:05:22 mourashop shopmoura-api-app[3847595]: at SkiaSharp.SKManagedStream.OnRead(IntPtr buffer, IntPtr size)
Dec 02 16:05:22 mourashop shopmoura-api-app[3847595]: at SkiaSharp.SKAbstractManagedStream.ReadInternal(IntPtr s, Void* context, Void* buffer, IntPtr size)
Dec 02 16:05:23 mourashop systemd[1]: shopmoura-api-app.service: Main process exited, code=killed, status=6/ABRT
Dec 02 16:05:23 mourashop systemd[1]: shopmoura-api-app.service: Failed with result 'signal'.
Dec 02 16:05:33 mourashop systemd[1]: shopmoura-api-app.service: Scheduled restart job, restart counter is at 73.
Dec 02 16:05:22 mourashop shopmoura-api-app[3847595]: Unhandled exception. System.ArgumentNullException: Value cannot be null. (Parameter 'buffer')
Dec 02 16:05:22 mourashop shopmoura-api-app[3847595]: at SkiaSharp.SKManagedStream.OnReadManagedStream(IntPtr buffer, IntPtr size)
Dec 02 16:05:22 mourashop shopmoura-api-app[3847595]: at SkiaSharp.SKManagedStream.OnRead(IntPtr buffer, IntPtr size)
Dec 02 16:05:22 mourashop shopmoura-api-app[3847595]: at SkiaSharp.SKAbstractManagedStream.ReadInternal(IntPtr s, Void* context, Void* buffer, IntPtr size)
Dec 02 16:05:23 mourashop systemd[1]: shopmoura-api-app.service: Main process exited, code=killed, status=6/ABRT
Dec 02 16:05:23 mourashop systemd[1]: shopmoura-api-app.service: Failed with result 'signal'.
Dec 02 16:05:33 mourashop systemd[1]: shopmoura-api-app.service: Scheduled restart job, restart counter is at 73.
6 Replies
only ocurr in production
sincerely idk in which function it happens
private SKImage GetResizedImage(string path, int width, int height)
{
using var srcBitmap = SKBitmap.Decode(Path.Combine(path, "original.webp"));
var sizeInfo = CalculateResizeDimensions(
srcBitmap.Width,
srcBitmap.Height,
width,
height
);
using var surface = SKSurface.Create(sizeInfo);
using var paint = GetSharpeningPaint();
surface.Canvas.DrawBitmap(srcBitmap,
SKRect.Create(0, 0, srcBitmap.Width, srcBitmap.Height),
SKRect.Create(0, 0, sizeInfo.Width, sizeInfo.Height),
paint
);
return surface.Snapshot();
}
private SKImage GetResizedImage(string path, int width, int height)
{
using var srcBitmap = SKBitmap.Decode(Path.Combine(path, "original.webp"));
var sizeInfo = CalculateResizeDimensions(
srcBitmap.Width,
srcBitmap.Height,
width,
height
);
using var surface = SKSurface.Create(sizeInfo);
using var paint = GetSharpeningPaint();
surface.Canvas.DrawBitmap(srcBitmap,
SKRect.Create(0, 0, srcBitmap.Width, srcBitmap.Height),
SKRect.Create(0, 0, sizeInfo.Width, sizeInfo.Height),
paint
);
return surface.Snapshot();
}
private bool TryProcessOriginalFile(string path)
{
using var stream = File.OpenRead(Path.Combine(path, "original"));
using var bmpLossless = SKBitmap.Decode(stream);
if (bmpLossless == null)
{
return false;
}
var outPathWebp = Path.Combine(path, "original.webp");
using (var outFileWebp = new FileStream(outPathWebp, FileMode.Create))
{
bmpLossless.Encode(SKEncodedImageFormat.Webp, 80).SaveTo(outFileWebp);
}
var outPathJpg = Path.Combine(path, "original.jpg");
using (var outFileJpg = new FileStream(outPathJpg, FileMode.Create))
{
bmpLossless.Encode(SKEncodedImageFormat.Jpeg, 70).SaveTo(outFileJpg);
}
return true;
}
private bool TryProcessOriginalFile(string path)
{
using var stream = File.OpenRead(Path.Combine(path, "original"));
using var bmpLossless = SKBitmap.Decode(stream);
if (bmpLossless == null)
{
return false;
}
var outPathWebp = Path.Combine(path, "original.webp");
using (var outFileWebp = new FileStream(outPathWebp, FileMode.Create))
{
bmpLossless.Encode(SKEncodedImageFormat.Webp, 80).SaveTo(outFileWebp);
}
var outPathJpg = Path.Combine(path, "original.jpg");
using (var outFileJpg = new FileStream(outPathJpg, FileMode.Create))
{
bmpLossless.Encode(SKEncodedImageFormat.Jpeg, 70).SaveTo(outFileJpg);
}
return true;
}
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
your last solution seems more approachable at the moment
https://github.com/mono/SkiaSharp/pull/2265
is there possible problems updating "SkiaSharp" Version="2.88.1" to "SkiaSharp" Version="2.88.3" ?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
I'll try it out
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.