'"ssh-agent -s" process hanging after finishing GitLab runner stage

how can I find out the rule how "ssh-agent -s" uses PID numbers. In my CI/CD pipeline, there is a job which is called in multiple stages. ssh-agent in one stage uses PID 16 and kill him self at the end of stage. In another stage ssh-agent uses some 5 digit number PID, and it hangs at the end of stage, so i need to run ssh-agent -k. In first stage I get the error that PID 16 do not exists when I run ssh-agent -k.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source