System.Data.OracleClient.dll crashes w3wp.exe on w2k8

时间秒杀一切 提交于 2019-12-11 16:55:28

问题


I'm using Windbg to debug an error that is happening in a website that we have on a Windows Server 2008, IIS7 environment. I've set the symbol path to "SRV*c:\websymbols*http://msdl.microsoft.com/download/symbols"

Then I browse the website, which takes me to the login page. In that moment I attach Windbg to the w3wp.exe process. I then enter my credentials into the login page and submit the form, which is the process that is giving problems. I then select Windbg -> Debug -> Go Unhandled Exception, which outputs the following in the console:

ModLoad: 6d720000 6d835000   C:\Windows\assembly\NativeImages_v2.0.50727_32\System.Data.OracleC#\fb8da45f3873169a502db3cb492b25a0\System.Data.OracleClient.ni.dll  
ModLoad: 06a80000 06afb000   System.Data.OracleClient.dll  
ModLoad: 06b00000 06b7b000   System.Data.OracleClient.dll  
ModLoad: 06a80000 06afb000   C:\Windows\assembly\GAC_32  \System.Data.OracleClient\2.0.0.0__b77a5c561934e089\System.Data.OracleClient.dll
ModLoad: 06b80000 06be1000   C:\XEClient\bin\oci.dll  
ModLoad: 7c340000 7c396000   C:\Windows\system32\MSVCR71.dll  
ModLoad: 06c50000 09af9000   C:\XEClient\bin\OraOCIXE10.dll  
ModLoad: 739d0000 73a02000   C:\Windows\system32\WINMM.dll  
ModLoad: 73990000 739cd000   C:\Windows\system32\OLEACC.dll  
Critical error detected c0000374

After that I hit F10 many times until the following is print to the output and debugger keep thinking:

eax=05cbe288 ebx=00000000 ecx=76e47463 edx=05cbe025 esi=001a0000 edi=01fb3210  
eip=76ebfaf3 esp=05cbe274 ebp=05cbe2f0 iopl=0         nv up ei pl zr na pe nc  
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000246  
ntdll!RtlReportCriticalFailure+0x56:
76ebfaf3 e89063fbff      call    ntdll!RtlRaiseException (76e75e88)  
0:023> p
(5b0.b5c): Unknown exception - code c0000374 (first chance)

Once debugger finally continues, it prints the following to the console:

WARNING: Step/trace thread exited
eax=000000c0 ebx=00000000 ecx=00000400 edx=00000000 esi=04420000 edi=000005b0
eip=76e75e74 esp=05cbdd88 ebp=05cbde0c iopl=0         nv up ei pl nz na po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000202
ntdll!KiFastSystemCallRet:
76e75e74 c3              ret

Then w3wp.exe dies.

My question is... How can I get some more info about the error? I already knew it was related to Oracle because errors dissapear if I just put the following in the global.asax Application_Start method:

try{
new OracleConnection().ConnectionString = "anything";
}catch(Exception ex){
}

That simple line of code fixes the application... Incredible, right?

Thanks in advance

UPDATE: 2011.02.09 15:46
The web app is working fine in Windows XP & Windows Server 2003, IIS 5 & 6.

Global.asax

protected void Application_Start()
{
    RegisterRoutes(RouteTable.Routes);
    Logger.LogMessage("Application_Start", "Started");
}

protected void Application_End()
{
    Logger.LogMessage("Application_End", "ended");  
} 

LoginController.cs

public ActionResult LogOn()
{
            string connString = "Data Source=IP:Port/Service;Persist Security Info=True;User ID=user; Password=user;Unicode=True";
            System.Data.OracleClient.OracleConnection dbConn = new System.Data.OracleClient.OracleConnection();
            dbConn.ConnectionString = connString;

            System.Data.OracleClient.OracleCommand dbComm = new System.Data.OracleClient.OracleCommand();
            dbComm.CommandText = "user.package.procedure";
            dbComm.CommandType = CommandType.StoredProcedure;
            dbComm.Connection = dbConn;
            dbComm.Parameters.Add("MyParam", System.Data.OracleClient.OracleType.Number);
            dbComm.Parameters["MyParam"].Value = DBNull.Value;


            System.Data.OracleClient.OracleDataAdapter dbAdap = new System.Data.OracleClient.OracleDataAdapter(dbComm);

            DataSet ds = new DataSet();

            try {
                Logger.LogMessage("TEST", "1");
                dbConn.Open();
                Logger.LogMessage("TEST", "2");
                dbAdap.Fill(ds);
                Logger.LogMessage("TEST", "3");
            } catch(Exception ex) {
                Logger.LogMessage("TEST", "4");
            } finally {
                Logger.LogMessage("TEST", "5");
                if(dbConn.State != ConnectionState.Closed) {
                    dbConn.Close();
                }
                dbConn.Dispose();
            }           
            return View();
}

Now the curious thing: You install the website. Browse it. You're taken to Login page. w3wp.exe is now live. Enter credentials an submit form. Everything is ok. You log on to the site and start navigating through its pages. All pages have Oracle interaction.

Stop browsing.

Some minutes after you stopped browsing, w3wp.exe dies. It is ok. It must happen unless you specify otherwise.

Browse again. You are taken to login page and w3wp.exe is live again. Enter credentials and click submit. Code stops when executing the line "dbConn.Open();"

What I see in the log is:

  • Application_Start - Started
  • TEST - 1

After 1 minute or so, I see the following in the log:

  • Application_Start - Started
  • TEST - 1

After that, application just display the "Internet Explorer cannot display the webpage" page.

Log does not show "TEST - 4" cause of the catch neither it shows "Application_End - Ended" cause of the global.asax method.

EventViewer is not helpful, since it only says that w3wp.exe has failed.

Now the even more courious thing. If I apply following line in Application_Start method, application works:

try{ new System.Data.OracleClient.OracleConnection().ConnectionString = "anything"; }catch(Exception ex){ }

It throws an exception saying that connection string format is invalid. But application works.

What am I expecting from Windbg? I'm expecting it to gives me something I can browse in google and then google takes me to some blog where a guy wrote that "you have to reinstall Oracle 10g" or something like that...

Thanks again.


回答1:


Looks like a managed exception

Steps to diagnose managed code Exception

  1. Attach to the process
  2. Issue the command .loadby sos mscorwks for up to .NET 3.5 and for .NET 4.0 use .loadby sos clr
  3. Next Issue the command sxe -c "!clrstack;!pe;KB" clr ;g

This would break the debugger when there is a managed exception and provide you with managed /native call-stack as well as exception details.




回答2:


I don't know what do you mean by "w3wp.exe" dies. Can you see in Windows event log if there is any IIS error?

Debug Diag crash rule can be a better way to capture crash dumps if you are not familiar with live debugging,

http://support.microsoft.com/kb/919789

Analyzing crash dumps is a clearer approach for crash issues.



来源:https://stackoverflow.com/questions/4949516/system-data-oracleclient-dll-crashes-w3wp-exe-on-w2k8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!