Cyclic jobs required, but cause issues

Details

Description

We have a specific use case where we wait for a number of possible actions that can occur. We take care of this using cyclic jobs.

So we can have: CheckJob1 --> CheckJob2 --> CheckJob3 --> CheckJob4 --> Back to 'CheckJob1'

If one of the 4 jobs is successful, it triggers a number of different jobs (thanks to parametrized trigger). If not, they keep cycling.

However, this is causing issues for us: we get Java errors in those jobs (see attachment), referring to a stackoverflow.
I tried to limit the number of jobs that are kept (20 for each job), but that doesn't seem to work, because of the dependencies. It looks like all of the jobs are kept, instead of just the last 20.

Currently, we can work around this by making one of the jobs call the next with wget instead of a regular trigger. However, that's not a very clean solution.