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

Rewrite of the mutex-based serialization code #129

Merged
merged 1 commit into from Dec 20, 2011
Merged

Rewrite of the mutex-based serialization code #129

merged 1 commit into from Dec 20, 2011

Conversation

cjberg
Copy link
Contributor

@cjberg cjberg commented Dec 20, 2011

I rewrote the mutex-based serialization code so that a mutex is created for each rendered path, which at least theoretically avoids a bottleneck. It should now also be fully thread-safe.

To avoid opening many handles to the mutexes, I used a simple singleton pattern for the implementation class. It can still be replaced for an instance of BundleBase, in case a test requires it.

… each rendered path, and the code is thread-safe.
jetheredge added a commit that referenced this pull request Dec 20, 2011
Rewrite of the mutex-based serialization code
@jetheredge jetheredge merged commit 9d0dd6f into jetheredge:master Dec 20, 2011
@jetheredge
Copy link
Owner

We are getting some errors reporting from this code. It looks like an exception is being raised when AddAccessRule is being called and a MutexAccessRule with the "Everyone" group is being passed. I'm wondering if this blows up on certain versions or configurations of Windows.

Any idea what the implications of using a Mutex without adding access rules? What is a Mutex's default visibility?

It throws the following exception:
System.Security.Principal.IdentityNotMappedException: Some or all identity references could not be translated

Here is the stacktrace:
at System.Security.Principal.NTAccount.Translate(IdentityReferenceCollection sourceAccounts, Type targetType, Boolean forceSuccess)
at System.Security.Principal.NTAccount.Translate(Type targetType)
at System.Security.AccessControl.CommonObjectSecurity.ModifyAccess(AccessControlModification modification, AccessRule rule, Boolean& modified)
at System.Security.AccessControl.CommonObjectSecurity.AddAccessRule(AccessRule rule)
at System.Security.AccessControl.MutexSecurity.AddAccessRule(MutexAccessRule rule)
at SquishIt.Framework.Utilities.FilePathMutexProvider.CreateSharableMutex(String name)
at SquishIt.Framework.Utilities.FilePathMutexProvider.CreateSharableMutexForPath(String normalizedPath)
at SquishIt.Framework.Utilities.FilePathMutexProvider.GetMutexForPath(String path)
at SquishIt.Framework.Base.BundleBase1.RenderRelease(String key, String renderTo, IRenderer renderer) at SquishIt.Framework.Base.BundleBase1.Render(String renderTo, String key, IRenderer renderer)
at SquishIt.Framework.Base.BundleBase1.Render(String renderTo) at SquishIt.Mvc.JavaScriptBundleExtensions.MvcRender(JavaScriptBundle javaScriptBundle, String renderTo) at ASP._Page_Views_Shared__Layout_cshtml.Execute() at d:\WORK\Research\2012\H5BP+TwBootstrap\my06\H5BP_TwBootstrap\H5BP_TwBootstrap\Views\Shared\_Layout.cshtml:line 112 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__DisplayClass7.<RenderPageCore>b__6(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, Action1 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.<>c__DisplayClass1c.b__19()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)

@cjberg
Copy link
Contributor Author

cjberg commented Jan 20, 2012

I think I know what it is. In non-English editions of Windows, "Everyone" is written in the default locale's language, so we cannot use the presentation name for a "well-known SID". I'll create a fix and send a new pull request soon (later today).

@jetheredge
Copy link
Owner

Good call! Thanks for looking at it.

On Jan 20, 2012, at 11:49 AM, C-J Bergreply@reply.github.com wrote:

I think I know what it is. In non-English editions of Windows, "Everyone" is written in the default locale's language, so we cannot use the presentation name for a "well-known SID". I'll create a fix and send a new pull request soon (later today).


Reply to this email directly or view it on GitHub:
#129 (comment)

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

Successfully merging this pull request may close these issues.

None yet

2 participants