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

w3wp.exe locks 'libsass*.dll' #55

Open
janvanhelvoort opened this issue Feb 2, 2017 · 12 comments
Open

w3wp.exe locks 'libsass*.dll' #55

janvanhelvoort opened this issue Feb 2, 2017 · 12 comments

Comments

@janvanhelvoort
Copy link

Hi

After running the following code:

var compiler = new SassCompiler(new SassOptions { OutputStyle = SassOutputStyle.Compressed, InputPath = customScssPath });
var result = compiler.Compile();

The dll libsass* is locked, until we kill w3wp.exe

How can we release the resources?

With kind regards,

Jan van Helvoort

@aviatrix
Copy link
Contributor

aviatrix commented Feb 3, 2017

Hey Jan,
What version of libsass are you running?

@janvanhelvoort
Copy link
Author

Hi,

We use version 3.3.7 from libsassnet.

@janvanhelvoort
Copy link
Author

Hi,

Can you reproduce the problem?

@darrenkopp
Copy link
Collaborator

I'm sure I could reproduce this problem if I tried as this happens with basically all native interop and I have encountered this issue before with the sql server binaries we use. I'm not sure if there's a real solution here though since there's no shadow copying of binaries for native interop. I'd have to do some research before I would know for sure.

@janvanhelvoort
Copy link
Author

Hi,

Do you have a update?

@aviatrix
Copy link
Contributor

can you please try updating to latest version and see if you can reproduce it ?

@janvanhelvoort
Copy link
Author

yes, with 3.3.7-alpha-2 the files are locked within w3p.exe

@aviatrix
Copy link
Contributor

aviatrix commented Jun 27, 2017

The stable version should be the one to use, not the alpha, can you try that ?
P.S. we are using alpha 2 in production with foundation 5.x (not the latest) as the scss compiler is not the latest.

@janvanhelvoort
Copy link
Author

janvanhelvoort commented Jul 10, 2017

yes, every version of the package has the same problem.

@wub
Copy link

wub commented Nov 28, 2017

We're having the same problem; we had to inject a PowerShell script into our deployment process to get around it.

@ChaosYoda
Copy link

Is there a working solution for this? We are also using Azure and even on my Desktop it gets locked.

@ghbla
Copy link

ghbla commented Jul 27, 2018

You can do an exit hook in your application and unload the DLL on exit in the Global.asax.cs

    [DllImport("kernel32", SetLastError = true)]
    private static extern bool FreeLibrary(IntPtr hModule);
    public static void UnloadImportedDll(string moduleName)
    {
        var modules = System.Diagnostics.Process.GetCurrentProcess().Modules;
        foreach (System.Diagnostics.ProcessModule mod in modules)
        {
            if (mod.ModuleName == moduleName)
            {
                FreeLibrary(mod.BaseAddress);
            }
        }
    }

    void Application_End(object sender, EventArgs e)
    {
        UnloadImportedDll("libsass32.DLL");
    }

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

5 participants