[infinispan-dev] Hot Rod client sending data to itself - ISPN-8186

Radim Vansa rvansa at redhat.com
Fri Aug 11 12:17:12 EDT 2017


On 08/11/2017 03:14 PM, Galder Zamarreño wrote:
> Hi,
>
> Re: https://issues.jboss.org/browse/ISPN-8186
>
> I've been looking at TRACE logs and what seems to happen is that is that sometimes, when the client needs to create a new Socket, it sends using the same localport as the Hot Rod server port. As a result, when the client sends something to the server, it also receives it, hence it ends finding a request instead of a response. Analysis of the logs linked in the JIRA can be found in [1].

I've always assumed that a TCP connection is a two-end pipe, both being 
successfully connected to the remote side and looping back messages to 
the client sounds strange... have you googled if this is a bug or 
feature? Or is the client talking to itself only despite the server 
being successfully bound to listen on the port?
>
> What I'm not sure about is how to fix this... There are ways to potentially pass a specific localport to a Socket [2] but this could be a bit messy: It'd require us to generate a random local port and see if that works, making sure that's not the server port...

Clients use ephemeral ports that have limited range (32k+ on Linux?), 
what about making sure that the server port is out of this range?
> However, I think the real problem we're having here is the fact that both the server and client are bound to same IP address, 127.0.0.1. A simpler solution could be a way to get the server to be in a different IP address to the client, but what would that be that IP address and how to make sure it always works? Bind the server to eth0?

I don't think that having both on the same IP is a real problem. 
Testsuite should not listen on externally accessible ports, besides the 
fact that the computer may not have any ports (ok, that's rather 
theoretical nowadays) there's a security risk involved. And if the 
machine has firewall set to block connection to externally accessible 
ports (even from local addresses), the testsuite would fail.

Radim

>
> Any other ideas?
>
> Cheers,
>
> [1] https://gist.github.com/galderz/b8549259ff65cb74505c9268eeec96a7
> [2] http://docs.oracle.com/javase/6/docs/api/java/net/Socket.html#Socket(java.net.InetAddress,%20int,%20java.net.InetAddress,%20int)
> --
> Galder Zamarreño
> Infinispan, Red Hat
>
>
> _______________________________________________
> infinispan-dev mailing list
> infinispan-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/infinispan-dev


-- 
Radim Vansa <rvansa at redhat.com>
JBoss Performance Team



More information about the infinispan-dev mailing list