We made good experience with using the binary wrapper instead of using the shell wrapper that is normally used.
We had this problem in our pipelines when the machines were under high load.
To enable the binary wrapper add the following to the java start arguments:
-Dorg.jenkinsci.plugins.durabletask.BourneShellScript.USE_BINARY_WRAPPER=true