When Jenkins Job is terminated/aborted, Google chrome and Chrome driver is not closing and due to this workspace is also not deleted


Using Jenkins 2.289.1 and the Source code is in Azure Dev ops GIT repo. Jenkins Jobs are created and Running fine when script pass or fail with some issues. But when these Jobs are terminated/Aborted the chrome driver instance running on slaves doesn’t close, it still keep running under Task manager. Due to this, Jenkins Job workspace is not getting deleted. Any solution for this other than login on Windows Jenkins agent server and delete the chrome driver process from Task manager.

As a work round, we are killing chrome driver from task manager. However, my expectation is that chrome driver should be closed automatically.

Also tried with adding Post Build step in Jenkins Job: Added a post-build step to explicitly close the ChromeDriver instance by executing a command to terminate the ChromeDriver process. Added Post Build step “Execute Windows batch command” with Command taskkill /F /IM chromedriver.exe