Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SkyApm Log exception #505

Closed
3 tasks
sampsonye opened this issue Sep 14, 2022 · 10 comments
Closed
3 tasks

SkyApm Log exception #505

sampsonye opened this issue Sep 14, 2022 · 10 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@sampsonye
Copy link
Contributor

Please answer these questions before submitting your issue.

  • Why do you submit this issue?
  • Question or discussion
  • [* ] Bug
  • Requirement
  • Feature or performance improvement

Question

  • What do you want to know?

Bug

  • Which version of SkyWalking, OS and .NET Runtime?

  • Which company or project?

  • What happen?
    If possible, provide a way for reproducing the error. e.g. demo application, component version.

Unhandled exception. System.AggregateException: An error occurred while writing to logger(s). (Object reference not set to an instance of an object.)
 ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at SkyApm.Transport.SegmentContextMapper.Map(SegmentContext segmentContext)
   at SkyApm.Transport.LoggerContextContextMapper.Map(LoggerContext loggerContext)
   at SkyApm.Transport.AsyncQueueSkyApmLogDispatcher.Dispatch(LoggerContext loggerContext)
   at SkyApm.Diagnostics.MSLogging.SkyApmLogger.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception, Func`3 formatter)
   at Microsoft.Extensions.Logging.Logger.<Log>g__LoggerLog|12_0[TState](LogLevel logLevel, EventId eventId, ILogger logger, Exception exception, Func`3 formatter, List`1& exceptions, TState& state)
   --- End of inner exception stack trace ---
   at Microsoft.Extensions.Logging.Logger.ThrowLoggingError(List`1 exceptions)
   at Microsoft.Extensions.Logging.Logger.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception, Func`3 formatter)
   at Microsoft.Extensions.Logging.Logger`1.Microsoft.Extensions.Logging.ILogger.Log[TState](LogLevel logLevel, EventId eventId, TState state, Exception exception, Func`3 formatter)
   at Microsoft.Extensions.Logging.LoggerExtensions.Log(ILogger logger, LogLevel logLevel, EventId eventId, Exception exception, String message, Object[] args)
   at Microsoft.Extensions.Logging.LoggerExtensions.LogInformation(ILogger logger, String message, Object[] args)
   at DotNetCore.CAP.Processor.CapProcessingServer.Dispose()
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.DisposeAsync()
--- End of stack trace from previous location ---
   at Microsoft.Extensions.Hosting.Internal.Host.<DisposeAsync>g__DisposeAsync|16_0(Object o)
   at Microsoft.Extensions.Hosting.Internal.Host.DisposeAsync()
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
   at Microsoft.AspNetCore.Builder.WebApplication.Run(String url)

Requirement or improvement

  • Please describe about your requirements or improvement suggestions.
@KawhiWei
Copy link
Contributor

In what scenario does this error occur? @sampsonye

@sampsonye
Copy link
Contributor Author

In what scenario does this error occur? @sampsonye

Use Cap

@sampsonye
Copy link
Contributor Author

In what scenario does this error occur? @sampsonye

i guess the bug is here:
image
Cap init before any IEntrySegmentContextAccessor may be there do not have any EntrySegment

@sampsonye
Copy link
Contributor Author

Can we stop using the log extension?
i just want use skywalking as apm
and we have the profressional log center

@KawhiWei
Copy link
Contributor

I want to know whether the problem occurs when Cap produces messages or when Cap consumes messages? @sampsonye

@sampsonye
Copy link
Contributor Author

sampsonye commented Sep 14, 2022

I want to know whether the problem occurs when Cap produces messages or when Cap consumes messages? @sampsonye

i say just in cap Bootstrap ,you can find it on exception stack

the really code just:
image

and you can make a test just do not have any EntrySegment

finally can we close this log? it is redundant for us

@liuhaoyang
Copy link
Collaborator

I want to know whether the problem occurs when Cap produces messages or when Cap consumes messages? @sampsonye

i say just in cap Bootstrap ,you can find it on exception stack

the really code just: image

and you can make a test just do not have any EntrySegment

finally can we close this log? it is redundant for us

@GeorGeWzw I think it's reasonable to allow users to disable logging integration.

@sampsonye
Copy link
Contributor Author

sampsonye commented Sep 16, 2022

it seem like a critical fault
it make logger broken when we do not have init EntrySegment
Just happen Like:

  1. some module that do not use skyapm like quartz,hangfire and so on
  2. BackgroundService、HostService

@liuhaoyang @GeorGeWzw any suggestions?

@liuhaoyang
Copy link
Collaborator

I have removed the 2.1.0 release until this issue is fixed.

@liuhaoyang
Copy link
Collaborator

it seem like a critical fault it make logger broken when we do not have init EntrySegment Just happen Like:

  1. some module that do not use skyapm like quartz,hangfire and so on
  2. BackgroundService、HostService

@liuhaoyang @GeorGeWzw any suggestions?

I just re-reviewed the code LoggerContextContextMapper.cs#L34 should check if SegmentContext is null before mapping SegmentContext to segmentRequest

@wu-sheng wu-sheng added this to the 2.1.0 milestone Sep 16, 2022
@wu-sheng wu-sheng added the bug Something isn't working label Sep 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants