danbarua / NEventSocket

A reactive FreeSwitch eventsocket library for Modern .Net
Mozilla Public License 2.0
74 stars 37 forks source link

TRACEOBJECTPOOLLEAKS_BEGIN log message? #33

Closed Eternal21 closed 8 years ago

Eternal21 commented 8 years ago

I'm slowly getting up to speed using the library. During some initial testing, I've come across the following error message, which happens to pop up quite often:

TRACEOBJECTPOOLLEAKS_BEGIN
Pool detected potential leaking of System.Text.StringBuilder.

Is it a known issue? I was basically hanging up a SIP call using the following socket message:

await _socket.Hangup(_callUuid);

The hangup worked, but I did get those potential leak warnings. Here's the complete log:

NLOG: EventSocket initialized
NLOG: NEventSocket.InboundSocket Worker Thread 1 started
NLOG: Messages Received [auth/request].
NLOG: Received Auth Request
NLOG: Sending [auth ClueCon]
NLOG: Messages Received [command/reply].
NLOG: CommandReply received [+OK accepted] for [auth ClueCon]
NLOG: InboundSocket authentication succeeded.
NLOG: Sending [api status]
NLOG: Messages Received [api/response].
NLOG: ApiResponse received [UP 0 years, 0 days, 4 hours, 30 minutes, 13 seconds, 314 milliseconds, 867 microsecondsFreeSWITCH (Version 1.7.0  64bit) is ready23 session(s) since startup2 session(s) - peak 4, last 5min 2 0 session(s) per Sec out of max 30, peak 2, last 5min 0 1000 session(s) maxmin idle cpu 0.00/96.26] for [status]
UP 0 years, 0 days, 4 hours, 30 minutes, 13 seconds, 314 milliseconds, 867 microseconds
FreeSWITCH (Version 1.7.0  64bit) is ready
23 session(s) since startup
2 session(s) - peak 4, last 5min 2 
0 session(s) per Sec out of max 30, peak 2, last 5min 0 
1000 session(s) max
min idle cpu 0.00/96.26

