| Author |
Message |
SamFoot
Joined: 25 Sep 2009 Posts: 3
|
Posted: Fri Sep 25, 2009 11:49 am Post subject: Memory Error When Profiling Web Application |
|
|
Hi There,
I am having trouble profiling a web application that I have made, when I load the default page I get this error:
| Code: |
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.]
SNIOpenEx(SNI_CONSUMER_INFO* , UInt16* , SNI_Conn** , Int32 , UInt32 , Byte* , Byte* , Int32 , Int32 ) +0
SNINativeMethodWrapper.SNIOpenEx(ConsumerInfo consumerInfo, String constring, IntPtr& pConn, Boolean fInitSec, Byte[] sspiBuffer, Byte[] instanceName, Boolean fOverrideCache, Boolean fSync) +179
System.Data.SqlClient.SNIHandle..ctor(ConsumerInfo myInfo, String serverName, Boolean integratedSecurity, Byte[] serverUserName, Boolean ignoreSniOpenTimeout, Int32 timeout, Byte[]& instanceName, Boolean flushCache, Boolean fSync) +169
System.Data.SqlClient.TdsParserStateObject.CreatePhysicalSNIHandle(String serverName, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Byte[]& instanceName, Boolean integratedSecurity, Byte[] serverUserName, Boolean flushCache, Boolean async) +238
System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject) +296
System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +223
System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +335
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +277
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +228
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +559
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +64
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +326
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +115
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +496
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +121
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +135
System.Data.SqlClient.SqlConnection.Open() +187
SMTDWeb.Global.GetMaintenanceFlag() +168
SMTDWeb.handlerMaintenanceCheck.Application_BeginRequest(Object source, EventArgs e) +160
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +150
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +95
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3082; ASP.NET Version:2.0.50727.3082 |
My log for this profile is as follows:
| Code: |
25 Sep 2009 11:41:30.796 [1] INFO RedGate.Profiler.Logging.LogService - Starting new ANTS Performance Profiler 5 session
25 Sep 2009 11:41:30.812 [1] INFO RedGate.Profiler.Logging.LogService - Assembly version: 5.1.0.14
25 Sep 2009 11:41:51.078 [1] WARN RedGate.Profiler.OS.Local.LocalWindowsVersionInspector - Detected Windows version: Windows XP Professional (5.2 64-bit)
25 Sep 2009 11:41:51.078 [1] WARN RedGate.Profiler.IISSupport.Local.LocalIisInspector - IIS is supported on installed OS version
25 Sep 2009 11:41:51.187 [1] WARN RedGate.Profiler.IISSupport.Local.LocalIisInspector - Result of check to see if inetinfo.exe running: True
25 Sep 2009 11:41:51.187 [1] WARN RedGate.Profiler.IISSupport.Local.LocalIisInspector - Checks confirm that IIS is running.
25 Sep 2009 11:41:51.187 [1] WARN RedGate.Profiler.IISSupport.Local.LocalIisInspector - Checks confirm that IIS is enabled.
25 Sep 2009 11:41:51.203 [1] WARN RedGate.Profiler.IISSupport.Local.LocalIisInspector - Successfully detected IIS installation: IIS 6 (Auto-detected)
25 Sep 2009 11:41:51.203 [1] WARN RedGate.Profiler.IISSupport.Local.LocalIisInspector - Checks confirm that IIS is installed.
25 Sep 2009 11:42:08.453 [Profiler pipe monitor] WARN RedGate.Profiler.Engine.Startup.Sessions.IISSession - The local app data path for IIS is C:\Documents and Settings\Default User\Local Settings\Application Data, so ANTS will use C:\Documents and Settings\Default User\Local Settings\Application Data\Red Gate\ANTS Profiler to store results
25 Sep 2009 11:42:52.000 [Profiler pipe monitor] WARN RedGate.Profiler.Engine.Startup.Basic.PipeConnection - Pipe has been closed; most likely the process being profiled has terminated.
25 Sep 2009 11:43:51.046 [Profiler pipe monitor] WARN RedGate.Profiler.Engine.Startup.Sessions.IISSession - The local app data path for IIS is C:\Documents and Settings\Default User\Local Settings\Application Data, so ANTS will use C:\Documents and Settings\Default User\Local Settings\Application Data\Red Gate\ANTS Profiler to store results
25 Sep 2009 11:46:31.843 [24] WARN RedGate.Profiler.Monitoring.PerformanceDataAdapter - Invalid operation exception occurred whilst trying to check process ID: Instance 'w3wp#1' does not exist in the specified Category.
System.InvalidOperationException: Instance 'w3wp#1' does not exist in the specified Category.
at System.Diagnostics.CounterDefinitionSample.GetInstanceValue(String instanceName)
at System.Diagnostics.PerformanceCounter.NextSample()
at RedGate.Profiler.Monitoring.PerformanceDataAdapter.a(Object , UpdateTimerElapsedEventArgs )
25 Sep 2009 11:46:31.968 [24] WARN RedGate.Profiler.Monitoring.PerformanceDataAdapter - Invalid operation exception occurred whilst trying to check process ID: Instance 'w3wp#1' does not exist in the specified Category.
System.InvalidOperationException: Instance 'w3wp#1' does not exist in the specified Category.
at System.Diagnostics.CounterDefinitionSample.GetInstanceValue(String instanceName)
at System.Diagnostics.PerformanceCounter.NextSample()
at RedGate.Profiler.Monitoring.PerformanceDataAdapter.a(Object , UpdateTimerElapsedEventArgs )
25 Sep 2009 11:46:32.015 [24] WARN RedGate.Profiler.Monitoring.PerformanceDataAdapter - Invalid operation exception occurred whilst trying to check process ID: Instance 'w3wp#1' does not exist in the specified Category.
System.InvalidOperationException: Instance 'w3wp#1' does not exist in the specified Category.
at System.Diagnostics.CounterDefinitionSample.GetInstanceValue(String instanceName)
at System.Diagnostics.PerformanceCounter.NextSample()
at RedGate.Profiler.Monitoring.PerformanceDataAdapter.a(Object , UpdateTimerElapsedEventArgs )
|
Has anyone else encountered anything like this before?
Cheers
Sam |
|
| Back to top |
|
 |
