ava.lang.OutOfMemoryError: Java heap space

JFrog JIRA | Shmulik London | 8 years ago
  1. 0

    I am using following code to get data from redis nodes *RedisTemplate<String, ?> redisTemplate1 = (RedisTemplate<String, ?>) ctx.getBean("redisTemplate1"); RedisTemplate<String, ?> redisTemplate2 = (RedisTemplate<String, ?>) ctx.getBean("redisTemplate2"); List<MediaTrackBO> timeZones = new ArrayList<MediaTrackBO>(); try{ for (Object timezone : redisTemplate2.opsForHash().values(RivetUtil.OBJECT_KEY) ){ timeZones.add((MediaTrackBO) timezone); } if(timeZones.size() <=0){ timeZones=getObjects1(); } }catch(Exception e){ for (Object timezone : redisTemplate1.opsForHash().values(RivetUtil.OBJECT_KEY) ){ timeZones.add((MediaTrackBO) timezone); } }* some times i am getting following exception j{color:red}ava.lang.OutOfMemoryError: Java heap space at redis.clients.jedis.Protocol.processBulkReply(Protocol.java:168) at redis.clients.jedis.Protocol.process(Protocol.java:145) at redis.clients.jedis.Protocol.processMultiBulkReply(Protocol.java:196) at redis.clients.jedis.Protocol.process(Protocol.java:147) at redis.clients.jedis.Protocol.read(Protocol.java:205) at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:297) at redis.clients.jedis.Connection.getBinaryMultiBulkReply(Connection.java:233) at redis.clients.jedis.BinaryJedis.hvals(BinaryJedis.java:917) at org.springframework.data.redis.connection.jedis.JedisConnection.hVals(JedisConnection.java:2909) at org.springframework.data.redis.core.DefaultHashOperations$11.doInRedis(DefaultHashOperations.java:197) at org.springframework.data.redis.core.DefaultHashOperations$11.doInRedis(DefaultHashOperations.java:194) at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:191) at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:153) at org.springframework.data.redis.core.AbstractOperations.execute(AbstractOperations.java:86) at org.springframework.data.redis.core.DefaultHashOperations.values(DefaultHashOperations.java:194) at com.rivetnewsradio.cd.domain.redis.dao.MainPlaylistRepository.getObjects2(MainPlaylistRepository.java:85) at com.rivetnewsradio.cd.service.PlayListServiceImpl.findMainPlaylistFromRedis(PlayListServiceImpl.java:139) at sun.reflect.GeneratedMethodAccessor95.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) at com.sun.proxy.$Proxy42.findMainPlaylistFromRedis(Unknown Source) at com.rivetnewsradio.cd.web.PlayListController.getMainPlayList(PlayListController.java:169) at sun.reflect.GeneratedMethodAccessor94.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43){color} So please let me know better way to fix it, as soon as possible because of it is in production.

    Spring JIRA | 11 months ago | Balaji
    ava.lang.OutOfMemoryError: Java heap space
  2. Speed up your debug routine!

    Automated exception search integrated into your IDE

  3. 0

    how to avoid out of memory with infinite loop

    Google Groups | 8 years ago | Rhino user
    ava.lang.OutOfMemoryError: Java heap space
  4. 0

    I am using following code to get data from redis nodes *RedisTemplate<String, ?> redisTemplate1 = (RedisTemplate<String, ?>) ctx.getBean("redisTemplate1"); RedisTemplate<String, ?> redisTemplate2 = (RedisTemplate<String, ?>) ctx.getBean("redisTemplate2"); List<MediaTrackBO> timeZones = new ArrayList<MediaTrackBO>(); try{ for (Object timezone : redisTemplate2.opsForHash().values(RivetUtil.OBJECT_KEY) ){ timeZones.add((MediaTrackBO) timezone); } if(timeZones.size() <=0){ timeZones=getObjects1(); } }catch(Exception e){ for (Object timezone : redisTemplate1.opsForHash().values(RivetUtil.OBJECT_KEY) ){ timeZones.add((MediaTrackBO) timezone); } }* some times i am getting following exception j{color:red}ava.lang.OutOfMemoryError: Java heap space at redis.clients.jedis.Protocol.processBulkReply(Protocol.java:168) at redis.clients.jedis.Protocol.process(Protocol.java:145) at redis.clients.jedis.Protocol.processMultiBulkReply(Protocol.java:196) at redis.clients.jedis.Protocol.process(Protocol.java:147) at redis.clients.jedis.Protocol.read(Protocol.java:205) at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:297) at redis.clients.jedis.Connection.getBinaryMultiBulkReply(Connection.java:233) at redis.clients.jedis.BinaryJedis.hvals(BinaryJedis.java:917) at org.springframework.data.redis.connection.jedis.JedisConnection.hVals(JedisConnection.java:2909) at org.springframework.data.redis.core.DefaultHashOperations$11.doInRedis(DefaultHashOperations.java:197) at org.springframework.data.redis.core.DefaultHashOperations$11.doInRedis(DefaultHashOperations.java:194) at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:191) at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:153) at org.springframework.data.redis.core.AbstractOperations.execute(AbstractOperations.java:86) at org.springframework.data.redis.core.DefaultHashOperations.values(DefaultHashOperations.java:194) at com.rivetnewsradio.cd.domain.redis.dao.MainPlaylistRepository.getObjects2(MainPlaylistRepository.java:85) at com.rivetnewsradio.cd.service.PlayListServiceImpl.findMainPlaylistFromRedis(PlayListServiceImpl.java:139) at sun.reflect.GeneratedMethodAccessor95.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) at com.sun.proxy.$Proxy42.findMainPlaylistFromRedis(Unknown Source) at com.rivetnewsradio.cd.web.PlayListController.getMainPlayList(PlayListController.java:169) at sun.reflect.GeneratedMethodAccessor94.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43){color} So please let me know better way to fix it, as soon as possible because of it is in production.

    Spring JIRA | 11 months ago | Balaji
    ava.lang.OutOfMemoryError: Java heap space

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. ava.lang.OutOfMemoryError

      Java heap space

      at java.util.Arrays.copyOf()
    2. Java RT
      ArrayList.add
      1. java.util.Arrays.copyOf(Arrays.java:2760)
      2. java.util.Arrays.copyOf(Arrays.java:2734)
      3. java.util.ArrayList.ensureCapacity(ArrayList.java:167)
      4. java.util.ArrayList.add(ArrayList.java:351)
      4 frames
    3. org.amnesia.plugins
      SearchManagerSwing$ExecuteQueryTask.run
      1. org.amnesia.plugins.unification.java.BasicJavaUnification.generageUnificationOptions(BasicJavaUnification.java:338)
      2. org.amnesia.plugins.unification.java.BasicJavaUnification.findUnifications(BasicJavaUnification.java:97)
      3. org.amnesia.plugins.search.SearchManagerSwing.computeUnifications(SearchManagerSwing.java:1239)
      4. org.amnesia.plugins.search.SearchManagerSwing.processResults(SearchManagerSwing.java:908)
      5. org.amnesia.plugins.search.SearchManagerSwing.access$900(SearchManagerSwing.java:80)
      6. org.amnesia.plugins.search.SearchManagerSwing$ExecuteQueryTask.executeAsync(SearchManagerSwing.java:416)
      7. org.amnesia.plugins.search.SearchManagerSwing$ExecuteQueryTask.run(SearchManagerSwing.java:366)
      7 frames
    4. Java RT
      Thread.run
      1. java.lang.Thread.run(Thread.java:619)
      1 frame