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

Description

Hello,

we are using distributed caching using ehcache 1.3.0 in a JBoss cluster and got the following warning during startup:

2007-12-06 15:06:41,613 WARN [net.sf.ehcache.distribution.RMIBootstrapCacheLoader] Error asynchronously performing bootstrap. The cause was: Error bootstrapping from remote peer. Message was: / by zero net.sf.ehcache.distribution.RemoteCacheException: Error bootstrapping from remote peer. Message was: / by zero at net.sf.ehcache.distribution.RMIBootstrapCacheLoader.doLoad(RMIBootstrapCacheLoader.java:175) at net.sf.ehcache.distribution.RMIBootstrapCacheLoader$BootstrapThread.run(RMIBootstrapCacheLoader.java:106) Caused by: java.lang.ArithmeticException: / by zero at net.sf.ehcache.distribution.RMIBootstrapCacheLoader.doLoad(RMIBootstrapCacheLoader.java:159) … 1 more …”

Apparently the exception is due to size being zero in these lines (158, 159) in RMIBootstrapCacheLoader.java:

long size = sampleElement.getSerializedSize(); int chunkSize = (int) (maximumChunkSizeBytes / size);

Shouldn’t the code prevent a division by zero?

Also I am not sure how severe the problem is. It shows up as a warning but I don’t know what the implications are.

thanks Oliver Sourceforge Ticket ID: 1846461 - Opened By: odoepner - 7 Dec 2007 20:34 UTC

Comments

Sourceforge Tracker 2009-09-21

Logged In: YES user_id=693320 Originator: NO

Oliver

The implication is that the bootstrap will fail, but the cache will otherwise work fine. So it will start up with no data.

The issue has been fixed with the following change:

for (int i = 0; i < keys.size(); i++) { Serializable key = (Serializable) keys.get(i); sampleElement = cachePeer.getQuiet(key); if (sampleElement != null && sampleElement.getSerializedSize() != 0) { break; } } if (sampleElement == null) { LOG.debug(“All cache peer elements were either null or empty. Nothing to bootstrap from. Cache was “ + cache.getName() + “. Cache peer was “ + cachePeer); return; }

The fix is in trunk and will be in ehcache-1.4.0.

Thanks Greg Comment by: gregluck - 18 Dec 2007 08:02 UTC

Fiona OShea 2009-09-22

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