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

Fix WebSocketClient.connect() hang when attempting to connect at an invalid websocket endpoint #2875

Closed
coudy opened this issue Aug 31, 2018 · 2 comments
Assignees
Labels
Bug For general bugs on Jetty side

Comments

@coudy
Copy link

coudy commented Aug 31, 2018

I’ve been using the web socket client for a while and recently noticed that the session future doesn’t always complete on connect(). Specifically, this happens when I accidentally use ‘ws://' instead of ‘wss://', so the upgrade fails with my server responding with a 301 (and a Location rewritten to HTTPS). My code looks as follows:

var client = new WebSocketClient();
client.start();
var request = new ClientUpgradeRequest();
var sessionFuture = client.connect(delegate, serviceUri, request);
var session = sessionFuture.get();

I’d expect session to be isDone() and throw an ExecutionException. Instead, the blocking get hangs forever.

I can reproduce this on 9.4.12.RC2 from Maven Central.

@joakime joakime self-assigned this Sep 11, 2018
@joakime
Copy link
Contributor

joakime commented Sep 12, 2018

I think I've been able to reproduce.

joakime added a commit that referenced this issue Sep 12, 2018
+ Using HttpClient fixes from #2901 to allow upgrader to be
  held for entire conversation regardless of authentication
  or redirect behaviors.

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
@joakime joakime added the Bug For general bugs on Jetty side label Sep 12, 2018
@joakime
Copy link
Contributor

joakime commented Sep 12, 2018

See PR #2902
Branch jetty-9.4.x-issue-2875-websocketclient-redirect has proposed fix.

joakime added a commit that referenced this issue Sep 12, 2018
+ Using HttpClient fixes from #2901 to allow upgrader to be
  held for entire conversation regardless of authentication
  or redirect behaviors.

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
@coudy coudy closed this as completed Sep 14, 2018
joakime added a commit that referenced this issue Sep 20, 2018
…tclient-redirect

Issues #2875 and #2901 WebSocketClient Redirected Upgrade
@joakime joakime changed the title WebSocketClient.connect() hangs for invalid endpoint Fix WebSocketClient.connect() hang when attempting to connect at an invalid websocket endpoint Nov 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For general bugs on Jetty side
Projects
None yet
Development

No branches or pull requests

2 participants