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

"Unable to find an entry point named 'libsass_version' in DLL 'libsass'." on Azure Web App #26

Closed
RaceProUK opened this issue Feb 12, 2018 · 17 comments

Comments

@RaceProUK
Copy link

RaceProUK commented Feb 12, 2018

I'm seeing this error appear in our websites' ELMAH logs occasionally, and while it usually disappears pretty quickly, it recently persisted for many hours, resulting in one of our websites (thankfully a very low traffic one) being unavailable for some time.

I've looked through the code in this repository, and I don't see a way in which this issue can be fixed by a simple code change. However, I've elected to report it anyway, just in case someone else is having the same issue and can help shed more light on what exactly is happening. I'm also hoping that, if anyone has found a solution, they will elect to provide it on this issue.

I'm using the following NuGet packages (fully updated):

  • LibSassHost
  • LibSassHost.Native.win-x86
@Taritsyn
Copy link
Owner

Taritsyn commented Feb 14, 2018

Hello!

Unable to find an entry point named 'libsass_version' in DLL 'libsass'.

A very strange error. There is a feeling, that loads a old version of the libsass.dll file, in which the libsass_version method has not yet been implemented. I recommend checking the bin directory for unnecessary libsass.dll files.

@RaceProUK
Copy link
Author

I only see the one in bin\x86, which is what I'd expect given the packages I'm using. I'll keep an eye on it though, and see if that changes at any point.

@RaceProUK
Copy link
Author

The errors appear to have stopped, so I'm closing the issue.

@RaceProUK
Copy link
Author

Unfortunately, it appears this error has returned 🙁

@RaceProUK RaceProUK reopened this Jun 29, 2018
@binkiesjoris
Copy link

We are encountering the exact same error, it appears randomly since about a week ago and for 2 builds minutes, or even seconds, apart the one fails but the other succeeds. We are using the .net libsass library (also in a Azure web app environment), so it would seem the common denominators are Azure and the libsass base libraries. For what it is worth, directly after switching the Azure app from x32 to x64 the problem seemed to be gone (for now). It might be related to file locking issue as reported here: sass/libsass-net#55

[EntryPointNotFoundException: Unable to find an entry point named 'libsass_version' in DLL 'libsass32'.] LibSass.Compiler.SassExterns32.libsass_version() +0 LibSass.Compiler.SassExterns.libsass_version() +7 LibSass.Compiler.Context.SassSafeContextHandle.LibsassVersion() +27 LibSass.Compiler.SassCompiler..cctor() +116 [TypeInitializationException: The type initializer for 'LibSass.Compiler.SassCompiler' threw an exception.] LibSass.Compiler.SassCompiler..ctor(ISassOptions sassOptions) +0

@RaceProUK
Copy link
Author

This is now starting to happen alarmingly often, despite no changes related to this package except updating to the latest version (1.2.1 at the time of posting, with v1.2.0 of the Native packages). I'm now having to restart affected websites almost daily to clear this error, and it's starting to risk us losing customers.

I understand this may not be an easy issue to solve, but surely there must be something that can be done? I'm going to continue investigating, but I can only do so much.

@Taritsyn
Copy link
Owner

Give me a full description of the error. Since version 1.2.0, there should already be another stack trace.

@RaceProUK
Copy link
Author

This is the full stack trace from our ELMAH log:

