java.net.SocketException: Connection reset


#1

Hi.

I’m using Aerospike Community Version 3.12.1 and Java Client 3.3.4 (spring-data-aerospike 1.0.2).

When I try to delete huge record (about 100,000) by deleteAll() method on AerospikeRepository, the client throw Exception like blow.

org.springframework.dao.RecoverableDataAccessException: Aerospike Error: java.net.SocketException: Connection reset; nested exception is com.aerospike.client.AerospikeException: java.net.SocketException: Connection reset

at org.springframework.data.aerospike.core.DefaultAerospikeExceptionTranslator.translateExceptionIfPossible(DefaultAerospikeExceptionTranslator.java:50) at org.springframework.data.aerospike.core.AerospikeTemplate.delete(AerospikeTemplate.java:382) at org.springframework.data.aerospike.repository.support.SimpleAerospikeRepository.deleteAll(SimpleAerospikeRepository.java:188) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:504) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:489) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:461) …

For a some minute, it works good. But after about 3 minute, the Exception occured.

Here is my client Setting.

@Bean(destroyMethod = “close”) public AerospikeClient aerospikeClient() {

    ClientPolicy policy = new ClientPolicy();
    policy.failIfNotConnected = true;
    policy.timeout = 10000;
    policy.tendInterval = 3000;
    policy.connPoolsPerNode = 5;
    policy.threadPool = Executors.newFixedThreadPool(5, runnable -> {
                                        Thread thread = new Thread(runnable);
                                        thread.setDaemon(true);
                                        return thread;
                                        });
    return new AerospikeClient(policy, aerospikeHost, aerospikePort);
}
@Bean
public AerospikeTemplate aerospikeTemplate() {
    return new AerospikeTemplate(aerospikeClient(), aerospikeNamespace);
}

And this is my Server Configuration.

service { user root group root paxos-single-replica-limit 1 # Number of nodes where the replica count is automatically reduced to 1. pidfile /var/run/aerospike/asd.pid proto-fd-max 15000 }

logging {

Log file must be an absolute path.

file /var/log/aerospike/aerospike.log { context any info } }

network { service { address any port 3000 }

heartbeat { mode mesh address any port 3002

  mesh-seed-address-port 10.0.0.129 3002
  interval 150
  timeout 10

}

fabric { port 3001 }

info { port 3003 } }

namespace trendingo { replication-factor 2 memory-size 4G default-ttl 30d # 30 days, use 0 to never expire/evict.

storage-engine device { device /dev/xvdb #data-in-memory true # Store data in memory in addition to file. write-block-size 128K # adjust block size to make it efficient for SSDs. scheduler-mode noop } }

Is there anybody know the reason or solution?


#2

The current version of spring-data-aerospike doesn’t use set truncate to delete all the records from the set. This will be included in the next release.

In the meantime, you can follow these instructions to manually truncate the set.


#3

Thank you for your kind response.

BTW can I use asinfo at aql?

Or is there other operation in aql for same action (truncate set)??


#4

aql currently doesn’t support set truncate, so for now you can either use asinfo to do the truncate or use the api in one of our clients. Since you are using spring-data, you might be interested in the Java client’s API for truncate.