Skip to content
Snippets Groups Projects
Commit 387af536 authored by Clément Pit-Claudel's avatar Clément Pit-Claudel
Browse files

server: Rewrite the websocket server using undertow instead of cask

While the previous commit solves the issue of improperly closed channels staying
around forever, a dropped connection still logs one error message with its stack
trace (this is the default behavior of cask actors).  With this commits, we:

- Forward send and receive errors to the user-supplied callback.
- Correctly handle the error that appeared as a stack trace in 8a6361a4.
- Answer ping messages with a pong.

Together with the previous commit, this allows us to avoid infinitely growing
traces full of this message:

```
[error] java.io.IOException: UT002027: Could not send data, as the underlying web socket connection has been broken
[error] 	at io.undertow.websockets.core.WebSocketChannel.send(WebSocketChannel.java:357)
[error] 	at io.undertow.websockets.core.WebSockets.sendBlockingInternal(WebSockets.java:992)
[error] 	at io.undertow.websockets.core.WebSockets.sendBlockingInternal(WebSockets.java:986)
[error] 	at io.undertow.websockets.core.WebSockets.sendTextBlocking(WebSockets.java:200)
[error] 	at cask.endpoints.WsChannelActor.run(WebSocketEndpoint.scala:81)
[error] 	at cask.endpoints.WsChannelActor.run(WebSocketEndpoint.scala:80)
[error] 	at castor.SimpleActor.runBatch0$$anonfun$5(Actors.scala:71)
[error] 	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] 	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] 	at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:619)
[error] 	at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:617)
[error] 	at scala.collection.AbstractIterable.foreach(Iterable.scala:935)
[error] 	at scala.collection.IterableOps$WithFilter.foreach(Iterable.scala:905)
[error] 	at castor.SimpleActor.runBatch0(Actors.scala:75)
[error] 	at castor.BaseActor.castor$BaseActor$$runWithItems(Actors.scala:36)
[error] 	at castor.BaseActor$$anon$1.run(Actors.scala:18)
[error] 	at castor.Context$Impl$$anon$1.run(Context.scala:139)
[error] 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
[error] 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
[error] 	at java.base/java.lang.Thread.run(Thread.java:1583)
```
parent 9b314f9f
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment