jetheredge/SquishIt — pull request #212 by SimonPStevens (2012-09-20 09:28:51+00:00)
Title: Processing multiple bundles on separate threads can cause imported less files to be located in the incorrect location.

If you try and squish two separate source less files that are located in different directories at the same time (on multiple threads, because they are coming via different iis requests), SquishIt currently changes the current directory for each which can cause a race with one file parsing incorrectly using the others current directory setting.

The test I've included fails (before the fix is implemented) every time on my quad core, but as it's based on a race condition it is possible it won't always fail, particularly on a single core machine.

This fix places a lock around any changes to the current directory so only one change can be in place at any time. This has potential to cause a performance issue as multiple requests will only be able to be processed sequentially, but as the css/less processing will be performed once and cached I think this is unlikely to be a problem.