These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Help me with error: could not initialize a collection
PostPosted: Thu Aug 14, 2008 5:24 am 
Newbie

Joined: Thu Aug 14, 2008 4:55 am
Posts: 2
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;
}


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 14, 2008 6:16 am 
Newbie

Joined: Thu Aug 14, 2008 4:55 am
Posts: 2
And here is other error found, you can have more detail of what was happen!


2008-08-14 18:40:28,421 [1] ERROR NHibernate.Util.ADOExceptionReporter [(null)] <(null)> - 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.
2008-08-14 18:40:28,500 [10] ERROR NHibernate.Util.ADOExceptionReporter [(null)] <(null)> - Count cannot be less than zero.
Parameter name: count
2008-08-14 18:40:28,500 [5] ERROR NHibernate.Util.ADOExceptionReporter [(null)] <(null)> - Count cannot be less than zero.
Parameter name: count
2008-08-14 18:40:28,500 [8] ERROR NHibernate.Util.ADOExceptionReporter [(null)] <(null)> - Count cannot be less than zero.
Parameter name: count
2008-08-14 18:40:28,500 [19] ERROR NHibernate.Util.ADOExceptionReporter [(null)] <(null)> - Count cannot be less than zero.
Parameter name: count
2008-08-14 18:40:28,500 [15] ERROR NHibernate.Util.ADOExceptionReporter [(null)] <(null)> - Count cannot be less than zero.
Parameter name: count
2008-08-14 18:40:28,546 [16] ERROR NHibernate.Util.ADOExceptionReporter [(null)] <(null)> - Count cannot be less than zero.
Parameter name: count
2008-08-14 18:40:28,640 [20] ERROR NHibernate.Util.ADOExceptionReporter [(null)] <(null)> - Count cannot be less than zero.
Parameter name: count
2008-08-14 18:40:28,843 [13] ERROR NHibernate.Util.ADOExceptionReporter [(null)] <(null)> - Count cannot be less than zero.
Parameter name: count



2008-08-14 17:06:33,640 [1] ERROR NHibernate.LazyInitializationException [(null)] <(null)> - Failed to lazily initialize a collection
NHibernate.LazyInitializationException: Failed to lazily initialize a collection ---> NHibernate.ADOException: could not initialize a collection: [Finance.Core.Domain.Company.CompanyInfos#505][SQL: SELECT companyinf0_.CompanyID as CompanyID__1_, companyinf0_.ID as ID1_, companyinf0_.ID as ID9_0_, companyinf0_.CompanyID as CompanyID9_0_, companyinf0_.History as History9_0_, companyinf0_.Region as Region9_0_, companyinf0_.Rank as Rank9_0_, companyinf0_.Strategy as Strategy9_0_, companyinf0_.Lang as Lang9_0_ FROM CompanyInfo companyinf0_ WHERE companyinf0_.CompanyID=?] ---> 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.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.Initialize(Boolean writing)
--- End of inner exception stack trace ---


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.