NLOG: Sending [event plain CHANNEL_ANSWER]
NLOG: Messages Received [command/reply].
NLOG: CommandReply received [+OK event listener enabled plain] for [event plain CHANNEL_ANSWER]
NLOG: Messages Received [text/event-plain].
Channel Answer Event 667c1091-c7fe-4657-83a7-9c82c2c6f490
NLOG: Messages Received [text/event-plain].
Channel Answer Event 44b1b7c2-ccb9-4d50-8955-f63a04cd39e1
NLOG: Sending [sendmsg 44b1b7c2-ccb9-4d50-8955-f63a04cd39e1
call-command: hangup
hangup-cause: NORMAL_CLEARING]
NLOG: Messages Received [command/reply].
NLOG: CommandReply received [+OK] for [sendmsg 44b1b7c2-ccb9-4d50-8955-f63a04cd39e1
call-command: hangup
hangup-cause: NORMAL_CLEARING]
TRACEOBJECTPOOLLEAKS_BEGIN
Pool detected potential leaking of System.Text.StringBuilder. 
 Location of the leak: 
    at NEventSocket.Util.ObjectPooling.ObjectPool`1.Allocate()
   at NEventSocket.Util.ObjectPooling.SharedPoolExtensions.AllocateAndClear(ObjectPool`1 pool)
   at NEventSocket.Util.ObjectPooling.StringBuilderPool.Allocate()
   at NEventSocket.Sockets.Parser..ctor()
   at NEventSocket.Sockets.EventSocket.<>c.<.ctor>b__7_1()
   at NEventSocket.Util.ObservableExtensions.<>c__DisplayClass0_1`2.<AggregateUntil>b__1(TSource value)
   at System.Reactive.AnonymousSafeObserver`1.OnNext(T value)
   at System.Reactive.Linq.ObservableImpl.SelectMany`2.NoSelectorImpl.OnNext(TSource value)
   at System.Reactive.Linq.ObservableImpl.Defer`1._.OnNext(TValue value)
   at System.Reactive.Linq.ObservableImpl.AsObservable`1._.OnNext(TSource value)
   at System.Reactive.Subjects.Subject`1.OnNext(T value)
   at NEventSocket.Sockets.ObservableSocket.<>c__DisplayClass10_0.<<-ctor>b__1>d.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.InvokeMoveNext(Object stateMachine)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run()
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(Action action, Boolean allowInlining, Task& currentTask)
   at System.Threading.Tasks.Task.FinishContinuations()
   at System.Threading.Tasks.Task.FinishStageThree()
   at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncTrimPromise`1.Complete(TInstance thisRef, Func`3 endMethod, IAsyncResult asyncResult, Boolean requiresSynchronization)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncTrimPromise`1.CompleteFromAsyncResult(IAsyncResult asyncResult)
   at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
   at System.Net.ContextAwareResult.CompleteCallback(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Net.ContextAwareResult.Complete(IntPtr userToken)
   at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
   at System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
   at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
 TRACEOBJECTPOOLLEAKS_END
TRACEOBJECTPOOLLEAKS_BEGIN
Pool detected potential leaking of System.Text.StringBuilder. 
 Location of the leak: 
    at NEventSocket.Util.ObjectPooling.ObjectPool`1.Allocate()
   at NEventSocket.Util.ObjectPooling.SharedPoolExtensions.AllocateAndClear(ObjectPool`1 pool)
   at NEventSocket.Util.ObjectPooling.StringBuilderPool.Allocate()
   at NEventSocket.Sockets.Parser..ctor()
   at NEventSocket.Sockets.EventSocket.<>c.<.ctor>b__7_1()
   at NEventSocket.Util.ObservableExtensions.<>c__DisplayClass0_1`2.<AggregateUntil>b__1(TSource value)
   at System.Reactive.AnonymousSafeObserver`1.OnNext(T value)
   at System.Reactive.Linq.ObservableImpl.SelectMany`2.NoSelectorImpl.OnNext(TSource value)
   at System.Reactive.Linq.ObservableImpl.Defer`1._.OnNext(TValue value)
   at System.Reactive.Linq.ObservableImpl.AsObservable`1._.OnNext(TSource value)
   at System.Reactive.Subjects.Subject`1.OnNext(T value)
   at NEventSocket.Sockets.ObservableSocket.<>c__DisplayClass10_0.<<-ctor>b__1>d.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.InvokeMoveNext(Object stateMachine)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run()
   at System.Threading.Tasks.AwaitTaskContinuation.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
 TRACEOBJECTPOOLLEAKS_END
TRACEOBJECTPOOLLEAKS_BEGIN
Pool detected potential leaking of System.Text.StringBuilder. 
 Location of the leak: 
    at NEventSocket.Util.ObjectPooling.ObjectPool`1.Allocate()
   at NEventSocket.Util.ObjectPooling.SharedPoolExtensions.AllocateAndClear(ObjectPool`1 pool)
   at NEventSocket.Util.ObjectPooling.StringBuilderPool.Allocate()
   at NEventSocket.Sockets.Parser..ctor()
   at NEventSocket.Sockets.EventSocket.<>c.<.ctor>b__7_1()
   at NEventSocket.Util.ObservableExtensions.<>c__DisplayClass0_1`2.<AggregateUntil>b__1(TSource value)
   at System.Reactive.AnonymousSafeObserver`1.OnNext(T value)
   at System.Reactive.Linq.ObservableImpl.SelectMany`2.NoSelectorImpl.OnNext(TSource value)
   at System.Reactive.Linq.ObservableImpl.Defer`1._.OnNext(TValue value)
   at System.Reactive.Linq.ObservableImpl.AsObservable`1._.OnNext(TSource value)
   at System.Reactive.Subjects.Subject`1.OnNext(T value)
   at NEventSocket.Sockets.ObservableSocket.<>c__DisplayClass10_0.<<-ctor>b__1>d.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.InvokeMoveNext(Object stateMachine)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run()
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(Action action, Boolean allowInlining, Task& currentTask)
   at System.Threading.Tasks.Task.FinishContinuations()
   at System.Threading.Tasks.Task.FinishStageThree()
   at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncTrimPromise`1.Complete(TInstance thisRef, Func`3 endMethod, IAsyncResult asyncResult, Boolean requiresSynchronization)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncTrimPromise`1.CompleteFromAsyncResult(IAsyncResult asyncResult)
   at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
   at System.Net.ContextAwareResult.CompleteCallback(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Net.ContextAwareResult.Complete(IntPtr userToken)
   at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
   at System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
   at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
 TRACEOBJECTPOOLLEAKS_END
The thread 0x1af0 has exited with code 0 (0x0).
NLOG: Messages Received [text/event-plain].
Channel Answer Event 32aad671-f9d3-447e-b705-4542bf2d85bb
NLOG: Messages Received [text/event-plain].
Channel Answer Event 9fb3b24a-acfa-4df5-9312-a6f2bbb77bfc
NLOG: Sending [sendmsg 9fb3b24a-acfa-4df5-9312-a6f2bbb77bfc
call-command: hangup
hangup-cause: NORMAL_CLEARING]
NLOG: Messages Received [command/reply].
NLOG: CommandReply received [+OK] for [sendmsg 9fb3b24a-acfa-4df5-9312-a6f2bbb77bfc
call-command: hangup
hangup-cause: NORMAL_CLEARING]
NLOG: Messages Received [text/event-plain].
NLOG: Messages Received [text/event-plain].
Channel Answer Event 3c2fa28a-1986-493e-94da-89b93b9f596d
Channel Answer Event f36f7863-bee6-4aa6-ae2f-cf3a4cb84c8c
NLOG: Sending [sendmsg f36f7863-bee6-4aa6-ae2f-cf3a4cb84c8c
call-command: hangup
hangup-cause: NORMAL_CLEARING]
NLOG: Messages Received [command/reply].
NLOG: CommandReply received [+OK] for [sendmsg f36f7863-bee6-4aa6-ae2f-cf3a4cb84c8c
call-command: hangup
hangup-cause: NORMAL_CLEARING]
The program '[12788] FsSockets.Gui.Wpf.vshost.exe' has exited with code -1 (0xffffffff).
danbarua commented 8 years ago

Yes, this only occurs when compiled in debug mode with specific flags - check the project properties page in Visual Studio to turn it off. You can ignore it in normal running, it's something we would look at if we were investigating memory leaks. It does have false positives.

danbarua commented 8 years ago

Imgur

Just get rid of those two first compiler flags. If we're pummelling it with load, and we see a lot of those then we might have an issue, usually you'll only see them very occasionally.

Eternal21 commented 8 years ago

Got it. Thanks.