When a Workflow instance is started that executes a REST Endpoint SmartObject, the K2 Hostserver Service may crash. When restarting the K2 Hostserver Service, it will continue to crash every time on start-up.
When the K2 Hostserver Service crashes, the following message will be logged in the Windows Event Viewer - Application Log:
Faulting application name: K2HostServer.exe, version: 0.0.0.0, time stamp: 0x584fcf3a
Faulting module name: unknown, version: 0.0.0.0, time stamp: 0x00000000
Exception code: 0xc00000fd
Fault offset: 0x00007ff7ae076aef
Faulting process id: 0x9bc
Faulting application start time: 0x01d3e8342551298b
Faulting application path: D:\Program Files (x86)\K2 blackpearl\Host Server\Bin\K2HostServer.exe
Faulting module path: unknown
Report Id: 65d9a510-5427-11e8-80f9-005056012b1a
Faulting package full name:
Faulting package-relative application ID:
When starting the K2 Hostserver in Console mode, the following message will be displayed:
Process is terminated due to StackOverflowException
Shortly after, the K2 Hostserver Console will close.
The issue appears to be caused by an exception that occurs in the external REST endpoint referenced by a SmartObject. This causes a StackOverflowException to occur in the SmartObject causing the K2 Hostserver to crash. Because the Workflow Instance was in a running state when the first crash occurs, each time the Hostserver starts up the Workflow instance will execute the SmartObject again causing another crash.
To recover the K2 Environment, the Process Instance will need to be disabled in the K2 Database to stop the SmartObject from being executed each time the Hostserver starts up.
To achieve this, direct Database modification will be required. Please log a K2 Support Ticket on the K2 Customer Portal for assistance in resolving the issue, referencing this KB Article.
Please Note that direct K2 Database modification is not allowed as it might leave the environment in an unsupported state. This must only be done with the assistance of, or when instructed to do so by K2 Support.
To fully resolve this issue, the External REST service will need to be reviewed and rectified to ensure no exceptions occur in the Endpoint that can cause the issue to occur again.
A good way to test that this issue will not occur is to execute any newly created REST Endpoint SmartObject using the SmartObject Tester Tool. Should there be an issue, the K2 Hostserver will still crash, but it can be succesfully restarted as no Workflow Instance will exist to execute the SmartObject again.