During loading of Sass compiler error has occurred. See the original error message: “Unable to find an entry point named 'libsass_version' in DLL 'libsass'.”. ---> LibSassHost.SassCompilerLoadException: During loading of Sass compiler error has occurred. See the original error message: “Unable to find an entry point named 'libsass_version' in DLL 'libsass'.”. ---> System.EntryPointNotFoundException: Unable to find an entry point named 'libsass_version' in DLL 'libsass'.
   at LibSassHost.Internal.Native.Sass_Api.libsass_version()
   at LibSassHost.SassCompiler.Initialize()
   --- End of inner exception stack trace ---
   at LibSassHost.SassCompiler.Initialize()
   at LibSassHost.SassCompiler.InnerCompile(String content, Boolean indentedSyntax, String inputPath, String outputPath, String sourceMapPath, CompilationOptions options)
   at LibSassHost.SassCompiler.Compile(String content, String inputPath, String outputPath, String sourceMapPath, CompilationOptions options)
   at BundleTransformer.SassAndScss.Translators.SassAndScssTranslator.InnerTranslate(IAsset asset, CompilationOptions sassOptions, Boolean enableNativeMinification)
   --- End of inner exception stack trace ---
   at BundleTransformer.SassAndScss.Translators.SassAndScssTranslator.InnerTranslate(IAsset asset, CompilationOptions sassOptions, Boolean enableNativeMinification)
   at BundleTransformer.SassAndScss.Translators.SassAndScssTranslator.Translate(IList`1 assets)
   at BundleTransformer.Core.Transformers.TransformerBase.Translate(IList`1 assets, Boolean isDebugMode)
   at BundleTransformer.Core.Transformers.TransformerBase.Transform(IList`1 assets, BundleContext bundleContext, BundleResponse bundleResponse, VirtualPathProvider virtualPathProvider, Boolean isDebugMode)
   at BundleTransformer.Core.Transformers.TransformerBase.Process(BundleContext bundleContext, BundleResponse bundleResponse, Boolean isDebugMode)
   at BundleTransformer.Core.Transformers.TransformerBase.Process(BundleContext bundleContext, BundleResponse bundleResponse)
   at System.Web.Optimization.Bundle.ApplyTransforms(BundleContext context, String bundleContent, IEnumerable`1 bundleFiles)
   at System.Web.Optimization.Bundle.GenerateBundleResponse(BundleContext context)
   at System.Web.Optimization.Bundle.GetBundleResponse(BundleContext context)
   at System.Web.Optimization.BundleResolver.GetBundleContents(String virtualPath)
   at System.Web.Optimization.AssetManager.EliminateDuplicatesAndResolveUrls(IEnumerable`1 refs)
   at System.Web.Optimization.AssetManager.DeterminePathsToRender(IEnumerable`1 assets)
   at System.Web.Optimization.AssetManager.RenderExplicit(String tagFormat, String[] paths)
   at System.Web.Optimization.Styles.RenderFormat(String tagFormat, String[] paths)
   at ASP._Page_Views_Shared__Layout_cshtml.Execute()
   at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
   at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
   at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
   at System.Web.WebPages.WebPageBase.<>c__DisplayClass40_0.<RenderPageCore>b__0(TextWriter writer)
   at System.Web.WebPages.HelperResult.WriteTo(TextWriter writer)
   at System.Web.WebPages.WebPageBase.Write(HelperResult result)
   at System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action`1 body)
   at System.Web.WebPages.WebPageBase.PopContext()
   at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
   at System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance)
   at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)
   at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass3_6.<BeginInvokeAction>b__3()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass3_1.<BeginInvokeAction>b__5(IAsyncResult asyncResult)

Taritsyn added a commit that referenced this issue Dec 20, 2018
…t named 'libsass_version' in DLL 'libsass'." on Azure Web App”
@Taritsyn
Copy link
Owner

Try to upgrade to version 1.2.2.

@RaceProUK
Copy link
Author

I've done the upgrade, and everything looks good so far. I'll keep an eye on it and report back in a week or so.

@Taritsyn
Copy link
Owner

OK.

@RaceProUK
Copy link
Author

Good news: I'm no longer seeing errors regarding libsass_version 🙂

Unfortunately, I'm seeing the error on a different function now:

Unable to find an entry point named 'sass_file_manager_get_is_initialized' in DLL 'libsass'. ---> System.EntryPointNotFoundException: Unable to find an entry point named 'sass_file_manager_get_is_initialized' in DLL 'libsass'.
   at LibSassHost.Internal.Native.Sass_Api.sass_file_manager_get_is_initialized()
   at LibSassHost.Internal.FileManagerMarshaler.UnsetFileManager()
   at LibSassHost.SassCompiler.InnerCompile(String content, Boolean indentedSyntax, String inputPath, String outputPath, String sourceMapPath, CompilationOptions options)
   at LibSassHost.SassCompiler.Compile(String content, String inputPath, String outputPath, String sourceMapPath, CompilationOptions options)
   at BundleTransformer.SassAndScss.Translators.SassAndScssTranslator.InnerTranslate(IAsset asset, CompilationOptions sassOptions, Boolean enableNativeMinification)
   --- End of inner exception stack trace ---
   at BundleTransformer.SassAndScss.Translators.SassAndScssTranslator.InnerTranslate(IAsset asset, CompilationOptions sassOptions, Boolean enableNativeMinification)
   at BundleTransformer.SassAndScss.Translators.SassAndScssTranslator.Translate(IList`1 assets)
   at BundleTransformer.Core.Transformers.TransformerBase.Translate(IList`1 assets, Boolean isDebugMode)
   at BundleTransformer.Core.Transformers.TransformerBase.Transform(IList`1 assets, BundleContext bundleContext, BundleResponse bundleResponse, VirtualPathProvider virtualPathProvider, Boolean isDebugMode)
   at BundleTransformer.Core.Transformers.TransformerBase.Process(BundleContext bundleContext, BundleResponse bundleResponse, Boolean isDebugMode)
   at BundleTransformer.Core.Transformers.TransformerBase.Process(BundleContext bundleContext, BundleResponse bundleResponse)
   at System.Web.Optimization.Bundle.ApplyTransforms(BundleContext context, String bundleContent, IEnumerable`1 bundleFiles)

The rest of the stack trace under ApplyTransforms is the same as before.

Thankfully, this new error appears to be far less common than the previous error I was seeing, and I suspect the fix will be essentially the same, hence posting it here instead of opening a new issue.

@Taritsyn
Copy link
Owner

Taritsyn commented Jan 2, 2019

Hello!

Apparently this is due to the fact, that in the process are periodically loaded the libsass.dll assembly is not designed to work with the LibSass Host library. You need to find this assembly and remove it.

Start by checking the bin directory. Then, check the web applications, that are running in the same process (application pool).

@RaceProUK
Copy link
Author

I'm using the libsass.dll supplied by the NuGet package designed to work with LibSassHost, so it should work. Nevertheless, I did a clean deployment, and the error went away, so I'm happy to consider this issue closed 🙂

@hmih
Copy link

hmih commented Jun 2, 2023

I'm hitting this error as well:

  Sass compile files
  Unhandled exception. System.EntryPointNotFoundException: Unable to find an entry point named 'sass_file_manager_get_is_initialized' in shared library 'libsass'.
     at LibSassHost.Internal.Native.Sass_Api.sass_file_manager_get_is_initialized()
     at LibSassHost.Internal.FileManagerMarshaler.UnsetFileManager()
     at LibSassHost.SassCompiler.CompileFile(String inputPath, String outputPath, String sourceMapPath, CompilationOptions options)
     at LibSassBuilder.Program.CompileFilesAsync(IEnumerable`1 sassFiles) in D:\a\LibSassBuilder\LibSassBuilder\src\LibSassBuilder\Program.cs:line 93
     at LibSassBuilder.Program.<>c.<<Main>b__0_2>d.MoveNext() in D:\a\LibSassBuilder\LibSassBuilder\src\LibSassBuilder\Program.cs:line 44

Any idea how to fix it?

@Taritsyn
Copy link
Owner

Taritsyn commented Jun 2, 2023

Hello, Hristo!

… Unable to find an entry point named 'sass_file_manager_get_is_initialized' in shared library 'libsass'.

It looks like you are using a native libsass assembly without the virtual file system support.

Remove the native libsass assembly and install one of the LibSassHost.Native.* packages. You can also build a native assembly yourself.

I also recommend that you consider switching to a more modern library - Dart Sass Host for .NET.

@hmih
Copy link

hmih commented Jun 2, 2023

Thanks for the quick response! I had used a library from my package manager (nix) and the build did not support this feature. I did a manual build, set the DYLD_LIBRARY_PATH to the library location and everything worked like a charm. Again, thanks for the support, I know this library is deprecated and it is an extra headache for you. 😄

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