Skip to content
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

GhostScript.NET v1.2.1 Library Load issue #34

Closed
JohnVLinton opened this issue Sep 1, 2017 · 4 comments
Closed

GhostScript.NET v1.2.1 Library Load issue #34

JohnVLinton opened this issue Sep 1, 2017 · 4 comments

Comments

@JohnVLinton
Copy link

As I answered someone else's problem, mine was still only partially solved.

I'm using the library on a website that allows multiple users to upload PDF's at the same time and needs to invoke the GS DLL simultaneously. What I found was this is not possible so instead I use this solution

static lock surrounds -> raster.Open(fileStream, _version, false);

This has been working fine for 99.5% of cases but now for the first time after several months on the server I see this rare-bird 4 times in an hour for a user that I cannot replicate:

System.Exception: Module could not be loaded.
at Microsoft.WinAny.Interop.DynamicNativeLibrary..ctor(String fileName)
at Ghostscript.NET.GhostscriptLibrary..ctor(GhostscriptVersionInfo version, Boolean fromMemory)
at Ghostscript.NET.Interpreter.GhostscriptInterpreter..ctor(GhostscriptVersionInfo version, Boolean fromMemory)
at Ghostscript.NET.Viewer.GhostscriptViewer.Open(String path, GhostscriptVersionInfo versionInfo, Boolean dllFromMemory)
at Ghostscript.NET.Viewer.GhostscriptViewer.Open(Stream stream, GhostscriptVersionInfo versionInfo, Boolean dllFromMemory)
at Ghostscript.NET.Rasterizer.GhostscriptRasterizer.Open(Stream stream, GhostscriptVersionInfo versionInfo, Boolean dllFromMemory)

I have no idea how to replicate it and she tried later with the exact same .pdf upload and this time it works again fine.

My guess is something about the DLL not being entirely in memory correctly, or else IIS recycling and losing the static lock -- but this should be a very rare thing in production and I'm wondering if something else weird is going on with the DLL.

@ahmetmert
Copy link

Did you somehow fix this issue ? After it is been used for a few month, I start constantly getting this exception

@JohnVLinton
Copy link
Author

I believe the fix I found involves enabling 32-bit applications to run in your IIS application pool. (Or at least this is a necessary if not sufficient part of the answer.) Then recycle your pool/app. Elsewise it takes a lot of fiddling still maybe... :(

Definitely look at trying both raster.Open(fileStream, _version, false) and raster.Open(fileStream, _version, true) and comparing performance. Often when one of these doesn't work the other does. If you open from file, lock with static lock around the region you need it open for multiple users.

For such a popular library, it does have some weird little ghosts, if you'll pardon the pun.

@Krashlog
Copy link

We're getting the same errors randomly on some of our web servers. We've been using GhostScript.NET for years without any problems. We've tried enabling 32-bit applications, it seemed to work for a while but the problems came back. So, recycling the app pool seems to fix the problem temporarily, but that's not a long term solution.

So, short of periodically recycling the app pool, any clues/ideas?

@jhabjan
Copy link
Contributor

jhabjan commented Feb 4, 2021

Fixed in today's v.1.2.2. release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants