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

[JEP-222] WebSocket-based agents #357

Merged
merged 39 commits into from
Jan 14, 2020
Merged

Conversation

jglick
Copy link
Member

@jglick jglick commented Nov 22, 2019

See JEP-222.

Copy link
Contributor

@jeffret-b jeffret-b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a good start. It's nice to see that we should be able to insert this pretty cleanly, without much disruption.

@jglick jglick changed the title WebSocket-based agents [JEP-222] WebSocket-based agents Dec 9, 2019
pom.xml Outdated Show resolved Hide resolved
@jglick jglick marked this pull request as ready for review December 21, 2019 03:51
@jeffret-b
Copy link
Contributor

Do we want to have a way of disabling WebSocket connectivity?

You mean on the master side? I see no particular reason to offer such an option. What would be the purpose?

People seem to really like being able to control connectivity, particularly for complex things like agents, from a single, central location. I'm not sure that's a real requirement, though. Will there be some use case or scenario in which that capability is required? I'm not coming up with one -- it's probably best to not bother until we identify the need.

@jglick
Copy link
Member Author

jglick commented Jan 3, 2020

being able to control connectivity

Well we offer controls about listening on ports, for good reason. But -webSocket agents are not using a different port, just the usual Jenkins HTTP(S) URL, and if no connection is made to this URI then there is no difference in behavior. So it seems harmless to enable it unconditionally (rather, whenever using the built-in Jetty).

Copy link
Contributor

@jeffret-b jeffret-b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. I've got some minor suggestions or requests for clarification.

I need to get a chance to do a little testing on it again.

docs/protocols.md Show resolved Hide resolved
src/main/java/hudson/remoting/Capability.java Outdated Show resolved Hide resolved
src/main/java/hudson/remoting/Engine.java Outdated Show resolved Hide resolved
src/main/java/hudson/remoting/Engine.java Outdated Show resolved Hide resolved
src/main/java/hudson/remoting/Engine.java Outdated Show resolved Hide resolved
src/main/java/hudson/remoting/Engine.java Outdated Show resolved Hide resolved
src/main/java/hudson/remoting/jnlp/Main.java Outdated Show resolved Hide resolved
src/main/java/hudson/remoting/jnlp/Main.java Outdated Show resolved Hide resolved
Copy link
Contributor

@jeffret-b jeffret-b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks nice. Everything is in good shape and this will make for a great addition to the agent capabilities.

The code all looks good. I've reviewed the latest changes.

I've tested the capabilities with agents. Things behave fine. My testing has been mostly happy-path. I've tested out some conflicting or incorrect parameters but I've only tested on a reliable network with straightforward configurations and use. I haven't done any robustness testing. I haven't tested the reconnect capabilities.

@jeffret-b
Copy link
Contributor

We should probably wait a day or two to see if anyone else wants to review but after that I'm satisfied that we can merge this and release it whenever we want.

Copy link
Member

@oleg-nenashev oleg-nenashev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good overall, just comments about better rollout (beta feature, 4.0).

I have not checked the code in runtime, but it might make sense that the WebSocket mode works well with thread UnhandledException failover for NIo threads in JNLP4. Can be just verified by looking at the list of running threads in the websocket mode

docs/inbound-agent.md Show resolved Hide resolved
docs/protocols.md Show resolved Hide resolved
pom.xml Show resolved Hide resolved
@jglick
Copy link
Member Author

jglick commented Jan 14, 2020

the WebSocket mode works well with thread UnhandledException failover for NIo threads in JNLP4

Not sure what you are saying.

@jglick
Copy link
Member Author

jglick commented Jan 14, 2020

4.0

This was suggested for the removal of the deprecated protocols, but too late. I have no strong opinion, and anyway consider the version numbers in this repository to be more or less meaningless—it is just a bundled component of Jenkins. Will leave it to @jeffret-b to decide this sort of thing.

@jeffret-b
Copy link
Contributor

The version numbers here really are mostly meaningless. It's a bundled Jenkins component. It's recommended to keep agent versions current with the server. There have been bigger user-facing changes in the past that haven't rolled the major version, such as upgrading Java versions or the deprecation of the older protocols. Changing the minimum version for the server is a bigger breaking change. If this were a generic library incorporated into other tools, it would make sense to follow semver. I'll go ahead and update it to 4.x, though. (It kind of looks like we update for adding major new functionality but not for breaking dependencies or changes.)

@jeffret-b
Copy link
Contributor

