Repository navigation
Description
We first experienced the problem that websocket connections were closed down unexpectedly in Jenkins 2.361.1 LTS. The problem was reported in JENKINS-69509, and Jenkins 2.375 was released subsequently to address the issue. We tried Jenkins 2.375 and found the websocket problem still there. The websocket was closed down in less than 2 hours after the build started. Attached all the necessary logs
Reverted back to Jenkins 2.346.3 LTS is a workaround that works for us.
How to Reproduce
- Start Jenkins 2.361.x or later with -Djenkins.websocket.pingInterval=120
- Connect a Websocket agent
--> Notice that the websocket agent disconnect/reconnect at every ping
An interval of 120 is a way to consistently see the error. Though it should happen with any value > 30. It may happen with the default 30 but with a lower likelihood.
Originally reported by
gyu, imported from: WebSocketTimeoutException: Connection Idle Timeout
- assignee:
allan_burdajewicz
- status: Closed
- priority: Blocker
- component(s): core
- label(s): 2.387.2-fixed, remoting, websocket
- resolution: Fixed
- resolved: 2023-03-12T09:59:15+00:00
- votes: 13
- watchers: 25
- imported: 2025-11-24
Raw content of original issue
We first experienced the problem that websocket connections were closed down unexpectedly in Jenkins 2.361.1 LTS. The problem was reported in
JENKINS-69509, and Jenkins 2.375 was released subsequently to address the issue. We tried Jenkins 2.375 and found the websocket problem still there. The websocket was closed down in less than 2 hours after the build started. Attached all the necessary logsReverted back to Jenkins 2.346.3 LTS is a workaround that works for us.
How to Reproduce
- Start Jenkins 2.361.x or later with -Djenkins.websocket.pingInterval=120
- Connect a Websocket agent --> Notice that the websocket agent disconnect/reconnect at every ping
An interval of 120 is a way to consistently see the error. Though it should happen with any value > 30. It may happen with the default 30 but with a lower likelihood.
- environment:
Jenkins:2.361.1
15 attachments
- Agent logs httpKeepAliveTimeout=120000.log
- Agent logs.txt
- Agent sys info httpKeepAliveTimeout=120000.txt
- Agent sys info.txt
- Controller Log httpKeepAliveTimeout=120000.log
- Controller Sys info httpKeepAliveTimeout=120000.txt
- Controller logs.txt
- Controller sys info.txt
- Job build console httpKeepAliveTimeout=120000.log
- Job build console log.txt
- Screenshot from 2022-12-20 16-51-57.png
- Screenshot from 2022-12-22 13-26-21.png
- hudson.remoting-0.log.0
- jenkins.agents.WebSocketAgents-0.log.0
- org.jetty-0.log.0


