Connection reset by peer: socket write error

243 views
Skip to first unread message

jboss...@gmail.com

unread,
Oct 30, 2014, 9:17:05 AM10/30/14
to jedis...@googlegroups.com
Hello, I am using JMeter for some tests in a REST application with JAX-RS. 
Jedis use the Java implementation.


My code part one:

import javax.enterprise.inject.Disposes;
import javax.enterprise.inject.Produces;
import javax.inject.Inject;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;

public class JedisConnectionFactory {

    @Inject
    private JedisPool jedisPool;

    @Produces
    public Jedis getJedis() {
        return jedisPool.getResource();
    }

    public void returnResource(@Disposes Jedis jedis) {
        System.out.println("Returning jedis Connection");
        jedisPool.returnResource(jedis);
    }
}

-
My code parte two:
import javax.enterprise.inject.Disposes;
import javax.enterprise.inject.Produces;
import javax.inject.Singleton;

import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

public class JedisPoolFactory {

    private String host = "localhost";
    private JedisPool jedisPool;

    @Singleton
    public @Produces JedisPool getJedisPool() {
        JedisPoolConfig config = new JedisPoolConfig();
        config.setMaxTotal(10000);
        config.setMaxWaitMillis(5000);
        config.setTestOnBorrow(true);
        config.setTestOnReturn(true);
        
        jedisPool = new JedisPool(config, host, 6379, 2000);
        System.out.println("Jedis Pool: " + jedisPool);
        return jedisPool;
    }

    public void detroy(@Disposes JedisPool jedisPool) {
        System.out.println("Destroying :" + jedisPool);
        jedisPool.destroy();
    }
}

Ocurre exception:
Connection reset by peer: socket write error


My environment is Windows version of Redis 2.8.17, my application server Jboss 8.1 
What can be causing the error?

SungKyung Kim

unread,
Nov 17, 2014, 8:13:24 PM11/17/14
to jedis...@googlegroups.com


2014년 10월 30일 목요일 오후 10시 17분 5초 UTC+9, jboss...@gmail.com 님의 말:
I don't know why causing this error. 

but, error fix it by returnBrokenResource() called.

I saw this error message when I use sentinel redis failover .

I recommand try...catch and catch doing returnBrokenResource() 

I'm sorry for my english.




 
Reply all
Reply to author
Forward
0 new messages