We're updating the issue view to help you get more done. 

Found the unexpected error Probable I/O race condition detected while copying memory

Description

I'm using NH 4.1.0. I'm unable to reproduce the error: it seems to happen randomly, having show_sql set to true I get an exception that deadlock the application:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 2017-08-25 18:48:29,034 [ERROR] [AdvancedTransport] Mfs.Business.Transportation.BaseOrder - FilterMovementsByDestinationFunctionalArea: found the unexpected error 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. NHibernate.Exceptions.GenericADOException: could not initialize a collection: [Mfs.Domain.TransportManager.TransportUnit.TransportUnitProperties#100100006479][SQL: SELECT transportu0_."FK_TRANSPORT_UNIT" as FK3_1_, transportu0_."PK_ID" as PK1_1_, transportu0_."PK_ID" as PK1_36_0_, transportu0_.Version as Version36_0_, transportu0_."FK_TRANSPORT_UNIT" as FK3_36_0_, transportu0_."PROPERTY_KEY" as PROPERTY4_36_0_, transportu0_."PROPERTY_VALUE" as PROPERTY5_36_0_, transportu0_."PROPERTY_NOTIFIED" as PROPERTY6_36_0_, transportu0_."PROPERTY_REQUIRED" as PROPERTY7_36_0_, transportu0_."PROPERTY_SUCCESS" as PROPERTY8_36_0_ FROM "MFS$TRANSPORT_UNIT_PROPERTY" transportu0_ WHERE transportu0_."FK_TRANSPORT_UNIT"=?] ---> 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 srcOffsetBytes, Array dst, Int32 dstOffsetBytes, Int32 byteCount) at System.IO.StreamWriter.Write(Char[] buffer, Int32 index, Int32 count) at System.IO.TextWriter.SyncTextWriter.WriteLine(String value) at NHibernate.AdoNet.Util.SqlStatementLogger.LogCommand(String message, IDbCommand command, FormatStyle style) at NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd) at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, Boolean autoDiscoverTypes, Boolean callable, RowSelection selection, ISessionImplementor session) at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies, IResultTransformer forcedResultTransformer) at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies, IResultTransformer forcedResultTransformer) 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.Event.Default.DefaultInitializeCollectionEventListener.OnInitializeCollection(InitializeCollectionEvent event) at NHibernate.Impl.SessionImpl.InitializeCollection(IPersistentCollection collection, Boolean writing) at NHibernate.Collection.AbstractPersistentCollection.ForceInitialization() at NHibernate.Engine.StatefulPersistenceContext.InitializeNonLazyCollections() at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies, IResultTransformer forcedResultTransformer) at NHibernate.Loader.Loader.LoadEntity(ISessionImplementor session, Object id, IType identifierType, Object optionalObject, String optionalEntityName, Object optionalIdentifier, IEntityPersister persister) at NHibernate.Loader.Entity.AbstractEntityLoader.Load(ISessionImplementor session, Object id, Object optionalObject, Object optionalId) at NHibernate.Loader.Entity.AbstractEntityLoader.Load(Object id, Object optionalObject, ISessionImplementor session) at NHibernate.Event.Default.DefaultLoadEventListener.LoadFromDatasource(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.ImmediateLoad(String entityName, Object id) at NHibernate.Proxy.AbstractLazyInitializer.Initialize() at NHibernate.Proxy.DefaultLazyInitializer.Intercept(InvocationInfo info) at TransportUnitProxy.get_PhysicalId()

Environment

Windows Server 2012 R2

Status

Assignee

Unassigned

Reporter

Marcos Manuel Saez

Labels