• Bug
  • Status: Closed
  • Resolution: Fixed
  • drb
  • Reporter: sourceforgetracker
  • September 21, 2009
  • 0
  • Watchers: 0
  • September 22, 2009
  • September 22, 2009


First, thanks for making ehcache distributed. It is really helping us a lot.

To help me explain the feature I’m requesting, let me describe a bit about our setup: * Two web servers both using hibernate and ehcache - call them A and B. * Two network interfaces from each server - say IP addresses and is used for HTTP traffic with the public internet and is routed for internal communication only (e.g. talking to the database server).

For security reasons, we would like to ensure that ehcache listens only on interface and that all traffic between the servers goes over the internal route. Hence we put this in ehcache.xml:

We also route to go over the internal interface and not the external one.

Looking at the traffic with tcpdump, we do in fact see that all the ehcache inter-server traffic (both unicast and multicast) is going over the internal network. However, netstat tells us that ehcache is listening on _all_ interfaces - which isn’t what we want. (We do block the unicast port at our external firewall, but would rather not even be listening on that port at the server.)

The methods getUrl() and getUrlBase() in the class RMICachePeer use the hostName parameter, which appears to be causing the actual _traffic_ among the clustered servers to pass over the desired interface. However, the server socket factory passed to UnicastRemoteObject (the parent class) in the RMICachePeer constructor doesn’t use this hostName parameter, so the server socket it creates listens on all interfaces.

The fix would be (I think!) to create a server socket factory similar to ConfigurableRMIClientSocketFactory, and pass this factory to the UnicastRemoteObject constructor. The new factory would construct an InetAddress from the hostName parameter and then use the ServerSocket(int port, int backlog, InetAddress bindAddr) constructor to create the desired socket that listens only on the given interface. (Note that this constructor is available all the way back to Java 1.3 - see http://java.sun.com/j2se/1.3/docs/api/java/net/ServerS ocket.html.)

I’d be happy to try writing and submitting a patch that does this but would need someone to review it carefully as I have not written much networking code before. I’d also need to know your preferred patch format and whether there is anything special about building ehcache.jar (I don’t see an Ant build file in the distribution I have). Sourceforge Ticket ID: 1559733 - Opened By: dsquirrel - 16 Sep 2006 11:04 UTC


Fiona OShea 2009-09-22

Re-opening so that I can properly close out these issues and have correct Resolution status in Jira