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

Prototype of rewrite of CLI to not use Tyrus #9688

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

jglick
Copy link
Member

@jglick jglick commented Sep 4, 2024

Amending #9591 and #9687. FTR

java.lang.AssertionError: 

Expected: (a string containing "status code 401" and a string containing "Server: Jetty")
     but: a string containing "status code 401" was "io.jenkins.cli.shaded.jakarta.websocket.DeploymentException: Handshake error.
	at io.jenkins.cli.shaded.org.glassfish.tyrus.client.exception.Exceptions.deploymentException(Exceptions.java:40)
	at io.jenkins.cli.shaded.org.glassfish.tyrus.client.ClientManager$3$1.run(ClientManager.java:622)
	at io.jenkins.cli.shaded.org.glassfish.tyrus.client.ClientManager$3.run(ClientManager.java:657)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at io.jenkins.cli.shaded.org.glassfish.tyrus.client.ClientManager$SameThreadExecutorService.execute(ClientManager.java:810)
	at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:123)
	at io.jenkins.cli.shaded.org.glassfish.tyrus.client.ClientManager.connectToServer(ClientManager.java:460)
	at io.jenkins.cli.shaded.org.glassfish.tyrus.client.ClientManager.lambda$connectToServer$2(ClientManager.java:313)
	at io.jenkins.cli.shaded.org.glassfish.tyrus.client.ClientManager.tryCatchInterruptedExecutionEx(ClientManager.java:324)
	at io.jenkins.cli.shaded.org.glassfish.tyrus.client.ClientManager.connectToServer(ClientManager.java:313)
	at hudson.cli.CLI.webSocketConnection(CLI.java:370)
	at hudson.cli.CLI._main(CLI.java:315)
	at hudson.cli.CLI.main(CLI.java:103)
Caused by: java.lang.NullPointerException: Cannot invoke "io.jenkins.cli.shaded.org.glassfish.tyrus.spi.UpgradeRequest.getRequestURI()" because "upgradeRequest" is null
	at io.jenkins.cli.shaded.org.glassfish.tyrus.container.jdk.client.JdkClientContainer$1.call(JdkClientContainer.java:119)
	at io.jenkins.cli.shaded.org.glassfish.tyrus.container.jdk.client.JdkClientContainer$1.call(JdkClientContainer.java:108)
	at io.jenkins.cli.shaded.org.glassfish.tyrus.container.jdk.client.ClientFilter.processRead(ClientFilter.java:183)
	at io.jenkins.cli.shaded.org.glassfish.tyrus.container.jdk.client.Filter.onRead(Filter.java:111)
	at io.jenkins.cli.shaded.org.glassfish.tyrus.container.jdk.client.Filter.onRead(Filter.java:113)
	at io.jenkins.cli.shaded.org.glassfish.tyrus.container.jdk.client.Filter.onRead(Filter.java:113)
	at io.jenkins.cli.shaded.org.glassfish.tyrus.container.jdk.client.TransportFilter$4.completed(TransportFilter.java:295)
	at io.jenkins.cli.shaded.org.glassfish.tyrus.container.jdk.client.TransportFilter$4.completed(TransportFilter.java:279)
	at java.base/sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:129)
	at java.base/sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:284)
	at java.base/sun.nio.ch.WindowsAsynchronousSocketChannelImpl$ReadTask.completed(WindowsAsynchronousSocketChannelImpl.java:586)
	at java.base/sun.nio.ch.Iocp$EventHandlerTask.run(Iocp.java:387)
	at java.base/sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:113)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:840)
"
	at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
	at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:6)
	at hudson.cli.CLIActionTest.authenticationFailed(CLIActionTest.java:147)

and now I see this too on Linux the first time I try.

I think this is a Tyrus bug. I actually saw the same NPE reproducibly with my initial attempt at a fix, calling HandshakeResponse.getHeaders from inside afterResponse. I thought I had isolated the cause to capture of local variables from the Configurator but apparently it was something else, maybe a race condition. Probably makes sense to switch to the JDK’s client rather than waste more time on Tyrus; easy enough without TLS but would take a bit more work to test noCertificateCheck.

Testing done

None so far beyond the one automated test.

Proposed changelog entries

  • TODO

Before the changes are marked as ready-for-merge:

Maintainer checklist

@jglick jglick marked this pull request as draft September 4, 2024 12:52
jglick and others added 2 commits November 12, 2024 15:01
Co-authored-by: Tim Jacomb <21194782+timja@users.noreply.github.com>
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.

3 participants