Write record exception:AerospikeException$Timeout

I am trouble with a problem for writing record Just one record is ok while writing

The exception

com.aerospike.client.AerospikeException$Timeout: Client timeout: iteration=2 socket=30000 total=30000 maxRetries=3 node=BB98B41AA290C00 192.168.44.182 3000 inDoubt=true

	at com.aerospike.client.command.SyncCommand.execute(SyncCommand.java:222)
	at com.aerospike.client.command.SyncCommand.execute(SyncCommand.java:50)
	at com.aerospike.client.AerospikeClient.put(AerospikeClient.java:378)
	at com.zzq.aerospike.AsTest.batchInsert(AsTest.java:199)
	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:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:73)
	at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:83)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
	at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
	at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
	at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)

The Java code


    @Test
    public void batchInsert() {
        Random random = new Random();
        String accountNumber = "accountNumber60";
        String payeeAcc = "peAccountNumber763";
        WritePolicy policy = new WritePolicy();
        policy.socketTimeout=30000;
        policy.totalTimeout=30000;
        policy.maxRetries=3;
        for (int i = 0; i < 20; i++) {
            Bin[] bin1 = {
                    new Bin("serialNumber", "lsh" + random.nextInt(6000)),
                    new Bin("userId", "userId" + random.nextInt(600)),
                    new Bin("userName", "userName" + random.nextInt(600)),
                    new Bin("amount", random.nextInt(6000)),
                    new Bin("hour", 11),
                    new Bin("tradeTime", System.currentTimeMillis() - 10 * 60 * 1000),
                    new Bin("tradeType", 30),
                    new Bin("merchantNumber", "merchantNumber" + random.nextInt(60)),
                    new Bin("accountNumber", accountNumber),
                    new Bin("peAccountNumber", payeeAcc)
            };
            client.put(policy, new Key(namespace, SetName, UUID.randomUUID().toString()), bin1);
        }
    }

What kind of troubleshooting have you done?

I am not sure whether someone else has changed any configuration,.it is ok to insert one record, but the error will be reported while inserting many. I haven’t done anything yet, the system has been reinstalled by someone,so I can’t trace it back. What is for the problem typically?

Timeouts occur when server does not respond by the given timeout (in your case 30 seconds). Your test code looks fine assuming client was successfully instantiated. It might be a network issue.

insert by using aql command also occur the error,select operation is ok ,however.

I suggest looking at the server logs. There may be a server configuration problem.

© 2015 Copyright Aerospike, Inc. | All rights reserved. Creators of the Aerospike Database.