none
System.AccessViolationException when moving app to server 2008R2 64bit RRS feed

  • Question

  • We are switching to Windows Server 2008 R2 64bit servers and are seeing some issues. Our windows services are throwing "System.AccessViolationException" exception in the windows event log. We never had this issue on our old windows 2003 32bit servers. The only app change was a recompile as a 64bit app.

    I don't know if it's a code issue, or a server setup issue. Anyone have any ideas why this would happen?

    Here are two of the stack traces.



    Application: MyApplication1.exe
    Framework Version: v4.0.30319
    Description: The process was terminated due to an unhandled exception.
    Exception Info: System.AccessViolationException
    Stack:

       at Devart.Data.Oracle.OracleConnection.BeginTransaction(System.Data.IsolationLevel)
       at MyApplication.AlertWorkerBase.persistErrors(System.String, System.String, Char)
       at MyApplication.AlertWorkerBase.StartAlertWorker()
       at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
       at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
       at System.Threading.ThreadHelper.ThreadStart()


    Application: MyApplication2.exe
    Framework Version: v4.0.30319
    Description: The process was terminated due to an unhandled exception.
    Exception Info: System.AccessViolationException

    Stack:
       at System.Threading.Thread.InternalCrossContextCallback(System.Runtime.Remoting.Contexts.Context, IntPtr, Int32, System.Threading.InternalCrossContextDelegate, System.Object[])
       at System.Runtime.Remoting.Activation.ActivationServices.DoCrossContextActivation(System.Runtime.Remoting.Activation.IConstructionCallMessage)
       at System.Runtime.Remoting.Messaging.ClientContextTerminatorSink.SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage)
       at System.Runtime.Remoting.Activation.ActivationServices.Activate(System.Runtime.Remoting.Proxies.RemotingProxy, System.Runtime.Remoting.Activation.IConstructionCallMessage)
       at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(System.Runtime.Remoting.Messaging.IMessage)
       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(System.Runtime.Remoting.Proxies.MessageData ByRef, Int32)
       at MyApplication2.SessStatsLookup..ctor(Energy.VT.Common.ApplicationParameters)
       at MyApplication2.TCPConnection.ClientHandler.Initialize(MyApplication2.ApplicationParameters)
       at MyApplication2.TCPConnection.ClientHandler.ServeClient()
       at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
       at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
       at System.Threading.ThreadHelper.ThreadStart()



    Dan

    Wednesday, August 22, 2012 3:55 PM

Answers

  • Dan,

      While it is impossible to say what the error is with the information provided, I do think we can narrow it down some.

      According to Microsoft: http://msdn.microsoft.com/en-us/library/system.accessviolationexception.aspx
    "In programs consisting entirely of verifiable managed code, all references are either valid or null, and access violations are impossible. An AccessViolationException occurs only when verifiable managed code interacts with unmanaged code or with unsafe managed code."

      From this I would be inclined to look at any references\dependencies my managed code has to unmanaged code. 3rd party libraries maybe written in c++ etc that, may not be x64 compatible.

      You do have the option to compile and run as a x32 application on your x64 server if need be while resolving the issue.


    Chris Wigley MCPD


    Thursday, August 23, 2012 2:06 AM

All replies

  • Dan,

      While it is impossible to say what the error is with the information provided, I do think we can narrow it down some.

      According to Microsoft: http://msdn.microsoft.com/en-us/library/system.accessviolationexception.aspx
    "In programs consisting entirely of verifiable managed code, all references are either valid or null, and access violations are impossible. An AccessViolationException occurs only when verifiable managed code interacts with unmanaged code or with unsafe managed code."

      From this I would be inclined to look at any references\dependencies my managed code has to unmanaged code. 3rd party libraries maybe written in c++ etc that, may not be x64 compatible.

      You do have the option to compile and run as a x32 application on your x64 server if need be while resolving the issue.


    Chris Wigley MCPD


    Thursday, August 23, 2012 2:06 AM
  • Do you think Data Execution Prevention could cause this?

    Dan

    Saturday, September 1, 2012 7:28 PM
  • Hi Dhoenig,

    Thank you for posting on this forum.

    Without testing, it is hard to say.

    So please try this way to verify it: http://windows.microsoft.com/en-US/windows-vista/Change-Data-Execution-Prevention-settings 

    Especially:

    To turn off DEP for an individual program

    • Select the check box next to the program that you want to turn off DEP for, and then click OK.

      If the program is not in the list, click Add. Browse to the Program Filesfolder, find the executable file for the program (it will have an .exe file extension), and then click Open.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, September 7, 2012 6:39 AM
    Moderator