0

TwinCAT crashes every now and then with the following message in the eventlog Debug: CSysService::SysUnhandledExceptionFilter(); Addr:770A2092 Code:C0000005

Search on Google reveals nothing about why this is happening, how to troubleshoot this or even what CSysService is or what the SysUnhandledExceptionFilter method is doing. My guess is that an access violation is happening which is unhandled.

I'm hoping that someone here can help me determine if this is caused by our own code or if this is a problem of TwinCAT itself. And hopefully get some pointers on how to get this resolved.

I tried reproducing this by creating an access violation in code. This however shows a different log message.

3 Answers3

0

You are providing too few informations.

Which Twincat version are you using? Does it crash while doing some specific operations (For example pressing a button in the visualization or while doing online change)? How often does it crash?And since when?

Filippo Boido
  • 1,136
  • 7
  • 11
  • Try to insert the system check functions in your project (CheckBounds, CheckDivReal etc and on Twincat 3 also CheckPointer) – Filippo Boido Jul 18 '19 at 05:48
0

We are using TwinCAT 3.1.4022.28. The crashes don't seem to be related to a use case. At one point it crashed during the night while nobody was operating it. It crashes at random intervals, typically multiple days apart. We have seen about 4 to 5 crashes till now.

  • Do you have temporary licenses in your project?Which Twincat Functions are you using? Did you insert the system check functions as suggested in the last answer? – Filippo Boido Jul 22 '19 at 17:23
  • Arend, any news? – Filippo Boido Aug 01 '19 at 14:36
  • Hi Filippo, sorry for taking so long to reply. I didn't have a chance to insert the system check function because the system was heavily being used. Now that I have the chance I see that the system hasn't rebooted in weeks. It appears that the problem has magically disappeared without changes in Twincat or the PLC code. – Arend van Putten Aug 21 '19 at 13:53
0

On codeguru.com there is an article about the CSysService class and it states:

CSysService is a C++ class which wraps methods around several of the Win32. API service functions, providing an object-oriented interface to these functions, grouping common variables and structures in a single class object. The result is an extensible base class capable of installing, enumerating, modifying, controlling and removing a service application in the Service Control Manager.

It means it is an Exception raised by the Win32 API. On the Beckhoff infosys website you can find the Win32 error codes and their meaning:

https://infosys.beckhoff.com/index.php?content=../content/1031/TcDiagnostics/HTML/TcDiagnostics_WIN32_ErrorCodes.htm&id=

The 0x00000005 error means access denied. If you take a look at this error on the microsoft support page:

https://support.microsoft.com/en-us/help/842792/an-error-access-denied-error-occurs-when-you-try-to-write-to-a-file-th

you will find out that this error happens when:

you try to write to a file that is in a network shared folder

Your plc is probably trying to write a logfile located in a network shared folder to which it may not always have access to, causing the runtime to crash unexpectedly.

(A network maintenance during the night could explain the access denial and the consequent exception on your machine).

If this is the cause of the problem, please inform the Beckhoff support so that they can investigate it further and maybe fix it in a future release.

Filippo Boido
  • 1,136
  • 7
  • 11
  • Thank you for your reply. The error code however is not 00000005 but C0000005 which is a memory access violation. – Arend van Putten Aug 23 '19 at 06:56
  • Ok good, now you know where it is coming from. You should go ahead with the system check functions even if the problem disappeared for now because eventually it will happen again..Remember to close this question, cheers. – Filippo Boido Aug 23 '19 at 07:15