Chris.Allen
Joined: 12 Mar 2009 Posts: 454
|
Posted: Mon Sep 28, 2009 11:08 am Post subject: |
|
|
| This happens reasonably often and normally means that there's is an out of memory problem (why it doesn't explicitly give OOM I don't know). To check this independently, can you tell me what the total memory usage on the machine at the time of error is (using, for example, Task manager)? |
|
| Back to top |
|
 |
SamFoot
Joined: 25 Sep 2009 Posts: 3
|
Posted: Mon Sep 28, 2009 4:02 pm Post subject: |
|
|
| It has bout 6GB free, the machine itself has 8GB of RAM and is running 64bit Windows XP. |
|
| Back to top |
|
 |
AndrewH
Joined: 17 Aug 2006 Posts: 137
|
Posted: Tue Sep 29, 2009 10:10 am Post subject: |
|
|
On a 64-bit system, the profiler is unlikely to run out of memory, so this is probably a genuine memory corruption issue of some variety.
Some kinds of reflection interfere with the line-level timing code used by the profiler (in particular, adding methods or classes to assemblies that are already loaded instead of to temporary assemblies). Could you try profiling with line-level timings disabled to see if that solves the problem? _________________ Andrew Hunter
Software Developer
Red Gate Software Ltd. |
|
| Back to top |
|
 |
SamFoot
Joined: 25 Sep 2009 Posts: 3
|
Posted: Tue Sep 29, 2009 1:45 pm Post subject: |
|
|
| I have tried it with all of the various profiling methods and it happens with all of them unfortunatly. |
|
| Back to top |
|
 |
Chris.Allen
Joined: 12 Mar 2009 Posts: 454
|
Posted: Tue Sep 29, 2009 5:50 pm Post subject: |
|
|
If you can get a mini-dump with the exception in it we will gladly analyze it at:
support@red-gate.com
(just quote this forum subject) |
|
| Back to top |
|
 |
AndrewH
Joined: 17 Aug 2006 Posts: 137
|
Posted: Thu Oct 01, 2009 11:31 am Post subject: |
|
|
Hmm, it's possible that this crash is one that we've had some sporadic reports of but have never been able to reproduce here - on some systems trying to use the socket API causes the profiler to crash.
What kind of security software do you have installed on the machine that is exhibiting this issue - in particular anti-virus and firewall software?
Does forcing your application to run in 32-bit mode have any effect on the issue? _________________ Andrew Hunter
Software Developer
Red Gate Software Ltd. |
|
| Back to top |
|
 |
