You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
WebSocketImpl.isOpen() returns true if the socket is open and false otherwise.
Current Behavior
Calling isOpen() on a websocket causes and AssertionError. Here is the assertion causing it: assert ( getReadyState() != READYSTATE.OPEN || !flushandclosestate )
It is not entirely clear why such a method would ever throw an exception. There are 2 possible stacktraces which appear randomly:
Exception in thread "WebSocketSelector-15" java.lang.AssertionError
at org.java_websocket.WebSocketImpl.isOpen(WebSocketImpl.java:720)
at com.mypackage.ClientConnection.send(ClientConnection.java:130)
[Bussiness logic frames here...]
at com.mypackage.Cluster.onClose(Cluster.java:114)
at org.java_websocket.server.WebSocketServer.onWebsocketClose(WebSocketServer.java:595)
at org.java_websocket.WebSocketImpl.closeConnection(WebSocketImpl.java:504)
at org.java_websocket.WebSocketImpl.closeConnection(WebSocketImpl.java:522)
at org.java_websocket.SocketChannelIOHelper.batch(SocketChannelIOHelper.java:99)
at org.java_websocket.server.WebSocketServer.run(WebSocketServer.java:428)
at java.base/java.lang.Thread.run(Thread.java:844)
Uncaught exception in thread "WebSocketWorker-14":java.lang.AssertionError
at org.java_websocket.WebSocketImpl.decode(WebSocketImpl.java:225)
at org.java_websocket.server.WebSocketServer$WebSocketWorker.run(WebSocketServer.java:906)
Steps to Reproduce (for bugs)
I'll make a minimal program to reproduce it and other info unless it turns out to be a mistake from my own code. The bug is hard to reproduce reliably.
Here is a brief outline of how I get the bug:
final Cluster cluster = new Cluster(20); // subclass of WebSocketServer
final int clientCount = 20;
Executor executor = Executors.newCachedThreadPool();
cluster.start();
for (int i = 0; i < 10; i++) {
int port = cluster.getPort();
Collection<MockClient> clients = Stream.generate(() -> new MockClient(port))
.limit(clientCount)
.collect(Collectors.toCollection(() -> new ArrayList<>(clientCount)));
clients.forEach(executor::execute);
sleep(2000);
clients.forEach(WebSocketClient::close);
sleep(2000);
}
The text was updated successfully, but these errors were encountered:
Expected Behavior
WebSocketImpl.isOpen() returns true if the socket is open and false otherwise.
Current Behavior
Calling isOpen() on a websocket causes and AssertionError. Here is the assertion causing it:
assert ( getReadyState() != READYSTATE.OPEN || !flushandclosestate )
It is not entirely clear why such a method would ever throw an exception. There are 2 possible stacktraces which appear randomly:
Steps to Reproduce (for bugs)
I'll make a minimal program to reproduce it and other info unless it turns out to be a mistake from my own code. The bug is hard to reproduce reliably.
Here is a brief outline of how I get the bug:
The text was updated successfully, but these errors were encountered: