HTTP 502 Aspose.Word for .net onPremise

Hi Aspose-Team,

we currently are using the Aspose.Word for .net API in our App. We have a seperate Web App deployed (on MS Azure) for the Aspose.Word which we are consuming within our core app to convert word documents to pdf documents.
Unfourtunatly we recive a lot of 502 Bad Gateway errors.

Is this a known issue on Aspose side?
Otherwise I think we can narrow it down to the infrastructure of the WebApp.

Regards.

@r.weissP78

Can you please provide more details about the specific scenarios in which you encounter the 502 Bad Gateway errors? Additionally, any error logs or stack traces would be helpful.

I was not able to narrow down any specific documents I recive 502 errors. It seams to happen “randomly”.

Here is the Log when a 502 Error happens:

 Unhandled exception. System.TypeInitializationException: The type initializer for 'SkiaSharp.SKObject' threw an exception.
 2024-08-16T07:56:07.5597114Z  ---> System.DllNotFoundException: Unable to load shared library 'libSkiaSharp' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable:
 2024-08-16T07:56:07.5597160Z /usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.6/libSkiaSharp.so: cannot open shared object file: No such file or directory
 2024-08-16T07:56:07.5597192Z /home/site/wwwroot/libSkiaSharp.so: cannot open shared object file: No such file or directory
 2024-08-16T07:56:07.5597230Z /usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.6/liblibSkiaSharp.so: cannot open shared object file: No such file or directory
 2024-08-16T07:56:07.5597430Z /home/site/wwwroot/liblibSkiaSharp.so: cannot open shared object file: No such file or directory
 2024-08-16T07:56:07.5597466Z /usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.6/libSkiaSharp: cannot open shared object file: No such file or directory
 2024-08-16T07:56:07.5597496Z /home/site/wwwroot/libSkiaSharp: cannot open shared object file: No such file or directory
 2024-08-16T07:56:07.5597532Z /usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.6/liblibSkiaSharp: cannot open shared object file: No such file or directory
 2024-08-16T07:56:07.5597562Z /home/site/wwwroot/liblibSkiaSharp: cannot open shared object file: No such file or directory
 2024-08-16T07:56:07.5597595Z
 2024-08-16T07:56:07.5597624Z    at SkiaSharp.SkiaApi.sk_version_get_milestone()
 2024-08-16T07:56:07.5597664Z    at SkiaSharp.SkiaSharpVersion.get_Native()
 2024-08-16T07:56:07.5597696Z    at SkiaSharp.SkiaSharpVersion.CheckNativeLibraryCompatible(Boolean throwIfIncompatible)
 2024-08-16T07:56:07.5597725Z    at SkiaSharp.SKObject..cctor()
 2024-08-16T07:56:07.5597752Z    --- End of inner exception stack trace ---
 2024-08-16T07:56:07.5597780Z    at SkiaSharp.SKObject.DeregisterHandle(IntPtr handle, SKObject instance)
 2024-08-16T07:56:07.5597807Z    at SkiaSharp.SKObject.set_Handle(IntPtr value)
 2024-08-16T07:56:07.5597833Z    at SkiaSharp.SKNativeObject.Dispose(Boolean disposing)
 2024-08-16T07:56:07.5597862Z    at SkiaSharp.SKObject.Dispose(Boolean disposing)
 2024-08-16T07:56:07.5597900Z    at SkiaSharp.SKBitmap.Dispose(Boolean disposing)
 2024-08-16T07:56:07.5597926Z    at SkiaSharp.SKNativeObject.Finalize()
 2024-08-16T07:56:19.4927836Z /opt/startup/startup.sh: line 20:    90 Aborted                 (core dumped) dotnet "<ourAppName>.dll"
 2024-08-16T07:56:34.2323305Z    _____
 2024-08-16T07:56:34.2323633Z   /  _  \ __________ _________   ____
 2024-08-16T07:56:34.2323666Z  /  /_\  \\___   /  |  \_  __ \_/ __ \
 2024-08-16T07:56:34.2323693Z /    |    \/    /|  |  /|  | \/\  ___/
 2024-08-16T07:56:34.2323721Z \____|__  /_____ \____/ |__|    \___  >
 2024-08-16T07:56:34.2323748Z         \/      \/                  \/
 2024-08-16T07:56:34.2323790Z A P P   S E R V I C E   O N   L I N U X

Then the App starts again.

@r.weissP78 Aspose.Words for .NET Standard and .NET Core uses SkiaSharp to deal with graphics, to make it work on Linux you have to add reference either to SkiaSharp.NativeAssets.Linux or to SkiaSharp.NativeAssets.Linux.NoDependencies

If you add reference to SkiaSharp.NativeAssets.Linux, you should also install libfontconfig1 in your system. SkiaSharp.NativeAssets.Linux depends on this library. You can use the following command to install it:

apt-get update && apt-get install -y libfontconfig1

If you do not have rights to install packages, or other reasons not to install libfontconfig1, you can simply use SkiaSharp.NativeAssets.Linux.NoDependencies , which does not require installation of libfontconfig1.

Thank you, this resolved the issue.

1 Like