pipeline fails with unknown reason while executing python code time.sleep(n)

I configured a .gitlab-ci.yml in my project, the script it runs is a suit of python pytest test cases, I have a few cases that need to wait for 20 seconds to 600 seconds to see the result, and I use time.sleep(n) in the code. However, the pipeline will fails during time.sleep(n), some times the pipeline quit after waiting for 10 seconds, sometimes it fails after waiting for 580 seconds.

When it failed, the pipeline has been executing for not more than 15 minutes, I'm sure it nothing do to with timeout configuration.

And, the error is always "There is an unknown failure, please try again".

image.png

I've run it with gitlab-runner 17.10.2, gitlab-runner 17.9.3, Using Kubernetes executor with image python:3.12-bookworm or python:latest. Now I've no idea what I should do to overcome this failure. I have a limited knowledge of gitlab CI/CD.

Edited by yanyan