Activity
jenkins-infra-bot commentedon Oct 26, 2022
Remote link associated with this issue:
jenkins-infra-bot commentedon Oct 26, 2022
basil:
Raw content of original comment:
Could you try running with the controller with --httpKeepAliveTimeout=120000 (or --httpsKeepAliveTimeout=120000)? I also notice your agents are running with an old version of Remoting (4.13.2); not likely to be related to this problem, but still worth upgrading to a more recent version.
jenkins-infra-bot commentedon Oct 26, 2022
Raw content of original comment:
Can not experiment it now as our jenkins server is in production mode. However, before I reverted our jenkins version, I did try "--httpKeepAliveTimeout=3600000 --sessionEviction=-1 --sessionTimeout=90000". Strangely, the disconnect happened in a few minutes instead of less than 2 hours. So with those settings the disconnect happened in minutes. Without those setting the disconnect happened in hours
jenkins-infra-bot commentedon Oct 26, 2022
basil:
Raw content of original comment:
Without logs from when you were running with those settings I cannot be of much help I am afraid.
jenkins-infra-bot commentedon Nov 2, 2022
Raw content of original comment:
Borrowed a new jenkins server and an agent, with Jenkins 2.375 installed, ran the job with the controller with --httpKeepAliveTimeout=120000 and the build terminated after 12min. Collected all logs, attached. The names of the five logs/system info all contain "httpKeepAliveTimeout=120000"
jenkins-infra-bot commentedon Nov 9, 2022
Raw content of original comment:
Face same issue, hope this can be fixed.
jenkins-infra-bot commentedon Nov 9, 2022
basil:
Raw content of original comment:
sbc8112 Have you tried increasing the timeout to two (2) minutes?
jenkins-infra-bot commentedon Nov 10, 2022
Raw content of original comment:
Hi basil ,
I have tried to update to v2.377 and add the --httpKeepAliveTimeout=120000 but the abnormal disconnect happened in hours. I will try to downgrade to v2.346 and check if this can help.
jenkins-infra-bot commentedon Nov 10, 2022
basil:
Raw content of original comment:
Downgrading to 2.346 is a dead end, as there is very little chance we would revert back to Jetty 9 at this point. The question is how can we get users onto a stable deployment pattern on Jetty 10. A very small number of users are affected by this problem, and I suspect if pings aren't making it through within 2 minutes that those users have other problems with networking and/or CPU saturation impacting networking. But ultimately this timeout is configurable, so there should be a guaranteed workaround for anyone affected: just set the timeout to an extremely high value (e.g. 86,400,000 milliseconds which is 24 hours).
jenkins-infra-bot commentedon Nov 11, 2022
jenkinsivo:
Raw content of original comment:
we have the same problem, the connection stops at some point and returns a "channel is already closed" message.
we have already tried to solve this on our own, in vain. It would be nice if this got a little more attention.
jenkins-infra-bot commentedon Nov 11, 2022
basil:
Raw content of original comment:
jenkinsivo It would be nice if you could read JENKINS-69955 (comment).
jenkins-infra-bot commentedon Nov 15, 2022
Raw content of original comment:
As same as gyu test, there is no connection issue on v2.346..
jenkins-infra-bot commentedon Nov 15, 2022
basil:
Raw content of original comment:
And same as my reply to George Yu, I have to reiterate that downgrading to 2.346 is an exercise in futility compared to applying the workaround I described previously.
jenkins-infra-bot commentedon Nov 15, 2022
jenkinsivo:
Raw content of original comment:
We have added the keepalive in the config yesterday to 30 seconds, but the error still occurs afterwards, so 86400000 is the next step. to be continued.
I'm not going to downgrade immediately, that's a version from May this year, then we're going very far back in time.
jenkins-infra-bot commentedon Nov 17, 2022
jenkinsivo:
Raw content of original comment:
the keepalive is set to 86400000 but it looks like the issue still occurs unfortunately. any other suggestions? we prefer not to downgrade basil
16 remaining items
jenkins-infra-bot commentedon Feb 22, 2023
Raw content of original comment:
really possible reason. Jetty have a default IdleTime out 30s.
websocket is sending ping per default every 30s. (see https://github.com/jenkinsci/jenkins/blob/a3f31145e621ab0072bb872ecac93a2c6cbcbaae/core/src/main/java/jenkins/websocket/WebSocketSession.java#L58)
so yup this ping can work or not work by a matter of few milliseconds (in this logs it's 3ms) it depends on the network and if you are lucky or not
possible workaround start jenkins master with
ping delay will be shorter than Jetty idle timeout.
Change the configuration of Jetty websocket container to have a larger per default idle timeout.
can be done around here
jenkins/websocket/jetty10/src/main/java/jenkins/websocket/Jetty10Provider.java
Line 55 in a3f3114
with something such
Javadoc from here https://github.com/eclipse/jetty.project/blob/b7075161d015ddce23fbf3db873d5f6b539f6a6b/jetty-io/src/main/java/org/eclipse/jetty/io/IdleTimeout.java#L29
so if nothing happen during 30s in the established websocket connection....
jenkins-infra-bot commentedon Feb 22, 2023
Raw content of original comment:
I can definitely reproduce with 2.361.1 by adjusting the websocket ping interval. And I can't reproduce with 2.346.4.
Updated the description with a reproduction scenario.
IIUC the previous websocket timeout was 5 minutes. Set by the WebsocketPolicy at https://github.com/eclipse/jetty.project/blob/jetty-9.4.48.v20220622/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/WebSocketPolicy.java#L81-L86
jenkins-infra-bot commentedon Feb 28, 2023
leminhhung0110:
Raw content of original comment:
allan_burdajewicz Hi Allan, could you have some updates or workaround on this issue?
Currently, i'm using Jenkins 2.375.1 and due to some reason I could not rollback to jenkins 2.346.3 LTS as suggestion above.
jenkins-infra-bot commentedon Feb 28, 2023
Raw content of original comment:
leminhhung0110 this a PR ready. Currently you can use the workaround
-Djenkins.websocket.pingInterval=15
or even less
jenkins-infra-bot commentedon Feb 28, 2023
leminhhung0110:
Raw content of original comment:
olamy do you meant i will use this command when starting jenkins master "jenkins restart -Djenkins.websocket.pingInterval=15"?
jenkins-infra-bot commentedon Mar 1, 2023
Raw content of original comment:
leminhhung0110 I have no idea what your script called jenkins is doing
but Jenkins need to be started with the system property.
jenkins-infra-bot commentedon Nov 24, 2025
[Original
relates_tofrom Jira: JENKINS-70697]