|
Dear all,
Today i have following problem and can not resolve it, everyone know and can give me a way to correct it?
2008-07-31 15:55:27,531 [11] ERROR Finance.Core.BLL.FinanceDAO [(null)] <(null)> - NHibernate.ADOException: could not initialize a collection: [Finance.Core.Domain.Industry.CompanyList#151][SQL: SELECT companylis0_.IndustryID as IndustryID__3_, companylis0_.CompanyID as CompanyID3_, company1_.ID as ID28_0_, company1_.StockExID as StockExID28_0_, company1_.IndustryID as IndustryID28_0_, company1_.Name as Name28_0_, company1_.InternationalName as Internat5_28_0_, company1_.ShortName as ShortName28_0_, company1_.Symbol as Symbol28_0_, company1_.Address as Address28_0_, company1_.Phone as Phone28_0_, company1_.Fax as Fax28_0_, company1_.Website as Website28_0_, company1_.Description as Descrip12_28_0_, company1_.CompanyIndex as Company13_28_0_, company1_.JoinDate as JoinDate28_0_, company1_.Enable as Enable28_0_, industry2_.ID as ID39_1_, industry2_.SectorID as SectorID39_1_, industry2_.Name as Name39_1_, industry2_.Description as Descript4_39_1_, industry2_.IndustryIndex as Industry5_39_1_, industry2_.Lang as Lang39_1_, industry2_.IsIndustryGroup as IsIndust7_39_1_, sector3_.ID as ID2_2_, sector3_.Name as Name2_2_, sector3_.Description as Descript3_2_2_, sector3_.SectorIndex as SectorIn4_2_2_, sector3_.Lang as Lang2_2_, sector3_.IsSectorGroup as IsSector6_2_2_ FROM CompanyIndustryMapping companylis0_ left outer join Company company1_ on companylis0_.CompanyID=company1_.ID left outer join Industry industry2_ on company1_.IndustryID=industry2_.ID left outer join Sector sector3_ on industry2_.SectorID=sector3_.ID WHERE companylis0_.IndustryID=?] ---> System.IndexOutOfRangeException: Probable I/O race condition detected while copying memory. The I/O package is not thread safe by default. In multithreaded applications, a stream must be accessed in a thread-safe way, such as a thread-safe wrapper returned by TextReader's or TextWriter's Synchronized methods. This also applies to classes like StreamWriter and StreamReader.
at System.Buffer.InternalBlockCopy(Array src, Int32 srcOffset, Array dst, Int32 dstOffset, Int32 count)
at System.IO.StreamWriter.Write(Char[] buffer, Int32 index, Int32 count)
at System.IO.TextWriter.WriteLine(String value)
at System.IO.TextWriter.SyncTextWriter.WriteLine(String value)
at NHibernate.Impl.BatcherImpl.LogCommand(IDbCommand command)
at NHibernate.Impl.BatcherImpl.Prepare(IDbCommand cmd)
at NHibernate.Impl.BatcherImpl.ExecuteReader(IDbCommand cmd)
at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, RowSelection selection, ISessionImplementor session)
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.LoadCollection(ISessionImplementor session, Object id, IType type)
--- End of inner exception stack trace ---
at NHibernate.Loader.Loader.LoadCollection(ISessionImplementor session, Object id, IType type)
at NHibernate.Loader.Collection.CollectionLoader.Initialize(Object id, ISessionImplementor session)
at NHibernate.Persister.Collection.AbstractCollectionPersister.Initialize(Object key, ISessionImplementor session)
at NHibernate.Impl.SessionImpl.InitializeCollection(IPersistentCollection collection, Boolean writing)
at NHibernate.Collection.AbstractPersistentCollection.ForceInitialization()
at NHibernate.Impl.SessionImpl.InitializeNonLazyCollections()
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 querySpaces, IType[] resultTypes)
at NHibernate.Impl.SessionImpl.Find(CriteriaImpl criteria, IList results)
at NHibernate.Impl.SessionImpl.Find(CriteriaImpl criteria)
at NHibernate.Impl.CriteriaImpl.List()
at Finance.Core.BLL.FinanceDAO.GetAllCompany()
After this error happens, every new request to this site will be error. After I restart www, website run normally and a few days later, the error still be found!
I check the function where error happens, I think no error will never appear because it's a very simple statement like that:
try
{
ICriteria crt = _session.CreateCriteria(typeof(CompanyNotify));
return crt.List();
}
catch (Exception ex)
{
logger.Error(ex);
return null;
}
|