icy
Joined: 10 Dec 2009 Posts: 3 Location: New York
|
Posted: Thu Dec 10, 2009 5:28 pm Post subject: I'll jump in this bandwagon |
|
|
I am experiencing the exact same issue. I have narrowed it down to SQL access methodology. Though I could not exactly pinpoint where the issue lies. First and foremost, I am sure that this is NOT what it seems. There is no instability, memory corruption or any other type of issue with the application that I am monitoring. I am doing this merely out of curiosity.
I was doing a search on this particular error when I came across this thread. I will try to create a small project for the RedGate guys to recreate the issue and post it here.
Here's what I know so far:
If you create a local datastore (SqlCe) and access it, then there is no problem.
If you try to access a database on another server, then you have a problem.
This may be because of windows security issues - Active Directory etc. So far, changing the connection string to various models did not help circumvent the problem (TCP/IP, NamedPipes, Trusted Security, No-Trusted Security etc). |
|
| Back to top |
|
 |
Chris.Allen
Joined: 12 Mar 2009 Posts: 454
|
Posted: Fri Dec 11, 2009 4:12 pm Post subject: |
|
|
We would be extremely grateful to receive a project that reproduces this.
I'll set you up some secure ftp space to upload to if that would help. |
|
| Back to top |
|
 |
icy
Joined: 10 Dec 2009 Posts: 3 Location: New York
|
Posted: Fri Dec 11, 2009 5:45 pm Post subject: Test results |
|
|
The tests that I ran:
[passed]. local sql2005 express db
[passed]. local sqlCE db
[passed]. local sql2005 (not express) db
[passed]. Remote sqlCE db
[failed]. remote sql2005 express db
[failed]. remote sql2005
[failed]. remote sql2008 (this database is my own web site's database server. It's hosted on a hosting facility and has nothing to do with AD security issues. The host name is an IP address and the connection is not secured)
In all the tests, I ran first without profiler, saw the data in the datagrid, and then tried to run it again with profiler and saw the crash. For your information a screenshot is also attached.
Briefly, when the database to which you are trying to connect is on another computer (except the CE database, that one did not matter) then as soon as you set the ConnectionString property of the connection object, the profiler crashes. You don't even need to do anything on the connection: no need to open, execute. Just say conn.ConnectionString = "connstring" and the profiler will crash.
My environment:
/***********************************************************/XP Prof SP3
AVG Antivirus
Microsoft Security Essentials
Personal Firewall TURNED OFF
Behind local NAT
/***********************************************************/
Microsoft Visual Studio 2008
Version 9.0.21022.8 RTM
Microsoft .NET Framework
Version 3.5 SP1 |
|
| Back to top |
|
 |
cledwyn
Joined: 14 Jan 2010 Posts: 1
|
Posted: Thu Jan 14, 2010 10:11 pm Post subject: Any solution |
|
|
| This is happening with me. Runs fine in normal debug mode but when trying to profile it I get the "Attempted to read or write protected memory. This is often an indication that other memory is corrupt." Error. |
|
| Back to top |
|
 |
icecurtain
Joined: 18 Jan 2010 Posts: 9
|
Posted: Mon Jan 18, 2010 6:21 pm Post subject: |
|
|
This is happening with me. Runs fine after a few writes to the database but first of all I get the "Attempted to read or write protected memory. This is often an indication that other memory is corrupt." Error.
but when I stop and start the DB it goes away.
I am using Oracle Express 10.0.2
Microsoft .NET Framework
Version 3.5 SP1
I am convinced it is a connection issue..
any light would be good. |
|
| Back to top |
|
 |
icy
Joined: 10 Dec 2009 Posts: 3 Location: New York
|
Posted: Thu Jan 28, 2010 5:25 pm Post subject: This problem seems to be rectified with the latest release |
|
|
| I have downloaded the latest release (eval) and I am happy to see that this problem is no more !!! Well done RedGate team. Now we can test this thoroughly |
|
| Back to top |
|
 |
|