Process 122 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION

Iain Barnetson 106 Reputation points
2023-01-02T21:22:09.657+00:00

The error occurrs when a query is run via a front end application and a dump is done of the spid. In each case, the same query is recorded in the dump file but if I run the query via ssms bypassing the application front end, both using my creds or as the user, the query runs successfully.
Any ideas on what the cause might be or how I can dig some more?

  • Exception Address = 00007FFD81C1C513 Module(sqllang+000000000000C513)
  • Exception Code = c0000005 EXCEPTION_ACCESS_VIOLATION
  • Access Violation occurred reading address 0000000000000000

The query is:

SELECT P.value('.[1]',' varchar(2048)') AS rtnVal
FROM(
SELECT CAST(ProcessSettings AS XML) AS ProcessSettings
FROM aaMasProcess P
WHERE ProcessTID = 1584151
)X
CROSS APPLY ProcessSettings.nodes('/BankEDIFile/Settings/RevEDIChkTot')
T(P)

SQL Server | Other
{count} vote

3 answers

Sort by: Most helpful
  1. Erland Sommarskog 121.4K Reputation points MVP Volunteer Moderator
    2023-01-02T22:08:12.357+00:00

    This type of crashes are almost always a token of a bug into SQL Server. And when they are not, there is corruption. They are never the direct result of a user error. (They can be an indirect result, if you write something illegal which SQL Server does not handle correctly.)

    As Viorel says, make sure that you installed the most recent Cumulative Update for the SQL Server version you are running.

    The fact that it crashes from the application but not from SSMS, suggests that the crash is plan-dependent. That is, the error occurs during the execution of the query, only if you have a certain operation in the plan. Because of a difference in defaults, you typically get different cache entries for queries from the application and from SSMS. And possibly also different plans.

    If you want the application going right now, you can try this:

       EXEC sp_recompile aaMasProcess  
    

    This will mark all plans related to this table for recompilation, and if you are lucky, the application will no longer cause crashes. However, they may come back on a later point in time, so there is all reason to review the contents of @@version.

    2 people found this answer helpful.

  2. Seeya Xi-MSFT 16,586 Reputation points
    2023-01-03T06:47:59.26+00:00

    Hi @Iain Barnetson ,

    Strongly agree with installing the latest patch first, which may solve your problem.
    It is a good idea open the dump file to get a good idea of what is going on.
    Here is a related thread: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/1b8a96de-a7b9-4ffb-87ea-433adc3d0ed7/error-process-ltspidgt-generated-fatal-exception-c0000005-exceptionaccessviolation?forum=sqldatabaseengine
    According to EXCEPTION_ACCESS_VIOLATION, it means that code inside of SQL Server tried to access "invalid" memory. You can run DBCC CHECKDB to check if the database has been corrupted.

    Best regards,
    Seeya


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  3. Iain Barnetson 106 Reputation points
    2023-01-03T18:38:06.357+00:00

    I'd like to thank all that responded, thank you.
    MS basically said the same as y'all, apply latest CU.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.