sipsorcery-org / sipsorcery

A WebRTC, SIP and VoIP library for C# and .NET. Designed for real-time communications apps.
https://sipsorcery-org.github.io/sipsorcery
Other
1.43k stars 433 forks source link

Unhandled exception. System.AggregateException: One or more errors occurred. (Cannot access a disposed object. #903

Open anatoliy-d-plat4me opened 1 year ago

anatoliy-d-plat4me commented 1 year ago

Hello, We're using sipsorcery v6.0.11 on a Linux machine and .net 6.0

We have faced the following exception:

Unhandled exception. System.AggregateException: One or more errors occurred. (Cannot access a disposed object.
Object name: '[System.Net](http://system.net/).Sockets.Socket'.)
 ---> System.ObjectDisposedException: Cannot access a disposed object.
Object name: '[System.Net](http://system.net/).Sockets.Socket'.
   at [System.Net](http://system.net/).Sockets.Socket.ThrowObjectDisposedException()
   at [System.Net](http://system.net/).Sockets.Socket.GetSocketOption(SocketOptionLevel optionLevel, SocketOptionName optionName)
   at [System.Net](http://system.net/).Sockets.Socket.get_DualMode()
   at [SIPSorcery.Net](http://sipsorcery.net/).RtpIceChannel.GetHostCandidates()
   at [SIPSorcery.Net](http://sipsorcery.net/).RtpIceChannel.StartGathering()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__272_0(Object obj)
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at [SIPSorcery.Net](http://sipsorcery.net/).RTCPeerConnection.createBaseSdp(List`1 mediaStreamList, Boolean excludeIceCandidates)
   at [SIPSorcery.Net](http://sipsorcery.net/).RTCPeerConnection.createOffer(RTCOfferOptions options)
   at [SIPSorcery.Net](http://sipsorcery.net/).WebRTCWebSocketPeer.OnOpen()
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object state)
   at System.Threading.QueueUserWorkItemCallbackDefaultContext.Execute()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
   at System.Threading.Thread.StartCallback()

Maybe you will have opportunities to look at this issue.

Thanks

mmjc23 commented 2 months ago

Same error with library version 6.2.4 and .NET core 3.1

Immagine 2024-07-01 073548

Thank you