miwarnec / DOTSNET

Public DOTSNET issue tracker
20 stars 0 forks source link

libuv disposed object error in chat example #27

Closed miwarnec closed 4 years ago

miwarnec commented 4 years ago

connect client, login with name, send message. disconnect client do it again see error:

      System.ObjectDisposedException: Cannot access a disposed object.
      Object name: 'NetUV.Core.Handles.HandleContext'.
        at NetUV.Core.Handles.StreamHandle.WriteStream (NetUV.Core.Requests.WriteRequest request) [0x0004d] in /Users/qwerty/x/dev/project_DOTSNET/RepositoryDOTS/Assets/DOTSNET/Scripts/ECS/Transport/Transports/libuv/sharp_uv/Handles/StreamHandle.cs:132
        at NetUV.Core.Handles.Pipeline.QueueWrite (System.ArraySegment`1[T] segment, System.Action`2[T1,T2] completion) [0x00019] in /Users/qwerty/x/dev/project_DOTSNET/RepositoryDOTS/Assets/DOTSNET/Scripts/ECS/Transport/Transports/libuv/sharp_uv/Handles/Pipeline.cs:98
      UnityEngine.Debug:LogError(Object)
      NetUV.Core.Logging.Log:Error(Object, Exception) (at Assets/DOTSNET/Scripts/ECS/Transport/Transports/libuv/sharp_uv/Logging/Log.cs:109)
      NetUV.Core.Handles.Pipeline:QueueWrite(ArraySegment`1, Action`2) (at Assets/DOTSNET/Scripts/ECS/Transport/Transports/libuv/sharp_uv/Handles/Pipeline.cs:102)
      NetUV.Core.Handles.StreamHandle:WriteStream(ArraySegment`1, Action`2) (at Assets/DOTSNET/Scripts/ECS/Transport/Transports/libuv/sharp_uv/Handles/StreamHandle.cs:110)
      DOTSNET.Libuv.LibuvTransportServerSystem:Send(Int32, ArraySegment`1, Channel) (at Assets/DOTSNET/Scripts/ECS/Transport/Transports/libuv/DOTSNET/LibuvTransportServerSystem.cs:84)
      DOTSNET.NetworkServerSystem:Send(Int32, ChatMessage, Channel) (at Assets/DOTSNET/Scripts/ECS/NetworkServer/NetworkServerSystem.cs:368)
      DOTSNET.Examples.Chat.ChatMessageServerSystem:OnMessage(Int32, ChatMessage) (at Assets/DOTSNET/Examples/Chat/Scripts/ChatMessage/ChatMessageServerSystemAuthoring.cs:34)
      DOTSNET.<>c__DisplayClass27_0`1:<WrapHandler>b__0(Int32, SegmentReader) (at Assets/DOTSNET/Scripts/ECS/NetworkServer/NetworkServerSystem.cs:745)
      DOTSNET.NetworkServerSystem:OnTransportData(Int32, ArraySegment`1) (at Assets/DOTSNET/Scripts/ECS/NetworkServer/NetworkServerSystem.cs:241)
      DOTSNET.Libuv.LibuvTransportServerSystem:OnLibuvData(StreamHandle, UnsafeReadBuffer) (at Assets/DOTSNET/Scripts/ECS/Transport/Transports/libuv/DOTSNET/LibuvTransportServerSystem.cs:195)
      NetUV.Core.Channels.StreamConsumer`1:Consume(StreamHandle, UnsafeReadBuffer, Exception, Boolean) (at Assets/DOTSNET/Scripts/ECS/Transport/Transports/libuv/sharp_uv/Channels/StreamConsumer.cs:41)
      NetUV.Core.Handles.Pipeline:InvokeRead(UnsafeReadBuffer, Int32, Exception, Boolean) (at Assets/DOTSNET/Scripts/ECS/Transport/Transports/libuv/sharp_uv/Handles/Pipeline.cs:79)
      NetUV.Core.Handles.Pipeline:OnReadCompleted(UnsafeReadBuffer, Int32) (at Assets/DOTSNET/Scripts/ECS/Transport/Transports/libuv/sharp_uv/Handles/Pipeline.cs:66)
      NetUV.Core.Handles.StreamHandle:OnReadCallback(UnsafeReadBuffer, Int32) (at Assets/DOTSNET/Scripts/ECS/Transport/Transports/libuv/sharp_uv/Handles/StreamHandle.cs:170)
      NetUV.Core.Handles.StreamHandle:OnReadCallback(IntPtr, IntPtr, uv_buf_t&) (at Assets/DOTSNET/Scripts/ECS/Transport/Transports/libuv/sharp_uv/Handles/StreamHandle.cs:193)
      NetUV.Core.Native.NativeMethods:uv_run(IntPtr, uv_run_mode)
      NetUV.Core.Native.NativeMethods:RunLoop(IntPtr, uv_run_mode) (at Assets/DOTSNET/Scripts/ECS/Transport/Transports/libuv/sharp_uv/Native/NativeLoop.cs:84)
      NetUV.Core.Handles.LoopContext:Run(uv_run_mode) (at Assets/DOTSNET/Scripts/ECS/Transport/Transports/libuv/sharp_uv/Handles/LoopContext.cs:80)
      NetUV.Core.Handles.Loop:RunNoWait() (at Assets/DOTSNET/Scripts/ECS/Transport/Transports/libuv/sharp_uv/Handles/Loop.cs:38)
      DOTSNET.Libuv.LibuvTransportServerSystem:OnUpdate() (at Assets/DOTSNET/Scripts/ECS/Transport/Transports/libuv/DOTSNET/LibuvTransportServerSystem.cs:272)
      Unity.Entities.SystemBase:Update() (at Library/PackageCache/com.unity.entities@0.13.0-preview.24/Unity.Entities/SystemBase.cs:398)
      Unity.Entities.ComponentSystemGroup:UpdateAllSystems() (at Library/PackageCache/com.unity.entities@0.13.0-preview.24/Unity.Entities/ComponentSystemGroup.cs:502)
      Unity.Entities.ComponentSystemGroup:OnUpdate() (at Library/PackageCache/com.unity.entities@0.13.0-preview.24/Unity.Entities/ComponentSystemGroup.cs:455)
      Unity.Entities.ComponentSystem:Update() (at Library/PackageCache/com.unity.entities@0.13.0-preview.24/Unity.Entities/ComponentSystem.cs:109)
      Unity.Entities.ComponentSystemGroup:UpdateAllSystems() (at Library/PackageCache/com.unity.entities@0.13.0-preview.24/Unity.Entities/ComponentSystemGroup.cs:502)
      Unity.Entities.ComponentSystemGroup:OnUpdate() (at Library/PackageCache/com.unity.entities@0.13.0-preview.24/Unity.Entities/ComponentSystemGroup.cs:455)
      Unity.Entities.ComponentSystem:Update() (at Library/PackageCache/com.unity.entities@0.13.0-preview.24/Unity.Entities/ComponentSystem.cs:109)
      Unity.Entities.ComponentSystemGroup:UpdateAllSystems() (at Library/PackageCache/com.unity.entities@0.13.0-preview.24/Unity.Entities/ComponentSystemGroup.cs:502)
      Unity.Entities.ComponentSystemGroup:OnUpdate() (at Library/PackageCache/com.unity.entities@0.13.0-preview.24/Unity.Entities/ComponentSystemGroup.cs:455)
      Unity.Entities.ComponentSystem:Update() (at Library/PackageCache/com.unity.entities@0.13.0-preview.24/Unity.Entities/ComponentSystem.cs:109)
      Unity.Entities.DummyDelegateWrapper:TriggerUpdate() (at Library/PackageCache/com.unity.entities@0.13.0-preview.24/Unity.Entities/ScriptBehaviourUpdateOrder.cs:322)
miwarnec commented 4 years ago

for future reference: in chat example:

neither servertransport nor clienttransport OnLibuvClosed are ever called, which is why the old connection is still in there for next connect.

miwarnec commented 4 years ago

fixed in V1.18 with sharp_uv V0.7