anaisbetts / SassAndCoffee

SassAndCoffee adds support in ASP.NET MVC to (you guessed it!) Sass/SCSS and CoffeeScript
http://blog.paulbetts.org/index.php/2011/06/06/new-release-sassandcoffee-0-9-now-not-glacially-slow/
Microsoft Public License
199 stars 33 forks source link

IndexOutOfRangeException #51

Open sorenbs opened 12 years ago

sorenbs commented 12 years ago

We use the SassCompiler in our existing css combination and minification pipeline to compile scss files to css. Our integration looks like this:

using (var compiler = new SassCompiler())
    {
        return compiler.Compile(AppDomain.CurrentDomain.BaseDirectory + path, false, new List<string>());
    }

In production we get the following error several times a day, but i have not been able to reproduce it. I don't know much about IronRuby, but i suppose this is either a problem in IronRuby or the sass_in_one.rb file.

Any hints as to what i should investigate is much appreciated.

Time: 09.03.2012 09:42:44

URL: http://www.trustpilot.de/MinSources?s=/Styles/shared/standard.css;/Styles/domains/index.css&t=129736951656140000

Error: IndexOutOfRangeException: Index was outside the bounds of the array.

StackTrace: at Microsoft.Scripting.Interpreter.ThrowInstruction.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1) at IronRuby.Runtime.Calls.RubyObjectMethodDispatcherWithScope.Invoke[TScope](CallSite callSite, TScope scope, Object self) at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1) at Microsoft.Scripting.Interpreter.DynamicInstruction3.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1) at IronRuby.Runtime.Calls.RubyObjectMethodDispatcherWithScope.Invoke[TScope](CallSite callSite, TScope scope, Object self) at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1) at Microsoft.Scripting.Interpreter.DynamicInstruction3.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1) at IronRuby.Runtime.Calls.RubyObjectMethodDispatcherWithScope.Invoke[TScope](CallSite callSite, TScope scope, Object self) at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1) at Microsoft.Scripting.Interpreter.DynamicInstruction3.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3) at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2) at CallSite.Target(Closure , CallSite , Object , String , Object ) at SassAndCoffee.Ruby.Sass.SassCompiler.Compile(String path, Boolean compressed, IList1 dependentFileList) at Trustpilot.WebExtension.Compression.MinSources.CompileScss(String path) in d:\TeamcityAgent\work\Stormhawk\Lib\WebExtension\Compression\MinSources.cs:line 302 [...]

sorenbs commented 12 years ago

We ended up taking the on-the-fly compilation of scss files out of production and introduce an extra build step. We still use it in development.

During the last couple of weeks we have increased our use of scss files. This is the behavior we saw on our 3 production web servers:

They were all consistently taking up more cpu than they used to. From time to time a server would start taking up all or most cpu resources (8 cores). Stopping the website didn't help. IIS reset did. When continually requesting a non-cached copy of a scss file i sometimes received the above error (roughly 10% of the time). This error seems to be related to the cpu problem. I speculate that we in the beginning had so few scss files that most of the times none of the initial noncached requests would cause this error and subsequent requests would be served out of our http cache.

If i can provide any information about our setup to help you, i will be happy to.

kogir commented 12 years ago

Yeah, I've seen this too. I followed it down into IronRuby but that got a little hairy and I'm not sure I want to start maintaining my own fork. I'm also not sure how long it would take to learn enough about IronRuby to figure it out.

I'd recommend your current approach - pre-compiling for production for now.

extremeandy commented 12 years ago

We deployed on production also and began having the same issue. It's a shame 'cause this seemed like such a good solution...