markmcdowell / NLog.Targets.ElasticSearch

NLog target for Elasticsearch
MIT License
176 stars 89 forks source link

StackOverflowException logging an object #102

Closed ribbles closed 4 years ago

ribbles commented 5 years ago

The object logged has a cyclic reference (EF6 entity). Other loggers have a "maxDepth" or similar. nlog.targets.elasticsearch: 7.0.0-alpha elasticsearch.net: 7.0.0-alpha2 nlog: 4.6.4 .NET framework 4.6.2

Elasticsearch.Net.SimpleJson.SerializeArray(Elasticsearch.Net.IJsonSerializerStrategy, System.Collections.IEnumerable, System.Text.StringBuilder)+a4 Elasticsearch.Net.SimpleJson.SerializeValue(Elasticsearch.Net.IJsonSerializerStrategy, System.Object, System.Text.StringBuilder)+129 Elasticsearch.Net.SimpleJson.SerializeObject(Elasticsearch.Net.IJsonSerializerStrategy, System.Collections.IEnumerable, System.Collections.IEnumerable, System.Text.StringBuilder)+110 Elasticsearch.Net.SimpleJson.SerializeValue(Elasticsearch.Net.IJsonSerializerStrategy, System.Object, System.Text.StringBuilder)+a0 Elasticsearch.Net.SimpleJson.SerializeValue(Elasticsearch.Net.IJsonSerializerStrategy, System.Object, System.Text.StringBuilder)+212 Elasticsearch.Net.SimpleJson.SerializeArray(Elasticsearch.Net.IJsonSerializerStrategy, System.Collections.IEnumerable, System.Text.StringBuilder)+a4 Elasticsearch.Net.SimpleJson.SerializeValue(Elasticsearch.Net.IJsonSerializerStrategy, System.Object, System.Text.StringBuilder)+129 Elasticsearch.Net.SimpleJson.SerializeObject(Elasticsearch.Net.IJsonSerializerStrategy, System.Collections.IEnumerable, System.Collections.IEnumerable, System.Text.StringBuilder)+110 Elasticsearch.Net.SimpleJson.SerializeValue(Elasticsearch.Net.IJsonSerializerStrategy, System.Object, System.Text.StringBuilder)+a0 Elasticsearch.Net.SimpleJson.SerializeValue(Elasticsearch.Net.IJsonSerializerStrategy, System.Object, System.Text.StringBuilder)+212 Elasticsearch.Net.SimpleJson.SerializeArray(Elasticsearch.Net.IJsonSerializerStrategy, System.Collections.IEnumerable, System.Text.StringBuilder)+a4 Elasticsearch.Net.SimpleJson.SerializeValue(Elasticsearch.Net.IJsonSerializerStrategy, System.Object, System.Text.StringBuilder)+129 Elasticsearch.Net.SimpleJson.SerializeObject(Elasticsearch.Net.IJsonSerializerStrategy, System.Collections.IEnumerable, System.Collections.IEnumerable, System.Text.StringBuilder)+110 Elasticsearch.Net.SimpleJson.SerializeValue(Elasticsearch.Net.IJsonSerializerStrategy, System.Object, System.Text.StringBuilder)+a0 Elasticsearch.Net.SimpleJson.SerializeValue(Elasticsearch.Net.IJsonSerializerStrategy, System.Object, System.Text.StringBuilder)+212 Elasticsearch.Net.SimpleJson.SerializeObject(Elasticsearch.Net.IJsonSerializerStrategy, System.Collections.IEnumerable, System.Collections.IEnumerable, System.Text.StringBuilder)+110 Elasticsearch.Net.SimpleJson.SerializeValue(Elasticsearch.Net.IJsonSerializerStrategy, System.Object, System.Text.StringBuilder)+a0 Elasticsearch.Net.SimpleJson.SerializeValue(Elasticsearch.Net.IJsonSerializerStrategy, System.Object, System.Text.StringBuilder)+212 Elasticsearch.Net.SimpleJson.SerializeArray(Elasticsearch.Net.IJsonSerializerStrategy, System.Collections.IEnumerable, System.Text.StringBuilder)+a4 Elasticsearch.Net.SimpleJson.SerializeValue(Elasticsearch.Net.IJsonSerializerStrategy, System.Object, System.Text.StringBuilder)+129 Elasticsearch.Net.SimpleJson.SerializeObject(Elasticsearch.Net.IJsonSerializerStrategy, System.Collections.IEnumerable, System.Collections.IEnumerable, System.Text.StringBuilder)+110 Elasticsearch.Net.SimpleJson.SerializeValue(Elasticsearch.Net.IJsonSerializerStrategy, System.Object, System.Text.StringBuilder)+a0 Elasticsearch.Net.SimpleJson.SerializeValue(Elasticsearch.Net.IJsonSerializerStrategy, System.Object, System.Text.StringBuilder)+212 Elasticsearch.Net.SimpleJson.SerializeObject(Elasticsearch.Net.IJsonSerializerStrategy, System.Collections.IEnumerable, System.Collections.IEnumerable, System.Text.StringBuilder)+110 Elasticsearch.Net.SimpleJson.SerializeValue(Elasticsearch.Net.IJsonSerializerStrategy, System.Object, System.Text.StringBuilder)+a0 Elasticsearch.Net.SimpleJson.SerializeObject(System.Object, Elasticsearch.Net.IJsonSerializerStrategy) Elasticsearch.Net.LowLevelRequestResponseSerializer.Serialize[[System.__Canon, mscorlib]](System.__Canon, System.IO.Stream, Elasticsearch.Net.SerializationFormatting) clr!InstantiatingMethodStubWorker+bc Elasticsearch.Net.PostData``1[[System.__Canon, mscorlib]].Write(System.IO.Stream, Elasticsearch.Net.IConnectionConfigurationValues) Elasticsearch.Net.HttpWebRequestConnection.Request[[System.__Canon, mscorlib]](Elasticsearch.Net.RequestData) Elasticsearch.Net.RequestPipeline.CallElasticsearch[[System.__Canon, mscorlib]](Elasticsearch.Net.RequestData) Elasticsearch.Net.Transport``1[[System.__Canon, mscorlib]].Request[[System.__Canon, mscorlib]](Elasticsearch.Net.HttpMethod, System.String, Elasticsearch.Net.PostData, Elasticsearch.Net.IRequestParameters) clr!InstantiatingMethodStubWorker+bc Elasticsearch.Net.ElasticLowLevelClient.Bulk[[System.__Canon, mscorlib]](Elasticsearch.Net.PostData, Elasticsearch.Net.BulkRequestParameters) NLog.Targets.ElasticSearch.ElasticSearchTarget.SendBatch(System.Collections.Generic.ICollection``1<NLog.Common.AsyncLogEventInfo>) NLog.Targets.Target.WriteAsyncThreadSafe(System.Collections.Generic.IList``1<NLog.Common.AsyncLogEventInfo>) NLog.Targets.Target.WriteAsyncLogEvents(System.Collections.Generic.IList``1<NLog.Common.AsyncLogEventInfo>) NLog.Targets.Wrappers.BufferingTargetWrapper.WriteEventsInBuffer(System.String) NLog.Targets.Wrappers.BufferingTargetWrapper.FlushCallback(System.Object) mscorlib_ni!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)+163 mscorlib_ni!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)+14 mscorlib_ni!System.Threading.TimerQueueTimer.CallCallback()+ba mscorlib_ni!System.Threading.TimerQueueTimer.Fire()+87 mscorlib_ni!System.Threading.TimerQueue.FireNextTimers()+75 clr!CallDescrWorkerInternal+83 clr!CallDescrWorkerWithHandler+4e clr!MethodDescCallSite::CallTargetWorker+f8 clr!AppDomainTimerCallback_Worker+34 clr!ManagedThreadBase_DispatchInner+39 clr!ManagedThreadBase_DispatchMiddle+6c clr!ManagedThreadBase_DispatchOuter+75 clr!ManagedThreadBase_FullTransitionWithAD+2f clr!AppDomainTimerCallback+7c clr!ThreadpoolMgr::AsyncTimerCallbackCompletion+7e clr!UnManagedPerAppDomainTPCount::DispatchWorkItem+1bc clr!ThreadpoolMgr::ExecuteWorkRequest+64 clr!ThreadpoolMgr::WorkerThreadStart+f5 clr!Thread::intermediateThreadProc+86 kernel32!BaseThreadInitThunk+22 ntdll!RtlUserThreadStart+34

snakefoot commented 5 years ago

Is the problem resolved with rollback to NLog.Targets.ElasticSearch ver .6.1.0 ?

snakefoot commented 5 years ago

@ribbles Think you have to create an issue for https://github.com/elastic/elasticsearch-net

Since the bug happens inside Elasticsearch.Net.ElasticLowLevelClient.Bulk(...)

snakefoot commented 5 years ago

@ribbles See also this comment about overriding the JsonSerializer in Elasticsearch.Net

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.