Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent Jenkins hang with unresponsive web servers #7

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

rhayes-cida
Copy link

Existing code can stall the build if it encounters an unresponsive web server (one that allows a connection, but stalls rather than producing a response). We've had to restart Jenkins to clear the stalled builds.

This proposed change does a couple of things to prevent this problem:

  • Add a read timeout to the URL connection
  • Run the URL check in a separate thread, with a timeout when getting the response

Added call to future.cancel to try to stop the thread that's waiting for
output; however, IT DOES NOT cancel the read.

The result is that, for a badly-behaved server, each poll consumes one
thread, making it uncancellable. Not acceptable.
@buildhive
Copy link

Jenkins » sitemonitor-plugin #14 FAILURE
Looks like there's a problem with this pull request
(what's this?)

@jenkinsadmin
Copy link
Member

Thank you for a pull request! Please check this document for how the Jenkins project handles pull requests

@buildhive
Copy link

Jenkins » sitemonitor-plugin #15 FAILURE
Looks like there's a problem with this pull request
(what's this?)

Conflicts:
	pom.xml
	src/main/java/hudson/plugins/sitemonitor/SiteMonitorRecorder.java
@buildhive
Copy link

Jenkins » sitemonitor-plugin #16 SUCCESS
This pull request looks good
(what's this?)

@medington
Copy link

What is the status of this pull request? I'm running into a situation that would seem will be fixed by this. If there is something wrong with the pull request I'll be more than happy to fix it.

[JENKINS-13358] appears to be an existing issue that would relate to this pull request.

@medington
Copy link

Update: I ran into an issue with this pull request. After running the project one time, I would get an error attempting to save the project configuration after changing a setting. Restarting Jenkins seemed to work around the error but I believe there is some sort of a serialization incompatibility with this change.

I also found that patching the existing master branch with just the change to call connection.setReadTimeout also fixes the issue without restoring to using async validation of the URL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants