从二级缓存加载类型不匹配

时间:2011-09-09 14:02:20

标签: nhibernate memcached second-level-cache

我有一个在asp.net + nhibernate中运行的集群式web应用程序,它依赖于MemcacheD作为其二级缓存提供程序。一切运行好几个月,今天一些查询开始在从缓存L2加载实体时出现类型不匹配错误。重新启动缓存似乎解决了问题,但几分钟后错误返回。现在缓存已被禁用,一切正常。

任何线索都表示赞赏。

堆栈跟踪:

System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. 
---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. 
---> NHibernate.TypeMismatchException: Provided id of the wrong type. Expected: System.Int32, got System.Int64 
at NHibernate.Event.Default.DefaultLoadEventListener.OnLoad(LoadEvent event, LoadType loadType) 
at NHibernate.Impl.SessionImpl.FireLoad(LoadEvent event, LoadType loadType) 
at NHibernate.Impl.SessionImpl.InternalLoad(String entityName, Object id, Boolean eager, Boolean isNullable) 
at NHibernate.Type.EntityType.ResolveIdentifier(Object id, ISessionImplementor session) 
at NHibernate.Type.TypeFactory.Assemble(Object[] row, ICacheAssembler[] types, ISessionImplementor session, Object owner) 
at NHibernate.Cache.Entry.CacheEntry.Assemble(Object[] values, Object result, Object id, IEntityPersister persister, IInterceptor interceptor, ISessionImplementor session) 
at NHibernate.Event.Default.DefaultLoadEventListener.AssembleCacheEntry(CacheEntry entry, Object id, IEntityPersister persister, LoadEvent event) 
at NHibernate.Event.Default.DefaultLoadEventListener.LoadFromSecondLevelCache(LoadEvent event, IEntityPersister persister, LoadType options) 
at NHibernate.Event.Default.DefaultLoadEventListener.DoLoad(LoadEvent event, IEntityPersister persister, EntityKey keyToLoad, LoadType options) 
at NHibernate.Event.Default.DefaultLoadEventListener.Load(LoadEvent event, IEntityPersister persister, EntityKey keyToLoad, LoadType options) 
at NHibernate.Event.Default.DefaultLoadEventListener.OnLoad(LoadEvent event, LoadType loadType) 
at NHibernate.Impl.SessionImpl.FireLoad(LoadEvent event, LoadType loadType) 
at NHibernate.Impl.SessionImpl.InternalLoad(String entityName, Object id, Boolean eager, Boolean isNullable) 
at NHibernate.Type.EntityType.ResolveIdentifier(Object id, ISessionImplementor session) 
at NHibernate.Engine.TwoPhaseLoad.InitializeEntity(Object entity, Boolean readOnly, ISessionImplementor session, PreLoadEvent preLoadEvent, PostLoadEvent postLoadEvent) 
at NHibernate.Loader.Loader.InitializeEntitiesAndCollections(IList hydratedObjects, Object resultSetId, ISessionImplementor session, Boolean readOnly) 
at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) 
at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) 
at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters) 
at NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet`1 querySpaces, IType[] resultTypes) 
at NHibernate.Impl.SessionImpl.ListCustomQuery(ICustomQuery customQuery, QueryParameters queryParameters, IList results) 
at NHibernate.Impl.SessionImpl.List(NativeSQLQuerySpecification spec, QueryParameters queryParameters, IList results) 
at NHibernate.Impl.SessionImpl.List[T](NativeSQLQuerySpecification spec, QueryParameters queryParameters) 
at NHibernate.Impl.SqlQueryImpl.List[T]() at Punchclock.DAL.NHibernate.UserDAO.GetUserList(QueryUser pQueryUser, Nullable`1 pTop) 
at Punchclock.Biz.UserBiz.GetUserList(QueryUser queryUser, Nullable`1 pTop) at Punchclock.Biz.UserBiz.GetUserList(QueryUser queryUser, Int32 pTop) 
at Punchclock.Net.Service.UserService.GetUserList(QueryUser queryUser, Int32 pTop) 
--- End of inner exception stack trace --- 
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) 
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) 
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) 
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) at Punchclock.Net.Service.ServiceProxy`1.Invoke(IMessage msg) 
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) 
at Punchclock.Core.Service.IUserService.GetUserList(QueryUser queryUser, Int32 pTop) 
at Punchclock.Net.Delegate.UserDelegate.GetUserList(QueryUser queryUser, Int32 pTop) 
at Punchclock.Client.Controller.UcUserQueryController.GetUserList(QueryUser queryUser, Int32 pTop) 
at Punchclock.Client.Web.Record.UserControls.UcUserQuery.MakeQuery(Int32 maxResults)
at Punchclock.Client.Web.UserControls.UcQueryBase.OnQueryButtonClick(Object o, QueryEventArgs e) 
at Punchclock.Client.Web.Record.UserControls.UcUserQuery.btnQuery_Click(Object sender, EventArgs e) 
at System.Web.UI.WebControls.Button.OnClick(EventArgs e) at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) 
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) 
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 
--- End of inner exception stack trace --- 
at System.Web.UI.Page.HandleError(Exception e) 
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 
at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequest(HttpContext context) 
at ASP.forms_query_aspx.ProcessRequest(HttpContext context) 
in c:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\punchclock_rc1\c4ca2e53\49a32ae2\App_Web_hfudjjsj.2.cs:line 0 
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() 
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

0 个答案:

没有答案