2016-09-15 11 views
2

今天早上我们发生了一件非常可怕的事件。我们的质量保证团队(幸运的是,在美国工作日开始之前就开始工作)报告说我们的生产网站突然崩溃了。当时我们没有做任何奇怪的事情;失败突然而且同时影响了我们所有的环境。我进入生产Web服务器(IIS),发现应用程序池已停止。我重新启动它,并立即再次坠毁。我检查了Windows事件查看器,发现在日志中出现以下错误:Log4Net/LogEntries降低了我们的制作网站

来源:.NET运行库

应用:w3wp.exe的

Framework版本:v4.0.30319

描述:由于未处理的异常而终止进程。

异常的信息:System.Security.Authentication.AuthenticationException 堆栈: 在System.Net.Security.SslState.ForceAuthentication(布尔,字节[],System.Net.AsyncProtocolRequest) 在System.Net.Security.SslState (System.Net.LazyAsyncResult) at System.Net.Security.SslStream.AuthenticateAsClient(System.String) at LogentriesCore.AsyncLoggerBase.Run() at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback,System.Object,Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext,System.Threading.ContextCallback,System.Object,Boolean) 在System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext,System.Threading.ContextCallback,System.Object的) 在System.Threading.ThreadHelper.ThreadStart()

来源:ASP.NET 4.0 .30319.0

发生未处理的异常并且进程已终止。

应用程序ID:/ LM/W3SVC/1/ROOT

进程ID:10156

例外:System.Security.Authentication.AuthenticationException

消息:该远程证书无效根据验证程序。

堆栈跟踪:在System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken消息,AsyncProtocolRequest asyncRequest,异常的异常) 在System.Net.Security.SslState.StartSendBlob(字节[]来电,的Int32计数,AsyncProtocolRequest asyncRequest) System.Net.Security.SslState.ProcessReceivedBlob(Byte [] buffer,Int32 count,AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.StartReceiveBlob(Byte [] buffer,AsyncProtocolRequest asyncRequest) at System.Net.Security。 SslState.StartSendBlob(Byte [] incoming,Int32 count,AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.ProcessReceivedBlob(Byte [] buffer,Int32 count,AsyncProtocolRequest asyncRequest) 在System.Net.Security.SslState。在System.Net.Security.SslState.ProcessReceivedBlob(Byte []缓冲区,位于System.Net.Security.SslState.StartSendBlob(Byte []传入,Int32计数,AsyncProtocolRequest asyncRequest)上的StartReceiveBlob(Byte []缓冲区,AsyncProtocolRequest asyncRequest) INT32计数,AsyncProtocolRequest asyncRequest) 在System.Net.Security.SslState.StartReceiveBlob(字节[]缓冲液,AsyncProtocolRequest asyncRequest) 在System.Net.Security.SslState.StartSendBlob(字节[]来电,INT32计数,AsyncProtocolRequest asyncRequest) System.Net.Security.SslState.ProcessReceivedBlob(Byte [] buffer,Int32 count,AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.StartReceiveBlob(Byte [] buffer,AsyncProtocolRequest asyncRequest) at System.Net.Security。 SslState.StartSendBlob(字节[] System.Net.Security.SslState.ProcessReceivedBlob(Byte []缓冲区,Int32计数,AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.StartReceiveBlob(Byte [] buffer,AsyncProtocolRequest asyncRequest)传入的,Int32计数,AsyncProtocolRequest asyncRequest) ) at System.Net.Security.SslState.StartSendBlob(Byte [] incoming,Int32 count,AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.ProcessReceivedBlob(Byte [] buffer,Int32 count,AsyncProtocolRequest asyncRequest) at System .Net.Security.SslState.StartReceiveBlob(Byte [] buffer,AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState。System.Net.Security.SslState.StartSendBlob(Byte [] incoming,Int32 count,AsyncProtocolRequest asyncRequest) 。 ProcessReceivedBlob(Byte [] b uffer,计数的Int32,AsyncProtocolRequest asyncRequest) 在System.Net.Security.SslState.StartReceiveBlob(字节[]缓冲液,AsyncProtocolRequest asyncRequest) 在System.Net.Security.SslState.StartSendBlob(字节[]来电,的Int32计数,AsyncProtocolRequest asyncRequest ) 在System.Net.Security.SslState.ForceAuthentication(布尔receiveFirst,字节[]缓冲液,AsyncProtocolRequest asyncRequest) 在System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult) 在System.Net.Security.SslStream.AuthenticateAsClient (String targetHost) at LogentriesCore.AsyncLoggerBase.Run() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext,ContextCallback callback,Object state,Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext executionContext,ContextCallback callback,Object state,Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback callback,Object state) at System.Threading.ThreadHelper.ThreadStart()

该堆栈跟踪不包含我们自己的任何代码;唯一对我意味着什么的只是关于Logentries的一点。于是,我马上打开web.config文件和注释掉在Log4Net配置以下行:

<appender-ref ref="LeAppender" /> 

其中LeAppender定义之前为

<appender name="LeAppender" type="log4net.Appender.LogentriesAppender, LogentriesLog4net"> 
    <UseHttp value="false" /> 
    <UseSsl value="true" /> 
    <layout type="log4net.Layout.PatternLayout"> 
    <conversionPattern value="%date %-5level %logger [host=%P{log4net:HostName}:appdomain=%appdomain:referenceid=%property{referenceid}] - %message%newline" /> 
    </layout> 
</appender> 

我重新启动该网站,一切又开始工作,我们的客户并不聪明;幸运的是,这一切都发生了,并在营业时间之前得到解决(但它已接近!)。

这完全吓坏了我。在我看来,Log4Net应该是一个完全健壮的框架,不可能造成任何损害。在我看来,Logentries的证书到期了(或者类似的情况),并且这样做的影响立即导致我们的制作网站崩溃!

Log4Net/Logentries设置有问题吗?

初始配置(不知道这可能是不对的):

XmlConfigurator.Configure(); 

记录器本身是一个ILog,它被赋予像这样:

_log = LogManager.GetLogger("Logger"); 

和日志记录一样做所以:

_log.Logger.Log(typeof(MyLogger), level, message, ex); 

这里没什么不愉快的。一年来它一直工作正常。而且,正如我之前提到的,堆栈跟踪没有任何我们自己的代码的引用,所以它可能不是由于我们编写的任何错误的代码。

任何想法出了什么问题,如何解决这个问题,以及如何确保这种停机再也不会让我们的系统失效? “

+0

这可能是由于记录器对象的多个实例,我建议你遵循单例模式,以避免创建多个实例 –

+0

@Chandruvelan - 如果它是由于多个实例的问题,那么为什么在这之前没有失败过去的一年?更重要的是,为什么它会让我们整个网站崩溃? –

回答

1

”9月14日,为api.logentries.com颁发了新的SSL证书。由于这些证书与以前为api.logentries.com提供的旧证书不匹配,我们建议所有目前正在使用的用户嵌入旧的api.logentries.com证书以切换到使用您的系统证书池。要获得更改您的设置的帮助,请联系[email protected]

此消息本应显示您第一次登录到日志条目今天。这就是为什么你的问题今天开始。

如果您将log4net软件包升级到最新版本,并且您的logentries软件包升级到最新版本,您的问题将得到解决。

+0

谢谢,我从2.7.1升级到2.8.0,问题得到解决。 –