10

Resolved

With SysCache module enabled deleting a query sort criterion throws exception

description

As discussed here: http://orchard.codeplex.com/discussions/402069

If you have SysCache module on, create a query, add a sort criterion, then delete the sort criterion you get the following exception:

An unhandled exception has occurred and the request was terminated. Please refresh the page. If the error persists, go back

No row with the given identifier exists[Orchard.Projections.Models.SortCriterionRecord#3]

NHibernate.ObjectNotFoundException: No row with the given identifier exists[Orchard.Projections.Models.SortCriterionRecord#3] em NHibernate.Impl.SessionFactoryImpl.DefaultEntityNotFoundDelegate.HandleEntityNotFound(String entityName, Object id) em NHibernate.Event.Default.DefaultLoadEventListener.Load(LoadEvent event, IEntityPersister persister, EntityKey keyToLoad, LoadType options) em Orchard.Data.Providers.AbstractDataServicesProvider.OrchardLoadEventListener.OnLoad(LoadEvent event, LoadType loadType) em NHibernate.Impl.SessionImpl.FireLoad(LoadEvent event, LoadType loadType) em NHibernate.Impl.SessionImpl.InternalLoad(String entityName, Object id, Boolean eager, Boolean isNullable) em NHibernate.Type.EntityType.ResolveIdentifier(Object id, ISessionImplementor session) em NHibernate.Collection.PersistentBag.InitializeFromCache(ICollectionPersister persister, Object disassembled, Object owner) em NHibernate.Cache.Entry.CollectionCacheEntry.Assemble(IPersistentCollection collection, ICollectionPersister persister, Object owner) em NHibernate.Event.Default.DefaultInitializeCollectionEventListener.InitializeCollectionFromCache(Object id, ICollectionPersister persister, IPersistentCollection collection, ISessionImplementor source) em NHibernate.Event.Default.DefaultInitializeCollectionEventListener.OnInitializeCollection(InitializeCollectionEvent event) em NHibernate.Impl.SessionImpl.InitializeCollection(IPersistentCollection collection, Boolean writing) em NHibernate.Collection.AbstractPersistentCollection.ReadSize() em NHibernate.Collection.PersistentBag.get_Count() em System.Linq.Buffer1..ctor(IEnumerable1 source) em System.Linq.OrderedEnumerable1.<GetEnumerator>d__0.MoveNext() em Orchard.Projections.Controllers.AdminController.Edit(Int32 id) em lambda_method(Closure , ControllerBase , Object[] ) em System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters) em System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters) em System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass13.<InvokeActionMethodWithFilters>b__10() em System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func1 continuation) em System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func1 continuation) em System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func1 continuation)

comments

pnmcosta wrote Nov 6, 2012 at 2:13 PM

resetting worker process temporarily fixes the issue

pnmcosta wrote Nov 6, 2012 at 2:26 PM

it's using the IRepository directly to delete the criterion so it's got to be a loading issue, also because the error occurs in /Admin/Projector/Edit/XX

pnmcosta wrote Nov 6, 2012 at 2:36 PM

ok exceptions happens after deleting the sortcriterion and then using the SortCriteria property of the QueryPartRecord in the AdminController Edit action.

the same does not happen when deleting a layout, so the only difference between the delete action of a sortcriterion and layout is that on the SortCriterionController Delete action we are not using the QueryPartRecord of the SortCriterionRecord to get the query id for the redirect.

could this be related? am a bit out of my depth on this NHibernate dependencies and stuff :) any help would be greatly appreciated.

pnmcosta wrote Nov 6, 2012 at 2:45 PM

somehow QueryPartRecord.SortCriteria is not getting updated/invalidated when a SortCriterionRecord is deleted, that's as far as I could get....

pnmcosta wrote Nov 6, 2012 at 2:46 PM

... when using SysCache Module!

x0r wrote Jan 21, 2013 at 1:07 PM

same here. when SysCache is disabled, no issues

mjy78 wrote Feb 7, 2013 at 9:52 PM

Note. This exception also occurs if you delete a Filter from your query. Restarting the worker process fixes the issue similarly to Sort Criteria.

mjy78 wrote Feb 7, 2013 at 9:53 PM

Note. This problem also occurs when deleting a Filter from your query. Restarting IIS resolves the issue in this case too.

mjy78 wrote Feb 7, 2013 at 9:58 PM

Note. This problem also occurs when deleting a Filter from your query. Restarting IIS resolves the issue in this case too.

sebastienros wrote May 21, 2013 at 12:46 AM

Fixed in changeset a8f8b3c1c6f5

sfmskywalker wrote Mar 28 at 1:28 AM

Fixed in changeset 09a72974499aba14d55ea434d477b53e3671997c