Ok...so...I found the problem.  Turns out that the mechanism currently used to select which IP address is included in the UDP discovery messages being broadcast out doesn't necessarily return a non-local IP.

See: https://issues.apache.org/jira/browse/JCS-89

A patch has been submitted for inclusion in 1.4 - which reminds me: I need to update to 1.4 and see if this is still an issue there.

Importantly, the issue is that InetAddress.getLocalHost() may not always return the externally-facing address of the machine it's invoked on.  It may, under some circumstances, return a loopback address.  Thus, when the UDP discovery packet reaches the peers, they'll only connect to themselves and not their other peers that are being discovered.

Hence, lateral discovery by UDP is useless.

The simple patch submitted to that JIRA ticket fixes that issue.

Cheers.


Diego Rivera

On 01/25/2012 07:17 PM, Diego Rivera wrote:
Hello!

I'm trying to get lateral UDP discovery to work between two nodes, and each node is only able to connect to "127.0.1.1".  Everything else is working as expected - except, evidently, the lateral cache.  One of the requirements states that nodes should be able to transparently join a cluster - hence UDP discovery is essentially the only option left to me.

Can you guys help me figure out the issue?  I'm using vanilla JCS 1.3, and here's the configuration in use on both machines (note that while the TCP listener and UDP discovery ports are the same, setting them to different values has no impact - nor should it since TCP and UDP ports are apples vs. oranges, really):


########################################
# DEFAULT REGION SETTINGS              #
########################################

jcs.default=DISK,LTCP
jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
jcs.default.cacheattributes.MaxObjects=10000
jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
jcs.default.cacheattributes.UseMemoryShrinker=true
jcs.default.cacheattributes.MaxMemoryIdleTimeSeconds=-1
jcs.default.cacheattributes.ShrinkerIntervalSeconds=3600
jcs.default.cacheattributes.DiskUsagePatternName=UPDATE

jcs.default.elementattributes=org.apache.jcs.engine.ElementAttributes
jcs.default.elementattributes.IsEternal=false
jcs.default.elementattributes.MaxLifeSeconds=7200
jcs.default.elementattributes.IsSpool=true
jcs.default.elementattributes.IsLateral=true
jcs.default.elementattributes.IsRemote=true

########################################
# DISK CACHE                           #
########################################

jcs.auxiliary.DISK=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory
jcs.auxiliary.DISK.attributes=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes
jcs.auxiliary.DISK.attributes.DiskPath=/cache
jcs.auxiliary.DISK.attributes.MaxPurgatorySize=330000
jcs.auxiliary.DISK.attributes.MaxKeySize=1000000
jcs.auxiliary.DISK.attributes.OptimizeAtRemoveCount=10000
jcs.auxiliary.DISK.attributes.OptimizeOnShutdown=true
jcs.auxiliary.DISK.attributes.ClearDiskOnStartup=false
jcs.auxiliary.DISK.attributes.MaxRecycleBinSize=1000000
jcs.auxiliary.DISK.attributes.EventQueueType=POOLED
jcs.auxiliary.DISK.attributes.EventQueuePoolName=DISK_POOL

########################################
# LATERAL CACHE                        #
########################################

jcs.auxiliary.LTCP=org.apache.jcs.auxiliary.lateral.socket.tcp.LateralTCPCacheFactory
jcs.auxiliary.LTCP.attributes=org.apache.jcs.auxiliary.lateral.socket.tcp.TCPLateralCacheAttributes
#jcs.auxiliary.LTCP.attributes.TcpServers=server1:port1,server2:port2,...
jcs.auxiliary.LTCP.attributes.TcpListenerPort=8765
jcs.auxiliary.LTCP.attributes.AllowGet=true
jcs.auxiliary.LTCP.attributes.PutOnlyMode=false
jcs.auxiliary.LTCP.attributes.Receive=true
#jcs.auxiliary.LTCP.attributes.IssueRemoveOnPut=true
#jcs.auxiliary.LTCP.attributes.FilterRemoveByHashCode=true
jcs.auxiliary.LTCP.attributes.SocketTimeOut=1000
jcs.auxiliary.LTCP.attributes.OpenTimeOut=2000
jcs.auxiliary.LTCP.attributes.UdpDiscoveryEnabled=true
jcs.auxiliary.LTCP.attributes.UdpDiscoveryAddr=228.7.6.5
jcs.auxiliary.LTCP.attributes.UdpDiscoveryPort=8765
jcs.auxiliary.LTCP.attributes.ZombieQueueMaxSize=1000

########################################
# THREAD POOL                          #
########################################

thread_pool.default.startUpSize=4
thread_pool.default.minimumPoolSize=4
thread_pool.default.maximumPoolSize=64
thread_pool.default.boundarySize=2000
thread_pool.default.keepAliveTime=350000
#RUN ABORT WAIT BLOCK DISCARDOLDEST
thread_pool.default.whenBlockedPolicy=RUN

thread_pool.DISK_POOL.useBoundary=false
thread_pool.DISK_POOL.minimumPoolSize=4
thread_pool.DISK_POOL.keepAliveTime=3500
thread_pool.DISK_POOL.startUpSize=4


--

Diego Rivera