Benutzer mit den meisten Antworten
System.AccessViolationException: Attempted to read or write protected memory

Frage
-
Hello,
I implemented a WCF service (hosted as windows service) and have problems the following exception. My question is: Why do I get a AccessViolationException, although the service trace says there was thrown a OracleException?
The System.Diagnostics.TextWriterTraceListener wrote:
log4net:ERROR [AdoNetAppender] Exception while writing to database System.Data.OracleClient.OracleException: ORA-01461: can bind a LONG value only for insert into a LONG column at System.Data.OracleClient.OracleConnection.CheckError(OciErrorHandle errorHandle, Int32 rc) at System.Data.OracleClient.OracleCommand.Execute(OciStatementHandle statementHandle, CommandBehavior behavior, Boolean needRowid, OciRowidDescriptor& rowidDescriptor, ArrayList& resultParameterOrdinals) at System.Data.OracleClient.OracleCommand.ExecuteNonQueryInternal(Boolean needRowid, OciRowidDescriptor& rowidDescriptor) at System.Data.OracleClient.OracleCommand.ExecuteNonQuery() at log4net.Appender.AdoNetAppender.SendBuffer(IDbTransaction dbTran, LoggingEvent[] events) at log4net.Appender.AdoNetAppender.SendBuffer(LoggingEvent[] events)
But log4net logged:
FATAL 03.01.11 16:37:03 [ 7072]: Ein unbehandelter Fehler ist aufgetreten (sender: Name:<span lang="DE">RORC.Deal_Archive.</span>DealsServices.exe There are no context policies. , exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at System.Net.Security.NegoState.ProcessAuthentication(LazyAsyncResult lazyResult) at System.Net.Security.NegotiateStream.AuthenticateAsServer(NetworkCredential credential, ExtendedProtectionPolicy policy, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel requiredImpersonationLevel) at System.Net.Security.NegotiateStream.AuthenticateAsServer(NetworkCredential credential, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel requiredImpersonationLevel) at System.ServiceModel.Channels.WindowsStreamSecurityUpgradeProvider.WindowsStreamSecurityUpgradeAcceptor.OnAcceptUpgrade(Stream stream, SecurityMessageProperty& remoteSecurity) at System.ServiceModel.Channels.StreamSecurityUpgradeAcceptorBase.AcceptUpgrade(Stream stream) at System.ServiceModel.Channels.InitialServerConnectionReader.UpgradeConnection(IConnection connection, StreamUpgradeAcceptor upgradeAcceptor, IDefaultCommunicationTimeouts defaultTimeouts) at System.ServiceModel.Channels.ServerSessionPreambleConnectionReader.ServerFramingDuplexSessionChannel.OnOpen(TimeSpan timeout) at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) at System.ServiceModel.Channels.CommunicationObject.Open() at System.ServiceModel.Dispatcher.ChannelHandler.OpenAndEnsurePump() at System.ServiceModel.Dispatcher.ChannelHandler.OpenAndEnsurePump(Object state) at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.WorkItem.Invoke2() at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.WorkItem.OnSecurityContextCallback(Object o) at System.Security.SecurityContext.Run(SecurityContext securityContext, ContextCallback callback, Object state) at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.WorkItem.Invoke() at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.ProcessCallbacks() at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.CompletionCallback(Object state) at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped) at System.ServiceModel.Diagnostics.Utility.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped) at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)) System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at System.Net.Security.NegoState.ProcessAuthentication(LazyAsyncResult lazyResult) at System.Net.Security.NegotiateStream.AuthenticateAsServer(NetworkCredential credential, ExtendedProtectionPolicy policy, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel requiredImpersonationLevel) at System.Net.Security.NegotiateStream.AuthenticateAsServer(NetworkCredential credential, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel requiredImpersonationLevel) at System.ServiceModel.Channels.WindowsStreamSecurityUpgradeProvider.WindowsStreamSecurityUpgradeAcceptor.OnAcceptUpgrade(Stream stream, SecurityMessageProperty& remoteSecurity) at System.ServiceModel.Channels.StreamSecurityUpgradeAcceptorBase.AcceptUpgrade(Stream stream) at System.ServiceModel.Channels.InitialServerConnectionReader.UpgradeConnection(IConnection connection, StreamUpgradeAcceptor upgradeAcceptor, IDefaultCommunicationTimeouts defaultTimeouts) at System.ServiceModel.Channels.ServerSessionPreambleConnectionReader.ServerFramingDuplexSessionChannel.OnOpen(TimeSpan timeout) at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) at System.ServiceModel.Channels.CommunicationObject.Open() at System.ServiceModel.Dispatcher.ChannelHandler.OpenAndEnsurePump() at System.ServiceModel.Dispatcher.ChannelHandler.OpenAndEnsurePump(Object state) at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.WorkItem.Invoke2() at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.WorkItem.OnSecurityContextCallback(Object o) at System.Security.SecurityContext.Run(SecurityContext securityContext, ContextCallback callback, Object state) at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.WorkItem.Invoke() at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.ProcessCallbacks() at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.CompletionCallback(Object state) at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped) at System.ServiceModel.Diagnostics.Utility.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped) at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
PS: I wonder why the application log shows .Net 2.0 for Event Source since the service is compiled with .Net 3.5 and there is no supportedRuntime-information in app.config:
Event Type: Error Event Source: .NET Runtime 2.0 Error Reporting Event Category: None Event ID: 5000 Date: 03.01.2011 Time: 16:37:05 User: N/A Computer: xx Description: EventType clr20r3, P1 rorc.deal_archive.dealsservices, P2 1.0.0.0, P3 4d1b11d7, P4 system, P5 2.0.0.0, P6 4ba85929, P7 2bd4, P8 71, P9 system.accessviolationexception, P10 NIL. For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp. Data: 0000: 63 00 6c 00 72 00 32 00 c.l.r.2. 0008: 30 00 72 00 33 00 2c 00 0.r.3.,. 0010: 20 00 72 00 6f 00 72 00 .r.o.r. 0018: 63 00 2e 00 64 00 65 00 c...d.e. 0020: 61 00 6c 00 5f 00 61 00 a.l._.a. 0028: 72 00 63 00 68 00 69 00 r.c.h.i. 0030: 76 00 65 00 2e 00 64 00 v.e...d. 0038: 65 00 61 00 6c 00 73 00 e.a.l.s. 0040: 73 00 65 00 72 00 76 00 s.e.r.v. 0048: 69 00 63 00 65 00 73 00 i.c.e.s. 0050: 2c 00 20 00 31 00 2e 00 ,. .1... 0058: 30 00 2e 00 30 00 2e 00 0...0... 0060: 30 00 2c 00 20 00 34 00 0.,. .4. 0068: 64 00 31 00 62 00 31 00 d.1.b.1. 0070: 31 00 64 00 37 00 2c 00 1.d.7.,. 0078: 20 00 73 00 79 00 73 00 .s.y.s. 0080: 74 00 65 00 6d 00 2c 00 t.e.m.,. 0088: 20 00 32 00 2e 00 30 00 .2...0. 0090: 2e 00 30 00 2e 00 30 00 ..0...0. 0098: 2c 00 20 00 34 00 62 00 ,. .4.b. 00a0: 61 00 38 00 35 00 39 00 a.8.5.9. 00a8: 32 00 39 00 2c 00 20 00 2.9.,. . 00b0: 32 00 62 00 64 00 34 00 2.b.d.4. 00b8: 2c 00 20 00 37 00 31 00 ,. .7.1. 00c0: 2c 00 20 00 73 00 79 00 ,. .s.y. 00c8: 73 00 74 00 65 00 6d 00 s.t.e.m. 00d0: 2e 00 61 00 63 00 63 00 ..a.c.c. 00d8: 65 00 73 00 73 00 76 00 e.s.s.v. 00e0: 69 00 6f 00 6c 00 61 00 i.o.l.a. 00e8: 74 00 69 00 6f 00 6e 00 t.i.o.n. 00f0: 65 00 78 00 63 00 65 00 e.x.c.e. 00f8: 70 00 74 00 69 00 6f 00 p.t.i.o. 0100: 6e 00 20 00 4e 00 49 00 n. .N.I. 0108: 4c 00 0d 00 0a 00 L.....
Antworten
-
Hallo Norman,
lässt man die Exception beiseite, so sieht der Callstack u. a. ähnlich aus wie bei:
WCF service connection problem under Vistaund eine Reihe anderer ähnlicher Fälle liefert, z. B.:
http://www.google.com/search?hl=en&q=WindowsStreamSecurityUpgradeProviderIch stecke aber nicht tief genug in WCF drin, um das jetzt auszusortieren.
Gruß Elmar
- Als Antwort markiert Robert BreitenhoferModerator Montag, 24. Januar 2011 15:20
-
Hallo Norman,
bitte beachte, das wir hier Deutsch sprechen, gemäß den Forenregeln.ok, gut, da für uns WCF u.a. unser täglich Brot ist ... benutze möglichst den SvcTraceViewer (mit den entsprechenden Einstellungen aus den Links, also u.a. etwa includeExceptionDetailInFaults in <serviceDebug> aktivieren.).
[Verwaltung und Diagnose]
http://msdn.microsoft.com/de-de/library/ms731055.aspx
[Service Trace Viewer-Tool (SvcTraceViewer.exe)]
http://msdn.microsoft.com/de-de/library/ms732023.aspxSchau Dir mal diese Bilder (unten) an, wie mächtig und aussagekräftig (auch aus unserer Erfahrung) diese Tool-Umgebung ist:
[Verwenden von Service Trace Viewer zum Anzeigen korrelierender Ablaufverfolgungen und der Problembehandlung]
http://msdn.microsoft.com/de-de/library/aa751795.aspx______________
Zu Deinem Fehler ...
ok, der "ORA-01461" besagt ja im Prinzip, dass hier "Log4Net-Appender" versucht, einen großen (long) Wert in eine Spalte zu schrieben, die nicht vom Typ long ist. Das ist wohl öfter aufgetreten:
http://www.google.de/#sclient=psy&hl=de&site=&source=hp&q=ORA-01461+log4netWas WCF betrifft, ist das im Prinzip hauptsächlich:
http://www.google.de/#sclient=psy&hl=de&q=Security+NegoState+ProcessAuthentication
das Problem ist hier aber wohl eher bei log4Net zu suchen.
ciao Frank- Als Antwort markiert Robert BreitenhoferModerator Montag, 24. Januar 2011 15:20
Alle Antworten
-
Hallo Norman,
wenn ich die beiden Schnippsel richtig deute, so wird die erste Ausnahme vom Log4Net Appender ausgelöst.
Das würde bedeuten, dass die originäre Ausnahme nicht in die Datenbank geschrieben wird.Überprüfe die Konfiguration für die Oracle-Tabelle, die dort verwendet wird.
Auch würde ich Dir empfehlen, parallel ein weiteres Dateilog zu schreiben.Die zweiten Ausnahme (AccessViolationException) tritt bei der Authentifizierung auf.
Und Du solltest die Dienst-Konfiguration prüfen.Gruß Elmar
-
Hallo Elmar,
vielen Dank für die Antwort. Die Fehlerursache beim DB-Logging werde ich finden, das ist okay. (Einen FileAppender habe ich auch, da steht die Meldung des Trace aber auch nicht drin).
Was aber meinst du mit "tritt bei der Authentifizierung auf"? Der Dienst läuft unter Local System.
Grüße, Norman
-
Hallo Norman,
lässt man die Exception beiseite, so sieht der Callstack u. a. ähnlich aus wie bei:
WCF service connection problem under Vistaund eine Reihe anderer ähnlicher Fälle liefert, z. B.:
http://www.google.com/search?hl=en&q=WindowsStreamSecurityUpgradeProviderIch stecke aber nicht tief genug in WCF drin, um das jetzt auszusortieren.
Gruß Elmar
- Als Antwort markiert Robert BreitenhoferModerator Montag, 24. Januar 2011 15:20
-
Hallo Norman,
bitte beachte, das wir hier Deutsch sprechen, gemäß den Forenregeln.ok, gut, da für uns WCF u.a. unser täglich Brot ist ... benutze möglichst den SvcTraceViewer (mit den entsprechenden Einstellungen aus den Links, also u.a. etwa includeExceptionDetailInFaults in <serviceDebug> aktivieren.).
[Verwaltung und Diagnose]
http://msdn.microsoft.com/de-de/library/ms731055.aspx
[Service Trace Viewer-Tool (SvcTraceViewer.exe)]
http://msdn.microsoft.com/de-de/library/ms732023.aspxSchau Dir mal diese Bilder (unten) an, wie mächtig und aussagekräftig (auch aus unserer Erfahrung) diese Tool-Umgebung ist:
[Verwenden von Service Trace Viewer zum Anzeigen korrelierender Ablaufverfolgungen und der Problembehandlung]
http://msdn.microsoft.com/de-de/library/aa751795.aspx______________
Zu Deinem Fehler ...
ok, der "ORA-01461" besagt ja im Prinzip, dass hier "Log4Net-Appender" versucht, einen großen (long) Wert in eine Spalte zu schrieben, die nicht vom Typ long ist. Das ist wohl öfter aufgetreten:
http://www.google.de/#sclient=psy&hl=de&site=&source=hp&q=ORA-01461+log4netWas WCF betrifft, ist das im Prinzip hauptsächlich:
http://www.google.de/#sclient=psy&hl=de&q=Security+NegoState+ProcessAuthentication
das Problem ist hier aber wohl eher bei log4Net zu suchen.
ciao Frank- Als Antwort markiert Robert BreitenhoferModerator Montag, 24. Januar 2011 15:20