Correctly shutting down a websocket handler
by Robin Anil
When a client disconnects, I see that onClose is not being fired. The only
way this seems to be firing if client sents a close frame.
Is there any way to detect disconnection and immediately close all the
opened resources.
Robin
Robin Anil | Software Engineer
1 year, 2 months
Skipping tests
by Jonh Wendell
Hi folks.
Do I have to prepare the env to run the tests within UT source code?
I'm doing:
mvn test -Pproxy -Dtest=LoadBalancingProxyHTTP2TestCase
-DfailIfNoTests=false
But it's skipping all the tests in that class. Even if I don't specify the
class (drop -Dtest=...) those tests are still being skipped. I also tried
without -Pproxy as well, same result.
I noticed that in CI those tests run fine, so, I'm suspecting I'm doing
something wrong (or missing some step) in my env.
Any help is appreciated.
Thanks!
7 years, 6 months
leaking file descriptors when using classpath resource
by Sascha Sadat-Guscheh
Hello!
We pack our undertow application into a fatJar and we want to serve some resources out of that jar file. Currently we initialise our handler like this:
Handlers.resource(ClassPathResourceManager(ClassLoader.getSystemClassLoader(), "public/“))
It works, but for each call we do it opens a file descriptor to the jar and it never closes it so we end up pretty soon with a TooManyOpenFiles exception.
2017-05-22 14:20:24,542 Exception accepting request, closing server channel TCP server (NIO) <33364501> java.io.IOException: Too many open files
at sun.nio.ch.ServerSocketChannelImpl.accept0(Native Method)
at sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:422)
at sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:250)
at org.xnio.nio.QueuedNioTcpServer.handleReady(QueuedNioTcpServer.java:477)
at org.xnio.nio.QueuedNioTcpServerHandle.handleReady(QueuedNioTcpServerHandle.java:38)
at org.xnio.nio.WorkerThread.run(WorkerThread.java:567)
Are we using it wrong?
Best, Sascha
7 years, 6 months
Reverse proxy Websocket connections
by Eldad Rudich
Hi,
I have a custom reverse proxy that based on Undertow, my server uses
undertow's handlers to receive HTTP request, convert them to my custom
protocol and send them to another component in my system that talks to the
actual web server and return the responses.
I would like to also support WebSocket requests, is it possible to support
WebSockets handlers with the same prefix path of the HTTP handler? ( or use
the same handler for both regular HTTP request and WebSockets connection)
Best,
Eldad
7 years, 6 months
Re: [undertow-dev] Suggested change in undertow load balancer proxy client
by Stuart Douglas
The overhead is minimal, it only happens when adding or removing
hosts, even if you have thousands on backend nodes that are changing
all the time it is incredibly unlikely there will ever be a measurable
difference (also this only makes a real difference for additions,
removals are still O(n), so if you are using a proxy with thousands of
backend nodes that are added and removed multiple times per second a
List is not the ideal structure anyway).
The real issue though is that your approach is not thread safe, so
adding or removing a host could cause incoming requests to fail with a
ConcurrentModificationException if the HostSelector attempts to
iterate the host. The solution to this would be to use a thread safe
list, which will either incur the same copy cost (with
CopyOnWriteArrayList) or add runtime overhead (if some kind of
synchronized List is used) that has the potential to significantly
degrade the performance of the proxy.
Stuart
On Fri, May 12, 2017 at 8:28 PM, anurag singhal
<anurags.dreams(a)gmail.com> wrote:
> Hi Stuart,
>
> Thanks for responding.
>
> Yes I agree there are methods available for adding host. My suggestion was
> regarding using list as it will remove the overhead of array copy and
> related operations in both add and remove host.
>
> With Regards
> Anurag Singhal
>
>
> On 12 May 2017 8:37 a.m., "Stuart Douglas" <sdouglas(a)redhat.com> wrote:
>
> You already can add hosts on the fly, using the
> io.undertow.server.handlers.proxy.LoadBalancingProxyClient#addHost(java.net.URI,
> java.lang.String, org.xnio.ssl.XnioSsl) method.
>
> Stuart
>
> On Wed, Apr 19, 2017 at 4:41 PM, anurag singhal
> <anurags.dreams(a)gmail.com> wrote:
>> Hi Team,
>>
>>
>> Kindly find the suggested change. Instead of array used list for hosts.
>> This
>> gives flexibility to add hosts on the fly.
>>
>> With Regards
>> Anurag Singhal
>
>
7 years, 7 months
supplying back pressure when reading from web sockets
by peter royal
i'm extending io.undertow.websockets.core.AbstractReceiveListener to
process incoming websocket messages
if i wanted to implement back pressure to senders, is it sufficient to
toggle WebSocketChannel#suspendReceives and
WebSocketChannel#resumeReceives ?
-pete
--
(peter.royal|osi)(a)pobox.com - http://fotap.org/~osi
7 years, 7 months
Re: [undertow-dev] Suggested change in undertow load balancer proxy client
by Stuart Douglas
You already can add hosts on the fly, using the
io.undertow.server.handlers.proxy.LoadBalancingProxyClient#addHost(java.net.URI,
java.lang.String, org.xnio.ssl.XnioSsl) method.
Stuart
On Wed, Apr 19, 2017 at 4:41 PM, anurag singhal
<anurags.dreams(a)gmail.com> wrote:
> Hi Team,
>
>
> Kindly find the suggested change. Instead of array used list for hosts. This
> gives flexibility to add hosts on the fly.
>
> With Regards
> Anurag Singhal
7 years, 7 months
SSE: testing time between events
by Ryan Dewell
Playing around at the moment, and missing something about the threading situation as it pertains to sending events.
In my ServerSentEventConnectionCallback:
public void connected(ServerSentEventConnection connection, String lastEventId) {
try {
for (int i = 0; i<10; i++){
connection.send("i="+i);
Thread.sleep(1000);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
Sending events, with one second between each.
I’d expect the time between events to be reflected in the browser / client. However what instead happens is all 10 events arrive within the same millisecond (nanoseconds apart according to Chrome console time).
So I’m missing something here. But I don’t see anything obvious. For example, there is nothing like a “flush()” on ServerSentEventConnection that could be used after each event is sent.
Ideas/guidance?
Thanks!
Ryan
7 years, 7 months