The agent is up and running and then suddenly stops submitting jobs.
All jobs remain in status Generating in AWI and the Agents is no longer seen as connected.
The agent log shows something like this:
20220719/190004.111 - U02002050 Job 'JOBS.OS400.JOBNAME' with RunID '35011044' has been added to the internal job table.
20220719/190004.111 - U02000003 Job 'JOBS.OS400.JOBNAME' started with RunID '35011044'.
20220719/191806.692 - U00011486 FT '35011045': Unable to switch back to original security context from user context 'AUTOMIC'. Error: 'CPF22E7 - ProfileHandle is not valid. Cause . . . . . : The ProfileHandle specified when calling the Set Profile (QWTSETP) or Release ProfileHandle (QSYRLSPH) program was not valid. Either the ProfileHandle was not generated in the job, or had been previously released. Recovery . . . : Call the Get ProfileHandle (QSYGETPH) program to generate a ProfileHandle for the user profile. Then try the request again.
Release : 12.3.x and 21.x
Component : AS400 Agent
Defect: An issue has been fixed which caused the AS/400 Agent to report problems with Security handle (handle already closed) or remain in status THDW
Solution:
Update to a fix version listed below or a newer version if available.
Fix version:
Component(s): Agent AS400
Automation.Engine 12.3.9 HF1 (build 1668596316238) - Available
Automation.Engine 21.0.5 - Available