Mondtic / build-jenkins-job

3 stars 9 forks source link

504 Gateway timeout #9

Open MrVinceZ opened 4 months ago

MrVinceZ commented 4 months ago

Hello,

I have a problem that rarely happens and I still can't find an exact reproduction.

When I launch a lot of jobs with my workflows, I notice that from time to time there is a gateway timeout that shows a false negative. My jenkins continues to run without any problem.

I don't notice any connection or network stability problems on the Jenkins side.

I have the impression that the problem occurs at the end of jobs when there are a lot of logs to report all at once.

Here's the callstack for one of my errors:

`Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/jenkins/init.py", line 1659, in get_build_console_output response = self.jenkins_open(requests.Request( File "/usr/local/lib/python3.8/site-packages/jenkins/init.py", line 557, in jenkins_open return self.jenkins_request(req, add_crumb, resolve_auth).text File "/usr/local/lib/python3.8/site-packages/jenkins/init.py", line 575, in jenkins_request return self._response_handler( File "/usr/local/lib/python3.8/site-packages/jenkins/init.py", line 536, in _response_handler response.raise_for_status() File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 943, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 504 Server Error: Gateway Time-out for url: ***job/MyJob/392/consoleText

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/build_job.py", line 49, in while not (status := finder.exec(build_number)): File "/src/apps/Jenkins/Application/Find/BuildFinder.py", line 13, in exec consoleLines = self.repository.get_build_console_output(self.name, number).split("\n") File "/src/apps/Jenkins/Infrastructure/ServerJenkinsRepository.py", line 41, in get_build_console_output return self.__connection.get_build_console_output(name, number) File "/usr/local/lib/python3.8/site-packages/jenkins/init.py", line 1668, in get_build_console_output raise JenkinsException('job[%s] number[%d] does not exist' jenkins.JenkinsException: job[MyJob] number[392] does not exist`

Would increasing the timeout help mitigate the problem?

Thanks for your time

MrVinceZ commented 2 months ago

Hello, any info on this one ? The issue is still occuring randomly

EDIT : After a little research (https://github.com/pycontribs/jenkinsapi/issues/767) there is now a timeout parameter that can be set when building the Jenkins object.

J = Jenkins(url, user_id, api_token, timeout=180)