I have been planning to release this later today if I don't get distracted with something else. @oleg-nenashev, if you want to clarify your comment about "UnhandledException failover for NIo threads" I can delay. Especially since you've approved, it seems like that could be handled in a follow-on if we discover something needed there.

@jeffret-b jeffret-b added ready-to-merge major-rfe For changelog: Major enhancement. Will be highlighted on the top labels Jan 14, 2020
@jeffret-b jeffret-b merged commit c238b7c into jenkinsci:master Jan 14, 2020
@jglick jglick deleted the websocket branch January 14, 2020 22:30
jglick added a commit to jglick/jenkins that referenced this pull request Jan 14, 2020
oleg-nenashev pushed a commit to jenkinsci/jenkins that referenced this pull request Jan 21, 2020
* Playing with WebSocket connections.

* Pluggable handlers.

* errorWithoutStack

* Server-side keepalive pings.

* Redesigned to work as an HttpResponse.

* Unused dep.

* Comment on JnlpSlaveRestarterInstaller.

* Sketch of WebSocket-based endpoint for JNLPLauncher.

* Comment.

* Test enhancement.

* Making it more obvious from JNLPLauncherTest where remoting.jar is being loaded from.

* Reworked protocol to negotiate remote capabilities.

* Unhelpful comment.

* Simplifying handshake to use HTTP headers.

* Moving code into top-level classes and otherwise prettifying.

* Linking to upstream PRs.

* Timestamped snapshot + incremental.

* Picking up incrementalified build of winstone.

* Working around jenkinsci/lib-access-modifier#17.

* Finally have an incrementalified build of remoting.

* Use -webSocket option.

* Handling some close and error methods.

* Sending X-Remoting-Minimum-Version.

* If hudson.remoting.jnlp.Main._main fails, show the error.

* Comment.

* GUI analogue of jenkinsci/remoting@86cea5b.

* Missing since tags.

* Capitalization.

* WebSockets.isSupported

* Rather than hiding JNLPLauncher.DescriptorImpl when the TCP port is disabled, always display it, but show form validation appropriate to WebSocket or TCP mode.

* Form validation fixes.

* Minor test improvements.

* Reworked WebSocketAgents to be compatible with JnlpAgentReceiver.

* Removing WebSocketSession.keepAlive in favor of a global setting applicable to all services.

* Add a -webSocket option to the Jenkins CLI.

* Using a snapshot deployment of Remoting, pending INFRA-2379.

* After #3838 there is no reason to recheck authentication after parsing CLICommand arguments.

* Advertise the -webSocket option.

* Adapt to newer HtmlUnit.

* HtmlUnit/htmlunit#29 seems to have been incompatible.
WebClient.addRequestHeader will no longer override a header in a WebRequest,
such as when the same WebClient/WebRequest was previously used with different headers.

* Tracked down a behavioral change in passing through URL-encoded path characters.
HtmlUnit/htmlunit@2c49568 picks up
apache/httpcomponents-client@8c04c6a which is the actual change.

* Disabled TCP port does not matter in WebSocket mode.

* Shade dependencies needed for jenkins-cli.jar.

* Help text edit.

* jenkinsci/winstone#79 was released as 5.5.

* jenkinsci/jenkins-test-harness#183 released as 2.59.

* #4387 (comment)

* Bumping remoting to a new deployed snapshot.

* Need jenkinsci/winstone#86.

* jenkinsci/winstone#86 released as 5.6.

* Introduced constant for X-Remoting-Minimum-Version.

* s/slave/agent/ in GUI

* Removing in-JVM test, as it was no longer useful after introducing shading anyway.

* Bump.

* No need to check for anonymous CONNECT here.

* s/jenkins.slaves/jenkins.agents/g for new code.

* Restrict the diagnostic endpoint to administrators.

* Fixed Javadoc import after package move.

* jenkinsci/remoting#357 released as 4.0.
@Asgoret
Copy link

Asgoret commented Mar 5, 2020

@jglick @oleg-nenashev @jeffret-b Hi!
I catch some error vie WebSocket connection, that slave tried to send a binary message more than 64Kib (actual about 98Kib in my case) and I didn't find any exposed configures for a max binary message size for WebSocket connection. 64Kib is a RFC 6455 standard. Can you help with it plz?

@jglick
Copy link
Member Author

jglick commented Mar 5, 2020

@Asgoret file an issue in JIRA with steps to reproduce.

@Asgoret
Copy link

Asgoret commented Mar 6, 2020

@jglick and what's the link to the jira?

@jglick
Copy link
Member Author

jglick commented Mar 6, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
major-rfe For changelog: Major enhancement. Will be highlighted on the top ready-to-merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants