Server Processing

Hi, I’m saving data into a table in a for loop, it saves some objects but for some, it gave an error “Server.Processing”

I guess the for loop creates the problem, as I try to save the data (for loop limit -> 2) and it works fine. What should I do if I want to save multiple data objects ?
Here is my code for saving data

for (int i = 0; i <userSkillsObjectList.size() ; i++) {
    HashMap userSkillRating = new HashMap();
    userSkillRating.put("skill", userSkillsObjectList.get(i));
    userSkillRating.put("user", response);
    userSkillRating.put("skillRating", 0);
    Backendless.Data.of("UserSkillRating").save(userSkillRating, new AsyncCallback&lt;Map&gt;() {
        @Override
        public void handleResponse(Map response) {
        }
        @Override
        public void handleFault(BackendlessFault fault) {
            Log.d("regis:",fault.getCode()+"\n"+fault.getMessage());
            makeToast("error in inserting UserSkillBridge");
        }
    });//UserSkillRating-insertion
}//for

And here is fault code and fault message which backendless returns

Server.Processing
java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Deadlock found when trying to get lock; try restarting transaction

Is it with version 3 or 4 of Backendless?

It is 3

How many objects in the collection? Does it always fail on the same object?

It fails on more than two objects.

And on more than two objects, it doesn’t fail on every object, it fails on some of them.

Hi Mubtada,

Please prepare a minimal verifiable sample app so that we could reproduce and fix the problem. It can also be a simple one-file java program, not necessarily an Android project. You may attach it here or send to support@backendless.com with a link to this topic.